WAREHOUSE

This commit is contained in:
funkyfranky 2018-08-04 18:27:44 +02:00
parent 77f7826084
commit 1ce55f3d3d

View File

@ -89,31 +89,31 @@ WAREHOUSE.Descriptor = {
--- Warehouse unit categories. These are used for --- Warehouse unit categories. These are used for
-- @type WAREHOUSE.Attribute -- @type WAREHOUSE.Attribute
WAREHOUSE.Attribute = { WAREHOUSE.Attribute = {
TRANSPORT_PLANE="transportplane", TRANSPORT_PLANE="Transport_Plane",
TRANSPORT_HELO="transporthelo", TRANSPORT_HELO="Transport_Helo",
TRANSPORT_APC="transportapc", TRANSPORT_APC="Transport_APC",
FIGHTER="fighter", FIGHTER="Fighter",
TANKER="tanker", TANKER="Tanker",
AWACS="awacs", AWACS="AWACS",
ARTILLERY="artillery", ARTILLERY="Artillery",
ATTACKHELICOPTER="attackhelicopter", ATTACKHELICOPTER="Attackhelicopter",
INFANTRY="infantry", INFANTRY="Infantry",
BOMBER="bomber", BOMBER="Bomber",
TANK="tank", TANK="Tank",
TRUCK="truck", TRUCK="Truck",
OTHER="other", SHIP="Ship",
OTHER="Other",
} }
--- Cargo transport type. --- Cargo transport type.
-- @type WAREHOUSE.TransportType -- @type WAREHOUSE.TransportType
-- @field #string AIRPLANE plane blabla
WAREHOUSE.TransportType = { WAREHOUSE.TransportType = {
AIRPLANE = "transportplane", AIRPLANE = "Transport_Plane",
HELICOPTER = "transporthelo", HELICOPTER = "Transport_Helo",
APC = "transportapc", APC = "Transport_APC",
SHIP = "ship", SHIP = "Ship",
TRAIN = "train", TRAIN = "Train",
SELFPROPELLED = "selfporpelled", SELFPROPELLED = "Selfporpelled",
} }
--- Warehouse class version. --- Warehouse class version.
@ -131,6 +131,7 @@ WAREHOUSE.version="0.1.0"
-- TODO: Put active groups into the warehouse. -- TODO: Put active groups into the warehouse.
-- TODO: Spawn warehouse assets as uncontrolled or AI off and activate them when requested. -- TODO: Spawn warehouse assets as uncontrolled or AI off and activate them when requested.
-- TODO: Handle cases with immobile units. -- TODO: Handle cases with immobile units.
-- TODO: Add queue.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Constructor(s) -- Constructor(s)
@ -209,9 +210,7 @@ function WAREHOUSE:NewAirbase(airbase)
--- Triggers the FSM event "Request" after a delay. --- Triggers the FSM event "Request" after a delay.
-- @function [parent=#WAREHOUSE] __Request -- @function [parent=#WAREHOUSE] __Request
-- @param #WAREHOUSE self -- @param #WAREHOUSE self
-- @param #string From From state. -- @param #number Delay Delay in seconds.
-- @param #string Event Event.
-- @param #string To To state.
-- @param Wrapper.Airbase#AIRBASE Airbase Airbase requesting supply. -- @param Wrapper.Airbase#AIRBASE Airbase Airbase requesting supply.
-- @param #WAREHOUSE.Descriptor AssetDescriptor Descriptor describing the asset that is requested. -- @param #WAREHOUSE.Descriptor AssetDescriptor Descriptor describing the asset that is requested.
-- @param AssetDescriptorValue Value of the asset descriptor. Type depends on descriptor, i.e. could be a string, etc. -- @param AssetDescriptorValue Value of the asset descriptor. Type depends on descriptor, i.e. could be a string, etc.
@ -225,8 +224,8 @@ function WAREHOUSE:NewAirbase(airbase)
--- Triggers the FSM event "Delivered" after a delay. --- Triggers the FSM event "Delivered" after a delay.
-- @function [parent=#WAREHOUSE] __Delivered -- @function [parent=#WAREHOUSE] __Delivered
-- @param #number delay Delay in seconds.
-- @param #WAREHOUSE self -- @param #WAREHOUSE self
-- @param #number delay Delay in seconds.
-- @param Wrapper.Group#GROUP group Group that was delivered. -- @param Wrapper.Group#GROUP group Group that was delivered.
return self return self
@ -423,9 +422,13 @@ function WAREHOUSE:onafterRequest(From, Event, To, Airbase, AssetDescriptor, Ass
-- Add spawned groups to cargo group object. -- Add spawned groups to cargo group object.
for _i,_spawngroup in pairs(_spawngroups) do for _i,_spawngroup in pairs(_spawngroups) do
--TODO: check near and load radius. --TODO: check near and load radius.
local cargogroup = CARGO_GROUP:New(_spawngroup, AssetDescriptorValue, string.format("%s %d",AssetDescriptorValue, _i), _loadradius, _nearradius) local _name=string.format("%s %d",AssetDescriptorValue, _i)
env.info(string.format("FF cargo group %d: %s",_i,_name))
local cargogroup = CARGO_GROUP:New(_spawngroup, AssetDescriptorValue, _name, _loadradius, _nearradius)
CargoGroups:AddCargo(cargogroup) CargoGroups:AddCargo(cargogroup)
end end
env.info(string.format("FF cargo set object names %s", CargoGroups:GetObjectNames()))