mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
ARMYGROUP
- No retreat on out-of-ammo if rearming mission is in the queue
This commit is contained in:
parent
19a90b7d9d
commit
584e932769
@ -1415,12 +1415,14 @@ function ARMYGROUP:onafterOutOfAmmo(From, Event, To)
|
|||||||
|
|
||||||
-- Second, check if we want to retreat once out of ammo.
|
-- Second, check if we want to retreat once out of ammo.
|
||||||
if self.retreatOnOutOfAmmo then
|
if self.retreatOnOutOfAmmo then
|
||||||
|
self:T(self.lid.."Retreat on out of ammo")
|
||||||
self:__Retreat(-1)
|
self:__Retreat(-1)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Third, check if we want to RTZ once out of ammo.
|
-- Third, check if we want to RTZ once out of ammo (unless we have a rearming mission in the queue).
|
||||||
if self.rtzOnOutOfAmmo then
|
if self.rtzOnOutOfAmmo and not self:IsMissionTypeInQueue(AUFTRAG.Type.REARMING) then
|
||||||
|
self:T(self.lid.."RTZ on out of ammo")
|
||||||
self:__RTZ(-1)
|
self:__RTZ(-1)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1536,6 +1538,7 @@ end
|
|||||||
-- @param Core.Zone#ZONE Zone The zone to return to.
|
-- @param Core.Zone#ZONE Zone The zone to return to.
|
||||||
-- @param #number Formation Formation of the group.
|
-- @param #number Formation Formation of the group.
|
||||||
function ARMYGROUP:onbeforeRTZ(From, Event, To, Zone, Formation)
|
function ARMYGROUP:onbeforeRTZ(From, Event, To, Zone, Formation)
|
||||||
|
self:T2(self.lid.."onbeforeRTZ")
|
||||||
|
|
||||||
-- Zone.
|
-- Zone.
|
||||||
local zone=Zone or self.homezone
|
local zone=Zone or self.homezone
|
||||||
@ -1563,6 +1566,7 @@ end
|
|||||||
-- @param Core.Zone#ZONE Zone The zone to return to.
|
-- @param Core.Zone#ZONE Zone The zone to return to.
|
||||||
-- @param #number Formation Formation of the group.
|
-- @param #number Formation Formation of the group.
|
||||||
function ARMYGROUP:onafterRTZ(From, Event, To, Zone, Formation)
|
function ARMYGROUP:onafterRTZ(From, Event, To, Zone, Formation)
|
||||||
|
self:T2(self.lid.."onafterRTZ")
|
||||||
|
|
||||||
-- Zone.
|
-- Zone.
|
||||||
local zone=Zone or self.homezone
|
local zone=Zone or self.homezone
|
||||||
|
|||||||
@ -4898,6 +4898,22 @@ function OPSGROUP:RemoveMission(Mission)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Cancel all missions in mission queue.
|
||||||
|
-- @param #OPSGROUP self
|
||||||
|
function OPSGROUP:CancelAllMissions()
|
||||||
|
self:T(self.lid.."Cancelling ALL missions!")
|
||||||
|
|
||||||
|
-- Cancel all missions.
|
||||||
|
for _,_mission in pairs(self.missionqueue) do
|
||||||
|
local mission=_mission --Ops.Auftrag#AUFTRAG
|
||||||
|
if mission:IsNotOver() then
|
||||||
|
self:T(self.lid.."Cancelling mission "..tostring(mission:GetName()))
|
||||||
|
self:MissionCancel(mission)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
--- Count remaining missons.
|
--- Count remaining missons.
|
||||||
-- @param #OPSGROUP self
|
-- @param #OPSGROUP self
|
||||||
-- @return #number Number of missions to be done.
|
-- @return #number Number of missions to be done.
|
||||||
@ -5083,6 +5099,24 @@ function OPSGROUP:IsMissionInQueue(Mission)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Check if a given mission type is already in the queue.
|
||||||
|
-- @param #OPSGROUP self
|
||||||
|
-- @param #string MissionType MissionType Type of mission.
|
||||||
|
-- @return #boolean If `true`, the mission type is in the queue.
|
||||||
|
function OPSGROUP:IsMissionTypeInQueue(MissionType)
|
||||||
|
|
||||||
|
for _,_mission in pairs(self.missionqueue) do
|
||||||
|
local mission=_mission --Ops.Auftrag#AUFTRAG
|
||||||
|
|
||||||
|
if mission:GetType()==MissionType then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
--- Get mission by its task id.
|
--- Get mission by its task id.
|
||||||
-- @param #OPSGROUP self
|
-- @param #OPSGROUP self
|
||||||
-- @param #number taskid The id of the (waypoint) task of the mission.
|
-- @param #number taskid The id of the (waypoint) task of the mission.
|
||||||
@ -7536,21 +7570,6 @@ function OPSGROUP:onbeforeDead(From, Event, To)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Cancel all missions in mission queue.
|
|
||||||
-- @param #OPSGROUP self
|
|
||||||
function OPSGROUP:CancelAllMissions()
|
|
||||||
|
|
||||||
-- Cancel all missions.
|
|
||||||
for _,_mission in pairs(self.missionqueue) do
|
|
||||||
local mission=_mission --Ops.Auftrag#AUFTRAG
|
|
||||||
if mission:IsNotOver() then
|
|
||||||
self:T(self.lid.."Cancelling mission "..tostring(mission:GetName()))
|
|
||||||
self:MissionCancel(mission)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
--- On after "Dead" event.
|
--- On after "Dead" event.
|
||||||
-- @param #OPSGROUP self
|
-- @param #OPSGROUP self
|
||||||
-- @param #string From From state.
|
-- @param #string From From state.
|
||||||
@ -10171,8 +10190,10 @@ function OPSGROUP:_CheckGroupDone(delay)
|
|||||||
|
|
||||||
self:T(self.lid..string.format("Passed final WP, adinfinitum=FALSE, LEGION set ==> RTZ"))
|
self:T(self.lid..string.format("Passed final WP, adinfinitum=FALSE, LEGION set ==> RTZ"))
|
||||||
if self.isArmygroup then
|
if self.isArmygroup then
|
||||||
|
self:T2(self.lid.."RTZ to legion spawn zone")
|
||||||
self:RTZ(self.legion.spawnzone)
|
self:RTZ(self.legion.spawnzone)
|
||||||
elseif self.isNavygroup then
|
elseif self.isNavygroup then
|
||||||
|
self:T2(self.lid.."RTZ to legion port zone")
|
||||||
self:RTZ(self.legion.portzone)
|
self:RTZ(self.legion.portzone)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -10255,6 +10276,7 @@ function OPSGROUP:_CheckStuck()
|
|||||||
if self:IsEngaging() then
|
if self:IsEngaging() then
|
||||||
self:__Disengage(1)
|
self:__Disengage(1)
|
||||||
elseif self:IsReturning() then
|
elseif self:IsReturning() then
|
||||||
|
self:T2(self.lid.."RTZ because of stuck")
|
||||||
self:__RTZ(1)
|
self:__RTZ(1)
|
||||||
else
|
else
|
||||||
self:__Cruise(1)
|
self:__Cruise(1)
|
||||||
@ -10274,6 +10296,7 @@ function OPSGROUP:_CheckStuck()
|
|||||||
else
|
else
|
||||||
-- Give cruise command again.
|
-- Give cruise command again.
|
||||||
if self:IsReturning() then
|
if self:IsReturning() then
|
||||||
|
self:T2(self.lid.."RTZ because of stuck")
|
||||||
self:__RTZ(1)
|
self:__RTZ(1)
|
||||||
else
|
else
|
||||||
self:__Cruise(1)
|
self:__Cruise(1)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user