OPS Chief

- Removed mission queue. Now done via COMMANDER
- MissionCancel is buggy
This commit is contained in:
Frank 2021-08-26 23:24:11 +02:00
parent 1b0ad13529
commit a8a8dcff3f
5 changed files with 193 additions and 226 deletions

View File

@ -110,7 +110,7 @@
-- @field #number missionAltitude Mission altitude in meters.
-- @field #number missionSpeed Mission speed in km/h.
-- @field #number missionFraction Mission coordiante fraction. Default is 0.5.
-- @field #number missionRange Mission range in meters. Used in AIRWING class.
-- @field #number missionRange Mission range in meters. Used by LEGION classes (AIRWING, BRIGADE, ...).
-- @field Core.Point#COORDINATE missionWaypointCoord Mission waypoint coordinate.
-- @field Core.Point#COORDINATE missionEgressCoord Mission egress waypoint coordinate.
--
@ -463,6 +463,7 @@ AUFTRAG.version="0.7.1"
-- TODO list
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- TODO: Replace engageRange by missionRange. Here and in other classes. CTRL+H is your friend!
-- TODO: Missions can be assigned to multiple legions.
-- TODO: Mission success options damaged, destroyed.
-- TODO: F10 marker to create new missions.
@ -1552,7 +1553,7 @@ function AUFTRAG:SetPriority(Prio, Urgent, Importance)
return self
end
--- Set how many times the mission is repeated. Only valid if the mission is handled by an AIRWING or higher level.
--- Set how many times the mission is repeated. Only valid if the mission is handled by a LEGION (AIRWING, BRIGADE, ...) or higher level.
-- @param #AUFTRAG self
-- @param #number Nrepeat Number of repeats. Default 0.
-- @return #AUFTRAG self
@ -1561,7 +1562,7 @@ function AUFTRAG:SetRepeat(Nrepeat)
return self
end
--- Set how many times the mission is repeated if it fails. Only valid if the mission is handled by an AIRWING or higher level.
--- Set how many times the mission is repeated if it fails. Only valid if the mission is handled by a LEGION (AIRWING, BRIGADE, ...) or higher level.
-- @param #AUFTRAG self
-- @param #number Nrepeat Number of repeats. Default 0.
-- @return #AUFTRAG self
@ -1570,7 +1571,7 @@ function AUFTRAG:SetRepeatOnFailure(Nrepeat)
return self
end
--- Set how many times the mission is repeated if it was successful. Only valid if the mission is handled by an AIRWING or higher level.
--- Set how many times the mission is repeated if it was successful. Only valid if the mission is handled by a LEGION (AIRWING, BRIGADE, ...) or higher level.
-- @param #AUFTRAG self
-- @param #number Nrepeat Number of repeats. Default 0.
-- @return #AUFTRAG self
@ -1579,7 +1580,7 @@ function AUFTRAG:SetRepeatOnSuccess(Nrepeat)
return self
end
--- Define how many assets are required to do the job. Only valid if the mission is handled by an AIRWING, BRIGADE etc or higher level.
--- Define how many assets are required to do the job. Only valid if the mission is handled by a LEGION (AIRWING, BRIGADE, ...) or higher level.
-- @param #AUFTRAG self
-- @param #number Nassets Number of asset groups. Default 1.
-- @return #AUFTRAG self
@ -2977,25 +2978,27 @@ function AUFTRAG:onafterCancel(From, Event, To)
if self.chief then
-- Debug info.
self:T(self.lid..string.format("CHIEF will cancel the mission. Will wait for mission DONE before evaluation!"))
-- CHIEF will cancel the mission.
self.chief:MissionCancel(self)
end
if self.commander then
elseif self.commander then
-- Debug info.
self:T(self.lid..string.format("COMMANDER will cancel the mission. Will wait for mission DONE before evaluation!"))
-- COMMANDER will cancel the mission.
self.commander:MissionCancel(self)
end
elseif self.legions then
if #self.legions>0 then
for _,_legion in pairs(self.legions) do
-- Loop over all LEGIONs.
for _,_legion in pairs(self.legions or {}) do
local legion=_legion --Ops.Legion#LEGION
-- Debug info.
self:T(self.lid..string.format("LEGION %s will cancel the mission. Will wait for mission DONE before evaluation!", legion.alias))
-- Legion will cancel all flight missions and remove queued request from warehouse queue.
@ -3003,14 +3006,17 @@ function AUFTRAG:onafterCancel(From, Event, To)
end
end
else
-- Debug info.
self:T(self.lid..string.format("No legion, commander or chief. Attached flights will cancel the mission on their own. Will wait for mission DONE before evaluation!"))
self:T(self.lid..string.format("No legion, commander or chief. Attached flights will cancel the mission on their own. Will wait for mission DONE before evaluation!"))
-- Loop over all groups.
for _,_groupdata in pairs(self.groupdata or {}) do
local groupdata=_groupdata --#AUFTRAG.GroupData
groupdata.opsgroup:MissionCancel(self)
end
for _,_groupdata in pairs(self.groupdata or {}) do
local groupdata=_groupdata --#AUFTRAG.GroupData
groupdata.opsgroup:MissionCancel(self)
end
-- Special mission states.

View File

@ -16,7 +16,6 @@
-- @field #string ClassName Name of the class.
-- @field #number verbose Verbosity level.
-- @field #string lid Class id string for output to DCS log file.
-- @field #table missionqueue Mission queue.
-- @field #table targetqueue Target queue.
-- @field Core.Set#SET_ZONE borderzoneset Set of zones defining the border of our territory.
-- @field Core.Set#SET_ZONE yellowzoneset Set of zones defining the extended border. Defcon is set to YELLOW if enemy activity is detected.
@ -42,7 +41,6 @@ CHIEF = {
verbose = 0,
lid = nil,
targetqueue = {},
missionqueue = {},
borderzoneset = nil,
yellowzoneset = nil,
engagezoneset = nil,
@ -80,6 +78,7 @@ CHIEF.version="0.0.1"
-- TODO list
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- TODO: Create a good mission, which can be passed on to the COMMANDER.
-- TODO: Capture OPSZONEs.
-- TODO: Get list of own assets and capabilities.
-- TODO: Get list/overview of enemy assets etc.
@ -112,6 +111,9 @@ function CHIEF:New(AgentSet, Coalition)
self:SetThreatLevelRange()
-- Create a new COMMANDER.
self.commander=COMMANDER:New()
self.Defcon=CHIEF.DEFCON.GREEN
-- Add FSM transitions.
@ -258,20 +260,14 @@ function CHIEF:SetDefcon(Defcon)
end
--- Set the wing commander for the airforce.
--- Get the commander.
-- @param #CHIEF self
-- @param Ops.WingCommander#WINGCOMMANDER WingCommander The WINGCOMMANDER object.
-- @return #CHIEF self
function CHIEF:SetWingCommander(WingCommander)
self.commander=WingCommander
self.commander.chief=self
return self
-- @return Ops.Commander#COMMANDER The commander.
function CHIEF:GetCommander()
return self.commander
end
--- Add mission to mission queue.
--- Add mission to mission queue of the COMMANDER.
-- @param #CHIEF self
-- @param Ops.Auftrag#AUFTRAG Mission Mission to be added.
-- @return #CHIEF self
@ -279,9 +275,7 @@ function CHIEF:AddMission(Mission)
Mission.chief=self
Mission.statusChief=AUFTRAG.Status.QUEUED
table.insert(self.missionqueue, Mission)
self.commander:AddMission(Mission)
return self
end
@ -292,17 +286,9 @@ end
-- @return #CHIEF self
function CHIEF:RemoveMission(Mission)
for i,_mission in pairs(self.missionqueue) do
local mission=_mission --Ops.Auftrag#AUFTRAG
Mission.chief=nil
if mission.auftragsnummer==Mission.auftragsnummer then
self:I(self.lid..string.format("Removing mission %s (%s) status=%s from queue", Mission.name, Mission.type, Mission.status))
Mission.chief=nil
table.remove(self.missionqueue, i)
break
end
end
self.commander:RemoveMission(Mission)
return self
end
@ -412,6 +398,9 @@ function CHIEF:onafterStatus(From, Event, To)
-- FSM state.
local fsmstate=self:GetState()
---
-- CONTACTS: Mission Cleanup
---
-- Clean up missions where the contact was lost.
for _,_contact in pairs(self.ContactsLost) do
@ -427,10 +416,16 @@ function CHIEF:onafterStatus(From, Event, To)
-- Cancel this mission.
contact.mission:Cancel()
-- TODO: contact.target
end
end
---
-- CONTACTS: Create new TARGETS
---
-- Create TARGETs for all new contacts.
local Nred=0 ; local Nyellow=0 ; local Nengage=0
for _,_contact in pairs(self.Contacts) do
@ -485,57 +480,28 @@ function CHIEF:onafterStatus(From, Event, To)
-- Check target queue and assign missions to new targets.
self:CheckTargetQueue()
---
-- Check Mission Queue
---
-- Check mission queue and assign one PLANNED mission.
self:CheckMissionQueue()
---
-- Info General
---
local Nassets=self.commander:CountAssets()
local Ncontacts=#self.contacts
local Nmissions=#self.missionqueue
local Ntargets=#self.targetqueue
if self.verbose>=1 then
local Nassets=self.commander:CountAssets()
local Ncontacts=#self.contacts
local Nmissions=#self.commander.missionqueue
local Ntargets=#self.targetqueue
-- Info message
local text=string.format("Defcon=%s Assets=%d, Contacts: Total=%d Yellow=%d Red=%d, Targets=%d, Missions=%d", self.Defcon, Nassets, Ncontacts, Nyellow, Nred, Ntargets, Nmissions)
self:I(self.lid..text)
-- Info message
local text=string.format("Defcon=%s Assets=%d, Contacts: Total=%d Yellow=%d Red=%d, Targets=%d, Missions=%d", self.Defcon, Nassets, Ncontacts, Nyellow, Nred, Ntargets, Nmissions)
self:I(self.lid..text)
---
-- Info Assets
---
local text="Assets:"
for _,missiontype in pairs(AUFTRAG.Type) do
local N=self.commander:CountAssets(nil, missiontype)
if N>0 then
text=text..string.format("\n- %s %d", missiontype, N)
end
end
self:I(self.lid..text)
local text="Assets:"
for _,attribute in pairs(WAREHOUSE.Attribute) do
local N=self.commander:CountAssets(nil, nil, attribute)
if N>0 or self.verbose>=10 then
text=text..string.format("\n- %s %d", attribute, N)
end
end
self:I(self.lid..text)
---
-- Info Contacts
---
-- Info about contacts.
if #self.Contacts>0 then
if self.verbose>=2 and #self.Contacts>0 then
local text="Contacts:"
for i,_contact in pairs(self.Contacts) do
local contact=_contact --Ops.Intelligence#INTEL.Contact
@ -552,7 +518,7 @@ function CHIEF:onafterStatus(From, Event, To)
-- Info Targets
---
if #self.targetqueue>0 then
if self.verbose>=3 and #self.targetqueue>0 then
local text="Targets:"
for i,_target in pairs(self.targetqueue) do
local target=_target --Ops.Target#TARGET
@ -569,7 +535,7 @@ function CHIEF:onafterStatus(From, Event, To)
---
-- Mission queue.
if #self.missionqueue>0 then
if self.verbose>=4 and #self.commander.missionqueue>0 then
local text="Mission queue:"
for i,_mission in pairs(self.missionqueue) do
local mission=_mission --Ops.Auftrag#AUFTRAG
@ -581,6 +547,30 @@ function CHIEF:onafterStatus(From, Event, To)
self:I(self.lid..text)
end
---
-- Info Assets
---
if self.verbose>=5 then
local text="Assets:"
for _,missiontype in pairs(AUFTRAG.Type) do
local N=self.commander:CountAssets(nil, missiontype)
if N>0 then
text=text..string.format("\n- %s %d", missiontype, N)
end
end
self:I(self.lid..text)
local text="Assets:"
for _,attribute in pairs(WAREHOUSE.Attribute) do
local N=self.commander:CountAssets(nil, nil, attribute)
if N>0 or self.verbose>=10 then
text=text..string.format("\n- %s %d", attribute, N)
end
end
self:I(self.lid..text)
end
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@ -615,21 +605,16 @@ function CHIEF:onafterMissionCancel(From, Event, To, Mission)
-- Debug info.
self:I(self.lid..string.format("Cancelling mission %s (%s) in status %s", Mission.name, Mission.type, Mission.status))
if Mission.status==AUFTRAG.Status.PLANNED then
if Mission:IsPlanned() then
-- Mission is still in planning stage. Should not have an airbase assigned ==> Just remove it form the queue.
-- Mission is still in planning stage. Should not have any LEGIONS assigned ==> Just remove it form the COMMANDER queue.
self:RemoveMission(Mission)
-- Remove Mission from WC queue.
if Mission.wingcommander then
Mission.wingcommander:RemoveMission(Mission)
end
else
-- Wingcommander will cancel mission.
if Mission.wingcommander then
Mission.wingcommander:MissionCancel(Mission)
-- COMMANDER will cancel mission.
if Mission.commander then
Mission.commander:MissionCancel(Mission)
end
end
@ -658,7 +643,7 @@ function CHIEF:onbeforeDefcon(From, Event, To, Defcon)
-- Defcon did not change.
if Defcon==self.Defcon then
self:I(self.lid..string.format("Defcon %s unchanged. No processing transition.", tostring(Defcon)))
self:I(self.lid..string.format("Defcon %s unchanged. Not processing transition!", tostring(Defcon)))
return false
end
@ -736,7 +721,9 @@ function CHIEF:CheckTargetQueue()
-- Valid target?
if valid then
-- Create mission
--TODO: Create a good mission, which can be passed on to the COMMANDER.
-- Create mission.
local mission=AUFTRAG:NewTargetAir(target)
if mission then
@ -748,7 +735,7 @@ function CHIEF:CheckTargetQueue()
mission.prio=target.prio
mission.importance=target.importance
-- Add mission to queue.
-- Add mission to COMMANDER queue.
self:AddMission(mission)
end
@ -763,62 +750,6 @@ end
-- Resources
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- Check mission queue and assign ONE planned mission.
-- @param #CHIEF self
function CHIEF:CheckMissionQueue()
-- TODO: Sort mission queue. wrt what? Threat level?
for _,_mission in pairs(self.missionqueue) do
local mission=_mission --Ops.Auftrag#AUFTRAG
-- We look for PLANNED missions.
if mission:IsPlanned() then
---
-- PLANNNED Mission
---
-- Check if there is an airwing that can do the mission.
local legions=self.commander:GetLegionsForMission(mission)
if airwing then
-- Add mission to airwing.
self:AssignMissionAirforce(mission)
return
else
self:T(self.lid.."NO airwing")
end
else
---
-- Missions NOT in PLANNED state
---
end
end
end
--- Check all airwings if they are able to do a specific mission type at a certain location with a given number of assets.
-- @param #CHIEF self
-- @param Ops.Auftrag#AUFTRAG Mission The mission.
-- @return #table The best LEGIONs for this mission or `nil`.
function CHIEF:GetAirwingForMission(Mission)
if self.commander then
local legions=self.commander:GetLegionsForMission(Mission)
return legions
end
return nil
end
--- Check if group is inside our border.
-- @param #CHIEF self
-- @param Wrapper.Group#GROUP group The group.
@ -878,11 +809,17 @@ function CHIEF:CheckTargetInZones(target, zoneset)
return false
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Resources
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- Check resources.
-- @param #CHIEF self
-- @return #table
function CHIEF:CheckResources()
-- TODO: look at lower classes to do this! it's all there...
local capabilities={}
for _,MissionType in pairs(AUFTRAG.Type) do

View File

@ -34,6 +34,7 @@
-- @field #COMMANDER
COMMANDER = {
ClassName = "COMMANDER",
verbose = 0,
legions = {},
missionqueue = {},
}
@ -76,8 +77,8 @@ function COMMANDER:New()
self:AddTransition("*", "Status", "*") -- Status report.
self:AddTransition("*", "Stop", "Stopped") -- Stop COMMANDER.
self:AddTransition("*", "MissionAssign", "*") -- Mission was assigned to a LEGION.
self:AddTransition("*", "MissionCancel", "*") -- Cancel mission.
self:AddTransition("*", "MissionAssign", "*") -- Mission is assigned to a or multiple LEGIONs.
self:AddTransition("*", "MissionCancel", "*") -- COMMANDER cancels a mission.
------------------------
--- Pseudo Functions ---
@ -92,6 +93,7 @@ function COMMANDER:New()
-- @param #COMMANDER self
-- @param #number delay Delay in seconds.
--- Triggers the FSM event "Stop". Stops the COMMANDER.
-- @param #COMMANDER self
@ -100,6 +102,7 @@ function COMMANDER:New()
-- @param #COMMANDER self
-- @param #number delay Delay in seconds.
--- Triggers the FSM event "Status".
-- @function [parent=#COMMANDER] Status
-- @param #COMMANDER self
@ -116,6 +119,13 @@ function COMMANDER:New()
-- @param Ops.Legion#LEGION Legion The Legion.
-- @param Ops.Auftrag#AUFTRAG Mission The mission.
--- Triggers the FSM event "MissionAssign" after a delay.
-- @function [parent=#COMMANDER] __MissionAssign
-- @param #COMMANDER self
-- @param #number delay Delay in seconds.
-- @param Ops.Legion#LEGION Legion The Legion.
-- @param Ops.Auftrag#AUFTRAG Mission The mission.
--- On after "MissionAssign" event.
-- @function [parent=#COMMANDER] OnAfterMissionAssign
-- @param #COMMANDER self
@ -131,6 +141,12 @@ function COMMANDER:New()
-- @param #COMMANDER self
-- @param Ops.Auftrag#AUFTRAG Mission The mission.
--- Triggers the FSM event "MissionCancel" after a delay.
-- @function [parent=#COMMANDER] __MissionCancel
-- @param #COMMANDER self
-- @param #number delay Delay in seconds.
-- @param Ops.Auftrag#AUFTRAG Mission The mission.
--- On after "MissionCancel" event.
-- @function [parent=#COMMANDER] OnAfterMissionCancel
-- @param #COMMANDER self
@ -146,6 +162,15 @@ end
-- User functions
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- Set verbosity level.
-- @param #COMMANDER self
-- @param #number VerbosityLevel Level of output (higher=more). Default 0.
-- @return #COMMANDER self
function COMMANDER:SetVerbosity(VerbosityLevel)
self.verbose=VerbosityLevel or 0
return self
end
--- Add an AIRWING to the commander.
-- @param #COMMANDER self
-- @param Ops.AirWing#AIRWING Airwing The airwing to add.
@ -248,8 +273,10 @@ function COMMANDER:onafterStatus(From, Event, To)
local fsmstate=self:GetState()
-- Status.
local text=string.format("Status %s: Legions=%d, Missions=%d", fsmstate, #self.legions, #self.missionqueue)
self:I(self.lid..text)
if self.verbose>=1 then
local text=string.format("Status %s: Legions=%d, Missions=%d", fsmstate, #self.legions, #self.missionqueue)
self:I(self.lid..text)
end
-- Check mission queue and assign one PLANNED mission.
self:CheckMissionQueue()
@ -258,7 +285,7 @@ function COMMANDER:onafterStatus(From, Event, To)
-- LEGIONS
---
if #self.legions>0 then
if self.verbose>=2 and #self.legions>0 then
local text="Legions:"
for _,_legion in pairs(self.legions) do
@ -278,61 +305,59 @@ function COMMANDER:onafterStatus(From, Event, To)
self:I(self.lid..text)
local assets={}
if self.verbose>=3 then
local Ntotal=0
local Nspawned=0
local Nrequested=0
local Nreserved=0
local Nstock=0
-- Count numbers
local Ntotal=0
local Nspawned=0
local Nrequested=0
local Nreserved=0
local Nstock=0
local text="===========================================\n"
text=text.."Assets:"
for _,_legion in pairs(self.legions) do
local legion=_legion --Ops.Legion#LEGION
local text="\n===========================================\n"
text=text.."Assets:"
for _,_legion in pairs(self.legions) do
local legion=_legion --Ops.Legion#LEGION
for _,_cohort in pairs(legion.cohorts) do
local cohort=_cohort --Ops.Cohort#COHORT
for _,_cohort in pairs(legion.cohorts) do
local cohort=_cohort --Ops.Cohort#COHORT
for _,_asset in pairs(cohort.assets) do
local asset=_asset --Functional.Warehouse#WAREHOUSE.Assetitem
for _,_asset in pairs(cohort.assets) do
local asset=_asset --Functional.Warehouse#WAREHOUSE.Assetitem
table.insert(assets, asset)
-- Text.
text=text..string.format("\n- %s [UID=%d] Legion=%s, Cohort=%s: Spawned=%s, Requested=%s [RID=%s], Reserved=%s",
asset.spawngroupname, asset.uid, legion.alias, cohort.name, tostring(asset.spawned), tostring(asset.requested), tostring(asset.rid), tostring(asset.isReserved))
text=text..string.format("\n- %s [UID=%d] Legion=%s, Cohort=%s: Spawned=%s, Requested=%s [RID=%s], Reserved=%s",
asset.spawngroupname, asset.uid, legion.alias, cohort.name, tostring(asset.spawned), tostring(asset.requested), tostring(asset.rid), tostring(asset.isReserved))
if asset.spawned then
Nspawned=Nspawned+1
end
if asset.requested then
Nrequested=Nrequested+1
end
if asset.isReserved then
Nreserved=Nreserved+1
end
if not (asset.spawned or asset.requested or asset.isReserved) then
Nstock=Nstock+1
end
Ntotal=Ntotal+1
if asset.spawned then
Nspawned=Nspawned+1
end
if asset.requested then
Nrequested=Nrequested+1
end
if asset.isReserved then
Nreserved=Nreserved+1
end
if not (asset.spawned or asset.requested or asset.isReserved) then
Nstock=Nstock+1
end
Ntotal=Ntotal+1
end
end
text=text.."\n-------------------------------------------"
text=text..string.format("\nNstock = %d", Nstock)
text=text..string.format("\nNreserved = %d", Nreserved)
text=text..string.format("\nNrequested = %d", Nrequested)
text=text..string.format("\nNspawned = %d", Nspawned)
text=text..string.format("\nNtotal = %d (=%d)", Ntotal, Nstock+Nspawned+Nrequested+Nreserved)
text=text.."\n==========================================="
self:I(self.lid..text)
end
text=text.."\n-------------------------------------------"
text=text..string.format("\nNstock = %d", Nstock)
text=text..string.format("\nNreserved = %d", Nreserved)
text=text..string.format("\nNrequested = %d", Nrequested)
text=text..string.format("\nNspawned = %d", Nspawned)
text=text..string.format("\nNtotal = %d (=%d)", Ntotal, Nstock+Nspawned+Nrequested+Nreserved)
text=text.."\n==========================================="
self:I(self.lid..text)
end
@ -341,18 +366,14 @@ function COMMANDER:onafterStatus(From, Event, To)
---
-- Mission queue.
if #self.missionqueue>0 then
if self.verbose>=2 and #self.missionqueue>0 then
local text="Mission queue:"
for i,_mission in pairs(self.missionqueue) do
local mission=_mission --Ops.Auftrag#AUFTRAG
local target=mission:GetTargetName() or "unknown"
text=text..string.format("\n[%d] %s (%s): status=%s, target=%s", i, mission.name, mission.type, mission.status, target)
end
self:I(self.lid..text)
end
self:__Status(-30)

View File

@ -844,8 +844,6 @@ function FLIGHTGROUP:Status()
-- FSM state.
local fsmstate=self:GetState()
env.info(self.lid.."FF status="..fsmstate)
-- Update position.
self:_UpdatePosition()
@ -899,10 +897,13 @@ function FLIGHTGROUP:Status()
local dest=self.destbase and self.destbase:GetName() or "unknown"
local fc=self.flightcontrol and self.flightcontrol.airbasename or "N/A"
local curr=self.currbase and self.currbase:GetName() or "N/A"
local nelem=self:CountElements()
local Nelem=#self.elements
local ndetected=self.detectionOn and tostring(self.detectedunits:Count()) or "OFF"
local text=string.format("Status %s [%d/%d]: Tasks=%d, Missions=%s, Waypoint=%d/%d [%s], Detected=%d, Home=%s, Destination=%s, Current=%s, FC=%s",
fsmstate, #self.elements, #self.elements, nTaskTot, nMissions, self.currentwp or 0, self.waypoints and #self.waypoints or 0, tostring(self.passedfinalwp),
self.detectedunits:Count(), home, dest, curr, fc)
local text=string.format("Status %s [%d/%d]: Tasks=%d, Missions=%s, Waypoint=%d/%d [%s], Detected=%s, Home=%s, Destination=%s, Current=%s, FC=%s",
fsmstate, nelem, Nelem, nTaskTot, nMissions, self.currentwp or 0, self.waypoints and #self.waypoints or 0, tostring(self.passedfinalwp),
ndetected, home, dest, curr, fc)
self:I(self.lid..text)
end

View File

@ -785,10 +785,12 @@ function LEGION:onafterMissionCancel(From, Event, To, Mission)
opsgroup:MissionCancel(Mission)
end
-- TODO: remove asset from mission
-- Remove asset from mission.
Mission:DelAsset(asset)
-- Not requested any more (if it was).
asset.requested=nil
asset.isReserved=nil
end
end