mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Ops
This commit is contained in:
@@ -3825,7 +3825,7 @@ function WAREHOUSE:onafterAddAsset(From, Event, To, group, ngroups, forceattribu
|
||||
|
||||
-- Destroy group if it is alive.
|
||||
if group:IsAlive()==true then
|
||||
asset.damage=group:GetDamage()
|
||||
asset.damage=asset.life0-group:GetLife()
|
||||
end
|
||||
|
||||
-- Add asset to stock.
|
||||
@@ -3871,6 +3871,7 @@ function WAREHOUSE:onafterAddAsset(From, Event, To, group, ngroups, forceattribu
|
||||
if group:IsAlive()==true then
|
||||
self:_DebugMessage(string.format("Removing group %s", group:GetName()), 5)
|
||||
-- Setting parameter to false, i.e. creating NO dead or remove unit event, seems to not confuse the dispatcher logic.
|
||||
-- TODO: It would be nice, however, to have the remove event.
|
||||
group:Destroy(false)
|
||||
end
|
||||
|
||||
@@ -3997,6 +3998,7 @@ function WAREHOUSE:_RegisterAsset(group, ngroups, forceattribute, forcecargobay,
|
||||
asset.skill=skill
|
||||
asset.assignment=assignment
|
||||
asset.spawned=false
|
||||
asset.life0=group:GetLife0()
|
||||
asset.damage=0
|
||||
asset.spawngroupname=string.format("%s_AID-%d", templategroupname, asset.uid)
|
||||
|
||||
@@ -4797,22 +4799,8 @@ function WAREHOUSE:onafterArrived(From, Event, To, group)
|
||||
group:RouteGroundTo(warehouse:GetCoordinate(), group:GetSpeedMax()*0.3, "Off Road")
|
||||
end
|
||||
|
||||
-- NOTE: This is done in the AddAsset() function. Dont know, why we do it also here.
|
||||
--[[
|
||||
if istransport==true then
|
||||
request.ntransporthome=request.ntransporthome+1
|
||||
request.transportgroupset:Remove(group:GetName(), true)
|
||||
self:T2(warehouse.lid..string.format("Transport %d of %s returned home.", request.ntransporthome, tostring(request.ntransport)))
|
||||
elseif istransport==false then
|
||||
request.ndelivered=request.ndelivered+1
|
||||
request.cargogroupset:Remove(self:_GetNameWithOut(group), true)
|
||||
self:T2(warehouse.lid..string.format("Cargo %d of %s delivered.", request.ndelivered, tostring(request.nasset)))
|
||||
else
|
||||
self:E(warehouse.lid..string.format("ERROR: Group %s is neither cargo nor transport!", group:GetName()))
|
||||
end
|
||||
]]
|
||||
|
||||
-- Move asset from pending queue into new warehouse.
|
||||
env.info("FF asset arrived in wh. adding in 60 sec")
|
||||
warehouse:__AddAsset(60, group)
|
||||
end
|
||||
|
||||
@@ -6267,7 +6255,6 @@ function WAREHOUSE:_OnEventArrived(EventData)
|
||||
local istransport=self:_GroupIsTransport(group, request)
|
||||
|
||||
-- Get closest airbase.
|
||||
-- Note, this crashed at somepoint when the Tarawa was in the mission. Don't know why. Deleting the Tarawa and adding it again solved the problem.
|
||||
local closest=group:GetCoordinate():GetClosestAirbase()
|
||||
|
||||
-- Check if engine shutdown happend at right airbase because the event is also triggered in other situations.
|
||||
@@ -6276,15 +6263,17 @@ function WAREHOUSE:_OnEventArrived(EventData)
|
||||
-- Check that group is cargo and not transport.
|
||||
if istransport==false and rightairbase then
|
||||
|
||||
-- Debug info.
|
||||
local text=string.format("Air asset group %s from warehouse %s arrived at its destination.", group:GetName(), self.alias)
|
||||
self:_InfoMessage(text)
|
||||
|
||||
-- Trigger arrived event for this group. Note that each unit of a group will trigger this event. So the onafterArrived function needs to take care of that.
|
||||
-- Actually, we only take the first unit of the group that arrives. If it does, we assume the whole group arrived, which might not be the case, since
|
||||
-- some units might still be taxiing or whatever. Therefore, we add 10 seconds for each additional unit of the group until the first arrived event is triggered.
|
||||
local nunits=#group:GetUnits()
|
||||
local dt=10*(nunits-1)+1 -- one unit = 1 sec, two units = 11 sec, three units = 21 sec before we call the group arrived.
|
||||
|
||||
-- Debug info.
|
||||
local text=string.format("Air asset group %s from warehouse %s arrived at its destination. Trigger Arrived event in %d sec", group:GetName(), self.alias, dt)
|
||||
self:_InfoMessage(text)
|
||||
|
||||
|
||||
self:__Arrived(dt, group)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user