Multiple ship types, set default cargobay limit, fixed doc bug

This commit is contained in:
acrojason 2020-12-31 17:04:21 -08:00
parent 1b80d68f50
commit ec039f2999
3 changed files with 27 additions and 16 deletions

View File

@ -133,7 +133,6 @@
-- --
-- === -- ===
-- --
-- @field #AI_CARGO_DISPATCHER_SHIP -- @field #AI_CARGO_DISPATCHER_SHIP
AI_CARGO_DISPATCHER_SHIP = { AI_CARGO_DISPATCHER_SHIP = {
ClassName = "AI_CARGO_DISPATCHER_SHIP" ClassName = "AI_CARGO_DISPATCHER_SHIP"

View File

@ -193,7 +193,13 @@
-- warehouseBatumi:AddAsset("Huey", 5, WAREHOUSE.Attribute.AIR_TRANSPORTHELO) -- warehouseBatumi:AddAsset("Huey", 5, WAREHOUSE.Attribute.AIR_TRANSPORTHELO)
-- --
-- This becomes important when assets are requested from other warehouses as described below. In this case, the five Hueys are now marked as transport helicopters and -- This becomes important when assets are requested from other warehouses as described below. In this case, the five Hueys are now marked as transport helicopters and
-- not attack helicopters. -- not attack helicopters. This is also particularly useful when adding assets to a warehouse with the intention of using them to transport other units that are part of
-- a subsequent request (see below). Setting the attribute will help to ensure that warehouse module can find the correct unit when attempting to service a request in its
-- queue. For example, if we want to add an Amphibious Landing Ship, even though most are indeed armed, it's recommended to do the following:
--
-- warehouseBatumi:AddAsset("Landing Ship", 1, WAREHOUSE.Attribute.NAVAL_UNARMEDSHIP)
--
-- Then when adding the request, you can simply specify WAREHOUSE.TransportType.SHIP (which corresponds to NAVAL_UNARMEDSHIP) as the TransportType.
-- --
-- ### Setting the Cargo Bay Weight Limit -- ### Setting the Cargo Bay Weight Limit
-- You can ajust the cargo bay weight limit, in case it is not calculated correctly automatically. For example, the cargo bay of a C-17A is much smaller in DCS than that of a C-130, which is -- You can ajust the cargo bay weight limit, in case it is not calculated correctly automatically. For example, the cargo bay of a C-17A is much smaller in DCS than that of a C-130, which is
@ -1732,6 +1738,9 @@ WAREHOUSE.TransportType = {
APC = "Ground_APC", APC = "Ground_APC",
TRAIN = "Ground_Train", TRAIN = "Ground_Train",
SHIP = "Naval_UnarmedShip", SHIP = "Naval_UnarmedShip",
AIRCRAFTCARRIER = "Naval_AircraftCarrier",
WARSHIP = "Naval_WarShip",
ARMEDSHIP = "Naval_ArmedShip",
SELFPROPELLED = "Selfpropelled", SELFPROPELLED = "Selfpropelled",
} }
@ -4352,7 +4361,7 @@ function WAREHOUSE:onafterRequest(From, Event, To, Request)
self:_ErrorMessage("ERROR: Cargo transport by train not supported yet!") self:_ErrorMessage("ERROR: Cargo transport by train not supported yet!")
return return
elseif Request.transporttype==WAREHOUSE.TransportType.SHIP then elseif Request.transporttype==WAREHOUSE.TransportType.SHIP or Request.transporttype==WAREHOUSE.TransportType.NAVALCARRIER then
-- Spawn Ship in port zone -- Spawn Ship in port zone
spawngroup=self:_SpawnAssetGroundNaval(_alias, _assetitem, Request, self.portzone) spawngroup=self:_SpawnAssetGroundNaval(_alias, _assetitem, Request, self.portzone)
@ -4483,7 +4492,8 @@ function WAREHOUSE:onafterRequestSpawned(From, Event, To, Request, CargoGroupSet
--_boardradius=nil --_boardradius=nil
elseif Request.transporttype==WAREHOUSE.TransportType.APC then elseif Request.transporttype==WAREHOUSE.TransportType.APC then
--_boardradius=nil --_boardradius=nil
elseif Request.transporttype==WAREHOUSE.TransportType.SHIP then elseif Request.transporttype==WAREHOUSE.TransportType.SHIP or Request.transporttype==WAREHOUSE.TransportType.AIRCRAFTCARRIER
or Request.transporttype==WAREHOUSE.TransportType.ARMEDSHIP or Request.transporttype==WAREHOUSE.TransportType.WARSHIP then
_boardradius=6000 _boardradius=6000
end end
@ -4549,7 +4559,8 @@ function WAREHOUSE:onafterRequestSpawned(From, Event, To, Request, CargoGroupSet
-- Set home zone. -- Set home zone.
CargoTransport:SetHomeZone(self.spawnzone) CargoTransport:SetHomeZone(self.spawnzone)
elseif Request.transporttype==WAREHOUSE.TransportType.SHIP then elseif Request.transporttype==WAREHOUSE.TransportType.SHIP or Request.transporttype==WAREHOUSE.TransportType.AIRCRAFTCARRIER
or Request.transporttype==WAREHOUSE.TransportType.ARMEDSHIP or Request.transporttype==WAREHOUSE.TransportType.WARSHIP then
-- Pickup and deploy zones. -- Pickup and deploy zones.
local PickupZoneSet = SET_ZONE:New():AddZone(self.portzone) local PickupZoneSet = SET_ZONE:New():AddZone(self.portzone)
@ -4577,7 +4588,8 @@ function WAREHOUSE:onafterRequestSpawned(From, Event, To, Request, CargoGroupSet
local pickupinner = 0 local pickupinner = 0
local deployouter = 200 local deployouter = 200
local deployinner = 0 local deployinner = 0
if Request.transporttype==WAREHOUSE.TransportType.SHIP then if Request.transporttype==WAREHOUSE.TransportType.SHIP or Request.transporttype==WAREHOUSE.TransportType.AIRCRAFTCARRIER
or Request.transporttype==WAREHOUSE.TransportType.ARMEDSHIP or Request.transporttype==WAREHOUSE.TransportType.WARSHIP then
pickupouter=1000 pickupouter=1000
pickupinner=20 pickupinner=20
deployouter=1000 deployouter=1000
@ -6968,7 +6980,8 @@ function WAREHOUSE:_CheckRequestValid(request)
valid=false valid=false
end end
elseif request.transporttype==WAREHOUSE.TransportType.SHIP then elseif request.transporttype==WAREHOUSE.TransportType.SHIP or request.transporttype==WAREHOUSE.TransportType.AIRCRAFTCARRIER
or request.transporttype==WAREHOUSE.TransportType.ARMEDSHIP or request.transporttype==WAREHOUSE.TransportType.WARSHIP then
-- Transport by ship. -- Transport by ship.
local shippinglane=self:HasConnectionNaval(request.warehouse) local shippinglane=self:HasConnectionNaval(request.warehouse)
@ -8099,10 +8112,9 @@ function WAREHOUSE:_GetAttribute(group)
-- Ships -- Ships
local aircraftcarrier=group:HasAttribute("Aircraft Carriers") local aircraftcarrier=group:HasAttribute("Aircraft Carriers")
local warship=group:HasAttribute("Heavy armed ships") local warship=group:HasAttribute("Heavy armed ships")
local armedship=group:HasAttribute("Armed Ship") local armedship=group:HasAttribute("Armed ships") or group:HasAttribute("Armed Ship")
local unarmedship=group:HasAttribute("Unarmed ships") local unarmedship=group:HasAttribute("Unarmed ships")
-- Define attribute. Order is important. -- Define attribute. Order is important.
if transportplane then if transportplane then
attribute=WAREHOUSE.Attribute.AIR_TRANSPORTPLANE attribute=WAREHOUSE.Attribute.AIR_TRANSPORTPLANE

View File

@ -1401,7 +1401,7 @@ do -- Cargo
["Dry-cargo ship-1"] = 70000, ["Dry-cargo ship-1"] = 70000,
["Dry-cargo ship-2"] = 70000, ["Dry-cargo ship-2"] = 70000,
} }
self.__.CargoBayWeightLimit = Weights[Desc.typeName] self.__.CargoBayWeightLimit = ( Weights[Desc.typeName] or 50000 )
else else
local Desc = self:GetDesc() local Desc = self:GetDesc()