mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-20 06:52:03 +00:00
Ops
This commit is contained in:
@@ -1566,16 +1566,11 @@ function AUFTRAG:onafterStatus(From, Event, To)
|
|||||||
-- All flights have reported MISSON DONE.
|
-- All flights have reported MISSON DONE.
|
||||||
self:Done()
|
self:Done()
|
||||||
|
|
||||||
elseif self.Tstop and timer.getAbsTime()>self.Tstop+10 then
|
elseif (self.Tstop and timer.getAbsTime()>self.Tstop+10) or (self.Ntargets>0 and Ntargets==0) then
|
||||||
|
|
||||||
-- Cancel mission if stop time passed.
|
-- Cancel mission if stop time passed.
|
||||||
self:Cancel()
|
self:Cancel()
|
||||||
|
|
||||||
elseif self.Ntargets>0 and Ntargets==0 then
|
|
||||||
|
|
||||||
-- Cancel mission if all targets were destroyed.
|
|
||||||
self:Cancel()
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -1602,14 +1597,12 @@ function AUFTRAG:onafterStatus(From, Event, To)
|
|||||||
self:E(self.lid..string.format("ERROR: FSM state %s != %s mission status!", fsmstate, self.status))
|
self:E(self.lid..string.format("ERROR: FSM state %s != %s mission status!", fsmstate, self.status))
|
||||||
end
|
end
|
||||||
|
|
||||||
if #self.flightdata>0 then
|
local text="Flight data:"
|
||||||
local text="Flight data:"
|
for groupname,_flightdata in pairs(self.flightdata) do
|
||||||
for groupname,_flightdata in pairs(self.flightdata) do
|
local flightdata=_flightdata --#AUFTRAG.FlightData
|
||||||
local flightdata=_flightdata --#AUFTRAG.FlightData
|
text=text..string.format("\n- %s: status mission=%s flightgroup=%s", groupname, flightdata.status, flightdata.flightgroup and flightdata.flightgroup:GetState() or "N/A")
|
||||||
text=text..string.format("\n- %s: status mission=%s flightgroup=%s", groupname, flightdata.status, flightdata.flightgroup and flightdata.flightgroup:GetState() or "N/A")
|
|
||||||
end
|
|
||||||
self:I(self.lid..text)
|
|
||||||
end
|
end
|
||||||
|
self:I(self.lid..text)
|
||||||
|
|
||||||
local ready2evaluate=self.Tover and Tnow-self.Tover>=self.dTevaluate or false
|
local ready2evaluate=self.Tover and Tnow-self.Tover>=self.dTevaluate or false
|
||||||
|
|
||||||
@@ -1820,6 +1813,7 @@ function AUFTRAG:CheckFlightsDone()
|
|||||||
-- This one is done or cancelled.
|
-- This one is done or cancelled.
|
||||||
else
|
else
|
||||||
-- At least this flight is not DONE or CANCELLED.
|
-- At least this flight is not DONE or CANCELLED.
|
||||||
|
--flightdata.status
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1812,7 +1812,7 @@ function FLIGHTGROUP:_GetNextMission()
|
|||||||
for _,_mission in pairs(self.missionqueue) do
|
for _,_mission in pairs(self.missionqueue) do
|
||||||
local mission=_mission --Ops.Auftrag#AUFTRAG
|
local mission=_mission --Ops.Auftrag#AUFTRAG
|
||||||
|
|
||||||
if mission:GetFlightStatus(self)==AUFTRAG.Status.SCHEDULED and mission:IsReadyToGo() then
|
if mission:GetFlightStatus(self)==AUFTRAG.Status.SCHEDULED and (mission:IsReadyToGo() or self.airwing) then
|
||||||
return mission
|
return mission
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -3544,8 +3544,11 @@ function FLIGHTGROUP:onafterTaskCancel(From, Event, To, Task)
|
|||||||
-- Check if the task is the current task?
|
-- Check if the task is the current task?
|
||||||
if currenttask and Task.id==currenttask.id then
|
if currenttask and Task.id==currenttask.id then
|
||||||
|
|
||||||
|
-- Current stop flag value. I noticed cases, where setting the flag to 1 would not cancel the task, e.g. when firing HARMS on a dead ship.
|
||||||
|
local stopflag=Task.stopflag:Get()
|
||||||
|
|
||||||
-- Debug info.
|
-- Debug info.
|
||||||
local text=string.format("Current task %s ID=%d cancelled", Task.description, Task.id)
|
local text=string.format("Current task %s ID=%d cancelled (flag %s=%d)", Task.description, Task.id, Task.stopflag:GetName(), stopflag)
|
||||||
MESSAGE:New(text, 10, "DEBUG"):ToAllIf(self.Debug)
|
MESSAGE:New(text, 10, "DEBUG"):ToAllIf(self.Debug)
|
||||||
self:I(self.lid..text)
|
self:I(self.lid..text)
|
||||||
|
|
||||||
@@ -3555,6 +3558,9 @@ function FLIGHTGROUP:onafterTaskCancel(From, Event, To, Task)
|
|||||||
if Task.dcstask.id=="Formation" then
|
if Task.dcstask.id=="Formation" then
|
||||||
Task.formation:Stop()
|
Task.formation:Stop()
|
||||||
self:TaskDone(Task)
|
self:TaskDone(Task)
|
||||||
|
elseif stopflag==1 then
|
||||||
|
-- Manuall call TaskDone if setting flag to one was not successful.
|
||||||
|
self:TaskDone(Task)
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user