Merge remote-tracking branch 'origin/develop' into branch

This commit is contained in:
Applevangelist 2025-07-20 12:30:51 +02:00
commit 504c531266
3 changed files with 37 additions and 5 deletions

View File

@ -397,6 +397,7 @@ AUFTRAG = {
conditionPush = {}, conditionPush = {},
conditionSuccessSet = false, conditionSuccessSet = false,
conditionFailureSet = false, conditionFailureSet = false,
repeatDelay = 1,
} }
--- Global mission counter. --- Global mission counter.
@ -3002,6 +3003,16 @@ function AUFTRAG:SetRepeat(Nrepeat)
return self return self
end end
--- **[LEGION, COMMANDER, CHIEF]** Set the repeat delay in seconds after a mission is successful/failed. Only valid if the mission is handled by a LEGION (AIRWING, BRIGADE, FLEET) or higher level.
-- @param #AUFTRAG self
-- @param #number Nrepeat Repeat delay in seconds. Default 1.
-- @return #AUFTRAG self
function AUFTRAG:SetRepeatDelay(RepeatDelay)
self.repeatDelay = RepeatDelay
return self
end
--- **[LEGION, COMMANDER, CHIEF]** Set how many times the mission is repeated if it fails. Only valid if the mission is handled by a LEGION (AIRWING, BRIGADE, FLEET) or higher level. --- **[LEGION, COMMANDER, CHIEF]** Set how many times the mission is repeated if it fails. Only valid if the mission is handled by a LEGION (AIRWING, BRIGADE, FLEET) or higher level.
-- @param #AUFTRAG self -- @param #AUFTRAG self
-- @param #number Nrepeat Number of repeats. Default 0. -- @param #number Nrepeat Number of repeats. Default 0.
@ -5203,7 +5214,7 @@ function AUFTRAG:onafterSuccess(From, Event, To)
-- Repeat mission. -- Repeat mission.
self:T(self.lid..string.format("Mission SUCCESS! Repeating mission for the %d time (max %d times) ==> Repeat mission!", self.repeated+1, N)) self:T(self.lid..string.format("Mission SUCCESS! Repeating mission for the %d time (max %d times) ==> Repeat mission!", self.repeated+1, N))
self:Repeat() self:__Repeat(self.repeatDelay)
else else
@ -5245,7 +5256,7 @@ function AUFTRAG:onafterFailed(From, Event, To)
-- Repeat mission. -- Repeat mission.
self:T(self.lid..string.format("Mission FAILED! Repeating mission for the %d time (max %d times) ==> Repeat mission!", self.repeated+1, N)) self:T(self.lid..string.format("Mission FAILED! Repeating mission for the %d time (max %d times) ==> Repeat mission!", self.repeated+1, N))
self:Repeat() self:__Repeat(self.repeatDelay)
else else

View File

@ -136,6 +136,7 @@ COMMANDER = {
awacsZones = {}, awacsZones = {},
tankerZones = {}, tankerZones = {},
limitMission = {}, limitMission = {},
MaxMissionsAssignPerCycle = 1,
} }
--- COMMANDER class version. --- COMMANDER class version.
@ -1535,6 +1536,8 @@ function COMMANDER:CheckMissionQueue()
end end
end end
local missionsAssigned = 0
-- Loop over missions in queue. -- Loop over missions in queue.
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
@ -1595,8 +1598,11 @@ function COMMANDER:CheckMissionQueue()
LEGION.UnRecruitAssets(assets, mission) LEGION.UnRecruitAssets(assets, mission)
end end
-- Only ONE mission is assigned. missionsAssigned = missionsAssigned + 1
return if missionsAssigned >= self.maxMissionsAssignPerCycle then
return
end
end end
else else
@ -1611,6 +1617,16 @@ function COMMANDER:CheckMissionQueue()
end end
--- Set how many missions can be assigned in a single status iteration. (eg. This is useful for persistent missions where you need to load all AUFTRAGs on mission start and then change it back to default)
--- Warning: Increasing this value will increase the number of missions started per iteration and thus may lead to performance issues if too many missions are started at once.
-- @param #COMMANDER self
-- @param #number Number of missions assigned per status iteration. Default is 1.
-- @return #COMMANDER self.
function COMMANDER:SetMaxMissionsAssignPerCycle(MaxMissionsAssignPerCycle)
self.maxMissionsAssignPerCycle = MaxMissionsAssignPerCycle or 1
return self
end
--- Get cohorts. --- Get cohorts.
-- @param #COMMANDER self -- @param #COMMANDER self
-- @param #table Legions Special legions. -- @param #table Legions Special legions.

View File

@ -4497,6 +4497,11 @@ function FLIGHTGROUP:GetParkingSpot(element, maxdist, airbase)
-- Airbase. -- Airbase.
airbase=airbase or self:GetClosestAirbase() airbase=airbase or self:GetClosestAirbase()
if airbase == nil then
self:T(self.lid.."No airbase found for element "..element.name)
return nil
end
-- Parking table of airbase. -- Parking table of airbase.
local parking=airbase.parking --:GetParkingSpotsTable() local parking=airbase.parking --:GetParkingSpotsTable()