FLIGHTGROUP

- Increased dealy before Route to base to 1.0 sec. Previous delay of 0.1 sec was apparently too short for the stop flag to take effect and the task was not called done. Hence the mission was also not done.
This commit is contained in:
Frank 2023-01-07 17:04:34 +01:00
parent 584e932769
commit ab272da46e
4 changed files with 20 additions and 21 deletions

View File

@ -1001,8 +1001,8 @@ do -- Unit
--- Enum that stores aircraft refueling system types. --- Enum that stores aircraft refueling system types.
-- @type Unit.RefuelingSystem -- @type Unit.RefuelingSystem
-- @field BOOM_AND_RECEPTACLE -- @field BOOM_AND_RECEPTACLE Tanker with a boom.
-- @field PROBE_AND_DROGUE -- @field PROBE_AND_DROGUE Tanker with a probe.
--- Enum that stores sensor types. --- Enum that stores sensor types.
-- @type Unit.SensorType -- @type Unit.SensorType

View File

@ -216,7 +216,7 @@ FLIGHTGROUP.Players={}
--- FLIGHTGROUP class version. --- FLIGHTGROUP class version.
-- @field #string version -- @field #string version
FLIGHTGROUP.version="0.8.3" FLIGHTGROUP.version="0.8.4"
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- TODO list -- TODO list
@ -2639,18 +2639,7 @@ function FLIGHTGROUP:onafterRTB(From, Event, To, airbase, SpeedTo, SpeedHold, Sp
self.destbase=airbase self.destbase=airbase
-- Cancel all missions. -- Cancel all missions.
for _,_mission in pairs(self.missionqueue) do self:CancelAllMissions()
local mission=_mission --Ops.Auftrag#AUFTRAG
local mystatus=mission:GetGroupStatus(self)
-- Check if mission is already over!
if not (mystatus==AUFTRAG.GroupStatus.DONE or mystatus==AUFTRAG.GroupStatus.CANCELLED) then
local text=string.format("Canceling mission %s in state=%s", mission.name, mission.status)
self:T(self.lid..text)
self:MissionCancel(mission)
end
end
-- Land at airbase. -- Land at airbase.
self:_LandAtAirbase(airbase, SpeedTo, SpeedHold, SpeedLand) self:_LandAtAirbase(airbase, SpeedTo, SpeedHold, SpeedLand)
@ -2895,8 +2884,11 @@ function FLIGHTGROUP:_LandAtAirbase(airbase, SpeedTo, SpeedHold, SpeedLand)
--self:ClearTasks() --self:ClearTasks()
-- Just route the group. Respawn might happen when going from holding to final. -- Just route the group. Respawn might happen when going from holding to final.
-- NOTE: I have delayed that here because of RTB calling _LandAtAirbase which resets current task immediately. So the stop flag change to 1 will not trigger TaskDone() and a current mission is not done either -- NOTE: I have delayed that here because of RTB calling _LandAtAirbase which resets current task immediately.
self:Route(wp, 0.1) -- So the stop flag change to 1 will not trigger TaskDone() and a current mission is not done either!
-- Looks like a delay of 0.1 sec was not enough for the stopflag to take effect. Increasing this to 1.0 sec.
-- This delay is looking better. Hopefully not any unwanted side effects in other situations.
self:Route(wp, 1.0)
end end

View File

@ -1068,7 +1068,8 @@ function LEGION:onafterMissionRequest(From, Event, To, Mission, Assets)
--self:AddRequest(self, WAREHOUSE.Descriptor.ASSETLIST, Assetlist, #Assetlist, nil, nil, Mission.prio, assignment) --self:AddRequest(self, WAREHOUSE.Descriptor.ASSETLIST, Assetlist, #Assetlist, nil, nil, Mission.prio, assignment)
local request=self:_AddRequest(WAREHOUSE.Descriptor.ASSETLIST, Assetlist, #Assetlist, Mission.prio, assignment) local request=self:_AddRequest(WAREHOUSE.Descriptor.ASSETLIST, Assetlist, #Assetlist, Mission.prio, assignment)
env.info(string.format("FF Added request=%d for Nasssets=%d", request.uid, #Assetlist)) -- Debug Info.
self:T(self.lid..string.format("Added request=%d for Nasssets=%d", request.uid, #Assetlist))
-- The queueid has been increased in the onafterAddRequest function. So we can simply use it here. -- The queueid has been increased in the onafterAddRequest function. So we can simply use it here.
--Mission.requestID[self.alias]=self.queueid --Mission.requestID[self.alias]=self.queueid

View File

@ -4898,7 +4898,7 @@ function OPSGROUP:RemoveMission(Mission)
return self return self
end end
--- Cancel all missions in mission queue. --- Cancel all missions in mission queue that are not already done or cancelled.
-- @param #OPSGROUP self -- @param #OPSGROUP self
function OPSGROUP:CancelAllMissions() function OPSGROUP:CancelAllMissions()
self:T(self.lid.."Cancelling ALL missions!") self:T(self.lid.."Cancelling ALL missions!")
@ -4906,7 +4906,13 @@ function OPSGROUP:CancelAllMissions()
-- Cancel all missions. -- Cancel all missions.
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:IsNotOver() then
-- Current group status.
local mystatus=mission:GetGroupStatus(self)
-- Check if mission is already over!
if not (mystatus==AUFTRAG.GroupStatus.DONE or mystatus==AUFTRAG.GroupStatus.CANCELLED) then
--if mission:IsNotOver() then
self:T(self.lid.."Cancelling mission "..tostring(mission:GetName())) self:T(self.lid.."Cancelling mission "..tostring(mission:GetName()))
self:MissionCancel(mission) self:MissionCancel(mission)
end end