mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-15 07:26:23 +00:00
Update Warehouse.lua
This commit is contained in:
@@ -6135,36 +6135,42 @@ function WAREHOUSE:_OnEventBirth(EventData)
|
|||||||
-- Debug message.
|
-- Debug message.
|
||||||
self:T(self.lid..string.format("Warehouse %s captured event birth of its asset unit %s. spawned=%s", self.alias, EventData.IniUnitName, tostring(asset.spawned)))
|
self:T(self.lid..string.format("Warehouse %s captured event birth of its asset unit %s. spawned=%s", self.alias, EventData.IniUnitName, tostring(asset.spawned)))
|
||||||
|
|
||||||
-- Birth is triggered for each unit. We need to make sure not to call this too often!
|
if request then
|
||||||
if not asset.spawned then
|
|
||||||
|
|
||||||
-- Remove asset from stock.
|
|
||||||
self:_DeleteStockItem(asset)
|
|
||||||
|
|
||||||
-- Set spawned switch.
|
-- Birth is triggered for each unit. We need to make sure not to call this too often!
|
||||||
asset.spawned=true
|
if not asset.spawned then
|
||||||
asset.spawngroupname=group:GetName()
|
|
||||||
|
-- Remove asset from stock.
|
||||||
|
self:_DeleteStockItem(asset)
|
||||||
|
|
||||||
|
-- Set spawned switch.
|
||||||
|
asset.spawned=true
|
||||||
|
asset.spawngroupname=group:GetName()
|
||||||
|
|
||||||
|
-- Add group.
|
||||||
|
if asset.iscargo==true then
|
||||||
|
request.cargogroupset=request.cargogroupset or SET_GROUP:New()
|
||||||
|
request.cargogroupset:AddGroup(group)
|
||||||
|
else
|
||||||
|
request.transportgroupset=request.transportgroupset or SET_GROUP:New()
|
||||||
|
request.transportgroupset:AddGroup(group)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Set warehouse state.
|
||||||
|
group:SetState(group, "WAREHOUSE", self)
|
||||||
|
|
||||||
|
-- Asset spawned FSM function.
|
||||||
|
--self:__AssetSpawned(1, group, asset, request)
|
||||||
|
self:AssetSpawned(group, asset, request)
|
||||||
|
|
||||||
-- Add group.
|
|
||||||
if asset.iscargo==true then
|
|
||||||
request.cargogroupset=request.cargogroupset or SET_GROUP:New()
|
|
||||||
request.cargogroupset:AddGroup(group)
|
|
||||||
else
|
|
||||||
request.transportgroupset=request.transportgroupset or SET_GROUP:New()
|
|
||||||
request.transportgroupset:AddGroup(group)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Set warehouse state.
|
else
|
||||||
group:SetState(group, "WAREHOUSE", self)
|
--self:T3({wid=wid, uid=self.uid, match=(wid==self.uid), tw=type(wid), tu=type(self.uid)})
|
||||||
|
|
||||||
-- Asset spawned FSM function.
|
|
||||||
--self:__AssetSpawned(1, group, asset, request)
|
|
||||||
self:AssetSpawned(group, asset, request)
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
--self:T3({wid=wid, uid=self.uid, match=(wid==self.uid), tw=type(wid), tu=type(self.uid)})
|
self:E(self.lid..string.format("ERROR: Could not get request when asset spawned! FF investigate!"))
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user