AUFTRAG and WAREHOUSE

- Added check for AUFTRAG that if it is executing and all groups are dead, it's done
- Added check in WAREHOUSE find parking that units need to be alive
This commit is contained in:
Frank
2022-02-08 08:52:47 +01:00
parent 9721c19e48
commit 9cddca1af5
2 changed files with 38 additions and 9 deletions

View File

@@ -3227,6 +3227,26 @@ function AUFTRAG:onafterStatus(From, Event, To)
-- Cancel mission if mission targets are gone (if there were any in the beginning).
-- TODO: I commented this out for some reason but I forgot why...
self:Cancel()
elseif self:IsExecuting() then
-- Had the case that mission was in state Executing but all assigned groups were dead.
-- TODO: might need to loop over all assigned groups
if Ngroups==0 then
self:Done()
else
local done=true
for groupname,data in pairs(self.groupdata or {}) do
local groupdata=data --#AUFTRAG.GroupData
local opsgroup=groupdata.opsgroup
if opsgroup:IsAlive() then
done=false
end
end
if done then
self:Done()
end
end
end