diff --git a/Moose Development/Moose/Ops/FlightGroup.lua b/Moose Development/Moose/Ops/FlightGroup.lua index 09ce9a524..afcedc072 100644 --- a/Moose Development/Moose/Ops/FlightGroup.lua +++ b/Moose Development/Moose/Ops/FlightGroup.lua @@ -140,6 +140,7 @@ FLIGHTGROUP = { fuelcritical = nil, fuelcriticalthresh = nil, fuelcriticalrtb = false, + outofAAMrtb = true, squadron = nil, flightcontrol = nil, flaghold = nil, @@ -477,6 +478,20 @@ function FLIGHTGROUP:SetFuelLowRTB(switch) return self end +--- Set if flight is out of Air-Air-Missiles, flight goes RTB. +-- @param #FLIGHTGROUP self +-- @param #boolean switch If true or nil, flight goes RTB. If false, turn this off. +-- @return #FLIGHTGROUP self +function FLIGHTGROUP:SetOutOfAMMRTB(switch) + if switch==false then + self.outofAAMrtb=false + else + self.outofAAMrtb=true + end + return self +end + + --- Set if low fuel threshold is reached, flight tries to refuel at the neares tanker. -- @param #FLIGHTGROUP self -- @param #boolean switch If true or nil, flight goes for refuelling. If false, turn this off. @@ -1015,7 +1030,18 @@ function FLIGHTGROUP:onafterStatus(From, Event, To) if fuelmin RTB event is suspended for 20 sec.")) allowed=false Tsuspend=-20 - self.RTBRecallCount = self.RTBRecallCount+1 - if self.RTBRecallCount > 3 then + local groupspeed = self.group:GetVelocityMPS() + if groupspeed <= 1 then self.RTBRecallCount = self.RTBRecallCount+1 end + if self.RTBRecallCount > 6 then self:Despawn(5) end end