mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
#AUFTRAG - Added functions to check repeatability
#OPS - less noise in log #LEGION - Added mission housekeeping
This commit is contained in:
parent
dc863be38a
commit
91e26adc6a
@ -4016,6 +4016,23 @@ function AUFTRAG:IsOver()
|
||||
return over
|
||||
end
|
||||
|
||||
--- Check if mission is repeatable.
|
||||
-- @param #AUFTRAG self
|
||||
-- @return #boolean If true, mission is repeatable.
|
||||
function AUFTRAG:IsRepeatable()
|
||||
local repeatmeS=self.repeatedSuccess<self.NrepeatSuccess or self.repeated<self.Nrepeat
|
||||
local repeatmeF=self.repeatedFailure<self.NrepeatFailure or self.repeated<self.Nrepeat
|
||||
if repeatmeS==true or repeatmeF==true then return true else return false end
|
||||
return false
|
||||
end
|
||||
|
||||
--- Check if mission is NOT repeatable.
|
||||
-- @param #AUFTRAG self
|
||||
-- @return #boolean If true, mission is NOT repeatable.
|
||||
function AUFTRAG:IsNotRepeatable()
|
||||
return not self:IsRepeatable()
|
||||
end
|
||||
|
||||
--- Check if mission is NOT over.
|
||||
-- @param #AUFTRAG self
|
||||
-- @return #boolean If true, mission is NOT over yet.
|
||||
|
||||
@ -5029,7 +5029,7 @@ function FLIGHTGROUP:_UpdateMenu(delay)
|
||||
|
||||
-- Message to group.
|
||||
MESSAGE:New(text, 5):ToGroup(self.group)
|
||||
self:I(self.lid..text)
|
||||
self:T(self.lid..text)
|
||||
end
|
||||
|
||||
-- Get current position of player.
|
||||
|
||||
@ -662,6 +662,15 @@ function LEGION:CheckMissionQueue()
|
||||
if mission:IsNotOver() and mission:IsReadyToCancel() then
|
||||
mission:Cancel()
|
||||
end
|
||||
|
||||
-- Housekeeping
|
||||
local TNow = timer.getTime()
|
||||
if mission:IsOver() and mission:IsNotRepeatable() and mission.DeletionTimstamp == nil then
|
||||
mission.DeletionTimstamp = TNow
|
||||
end
|
||||
if mission.DeletionTimstamp ~= nil and TNow - mission.DeletionTimstamp > 1800 then
|
||||
mission = nil
|
||||
end
|
||||
end
|
||||
|
||||
-- Check that runway is operational and that carrier is not recovering.
|
||||
@ -761,7 +770,7 @@ function LEGION:CheckMissionQueue()
|
||||
-- Reduce number of reinforcements.
|
||||
if reinforce then
|
||||
mission.reinforce=mission.reinforce-#assets
|
||||
self:I(self.lid..string.format("Reinforced with N=%d Nreinforce=%d", #assets, mission.reinforce))
|
||||
self:T(self.lid..string.format("Reinforced with N=%d Nreinforce=%d", #assets, mission.reinforce))
|
||||
end
|
||||
|
||||
return true
|
||||
|
||||
@ -7534,7 +7534,7 @@ end
|
||||
function OPSGROUP:onafterElementDead(From, Event, To, Element)
|
||||
|
||||
-- Debug info.
|
||||
self:I(self.lid..string.format("Element dead %s at t=%.3f", Element.name, timer.getTime()))
|
||||
self:T(self.lid..string.format("Element dead %s at t=%.3f", Element.name, timer.getTime()))
|
||||
|
||||
-- Set element status.
|
||||
self:_UpdateStatus(Element, OPSGROUP.ElementStatus.DEAD)
|
||||
@ -8090,7 +8090,7 @@ function OPSGROUP:onafterStop(From, Event, To)
|
||||
_DATABASE.FLIGHTGROUPS[self.groupname]=nil
|
||||
|
||||
-- Debug output.
|
||||
self:I(self.lid.."STOPPED! Unhandled events, cleared scheduler and removed from _DATABASE")
|
||||
self:T(self.lid.."STOPPED! Unhandled events, cleared scheduler and removed from _DATABASE")
|
||||
end
|
||||
|
||||
--- On after "OutOfAmmo" event.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user