From 9df3fcfdf7543a7ce86f1454737533e02912ad3d Mon Sep 17 00:00:00 2001 From: smiki Date: Thu, 17 Jul 2025 23:36:23 +0200 Subject: [PATCH 1/4] [FIXED] attempt to index local 'airbase' (a nil value) --- Moose Development/Moose/Ops/FlightGroup.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Moose Development/Moose/Ops/FlightGroup.lua b/Moose Development/Moose/Ops/FlightGroup.lua index 41b2fb35a..ff56299b1 100644 --- a/Moose Development/Moose/Ops/FlightGroup.lua +++ b/Moose Development/Moose/Ops/FlightGroup.lua @@ -4497,6 +4497,11 @@ function FLIGHTGROUP:GetParkingSpot(element, maxdist, airbase) -- Airbase. 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. local parking=airbase.parking --:GetParkingSpotsTable() From 2f806801bc91dbcbbc089c1442759618c668019f Mon Sep 17 00:00:00 2001 From: smiki Date: Sun, 20 Jul 2025 11:48:35 +0200 Subject: [PATCH 2/4] [ADDED] `AUFTRAG:SetRepeatDelay` --- Moose Development/Moose/Ops/Auftrag.lua | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Moose Development/Moose/Ops/Auftrag.lua b/Moose Development/Moose/Ops/Auftrag.lua index cae2c17c4..e2e94d412 100644 --- a/Moose Development/Moose/Ops/Auftrag.lua +++ b/Moose Development/Moose/Ops/Auftrag.lua @@ -397,6 +397,7 @@ AUFTRAG = { conditionPush = {}, conditionSuccessSet = false, conditionFailureSet = false, + repeatDelay = 1, } --- Global mission counter. @@ -3002,6 +3003,16 @@ function AUFTRAG:SetRepeat(Nrepeat) return self 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. -- @param #AUFTRAG self -- @param #number Nrepeat Number of repeats. Default 0. @@ -5203,7 +5214,7 @@ function AUFTRAG:onafterSuccess(From, Event, To) -- 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:Repeat() + self:__Repeat(self.repeatDelay) else @@ -5245,7 +5256,7 @@ function AUFTRAG:onafterFailed(From, Event, To) -- 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:Repeat() + self:__Repeat(self.repeatDelay) else From b5a19528a148f484fdc86cb16cc5048c26632dfa Mon Sep 17 00:00:00 2001 From: smiki Date: Sun, 20 Jul 2025 12:11:57 +0200 Subject: [PATCH 3/4] [ADDED] `COMMANDER:SetMaxMissionsStartPerCycle` --- Moose Development/Moose/Ops/Commander.lua | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/Moose Development/Moose/Ops/Commander.lua b/Moose Development/Moose/Ops/Commander.lua index a29b2538b..f9037e678 100644 --- a/Moose Development/Moose/Ops/Commander.lua +++ b/Moose Development/Moose/Ops/Commander.lua @@ -136,6 +136,7 @@ COMMANDER = { awacsZones = {}, tankerZones = {}, limitMission = {}, + MaxMissionsAssignPerCycle = 1, } --- COMMANDER class version. @@ -1535,6 +1536,8 @@ function COMMANDER:CheckMissionQueue() end end + local missionsStarted = 0 + -- Loop over missions in queue. for _,_mission in pairs(self.missionqueue) do local mission=_mission --Ops.Auftrag#AUFTRAG @@ -1594,9 +1597,12 @@ function COMMANDER:CheckMissionQueue() -- Recruited assets but no requested escort available. Unrecruit assets! LEGION.UnRecruitAssets(assets, mission) end - - -- Only ONE mission is assigned. - return + + missionsStarted = missionsStarted + 1 + if missionsStarted >= self.maxMissionsAssignPerCycle then + return + end + end else @@ -1611,6 +1617,16 @@ function COMMANDER:CheckMissionQueue() 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. -- @param #COMMANDER self -- @param #table Legions Special legions. From aa8f3a824c3351fb26fcea5563c3883df6c209c1 Mon Sep 17 00:00:00 2001 From: smiki Date: Sun, 20 Jul 2025 12:12:31 +0200 Subject: [PATCH 4/4] [ADDED] `COMMANDER:SetMaxMissionsStartPerCycle` --- Moose Development/Moose/Ops/Commander.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Moose Development/Moose/Ops/Commander.lua b/Moose Development/Moose/Ops/Commander.lua index f9037e678..22a198b0e 100644 --- a/Moose Development/Moose/Ops/Commander.lua +++ b/Moose Development/Moose/Ops/Commander.lua @@ -1536,7 +1536,7 @@ function COMMANDER:CheckMissionQueue() end end - local missionsStarted = 0 + local missionsAssigned = 0 -- Loop over missions in queue. for _,_mission in pairs(self.missionqueue) do @@ -1598,8 +1598,8 @@ function COMMANDER:CheckMissionQueue() LEGION.UnRecruitAssets(assets, mission) end - missionsStarted = missionsStarted + 1 - if missionsStarted >= self.maxMissionsAssignPerCycle then + missionsAssigned = missionsAssigned + 1 + if missionsAssigned >= self.maxMissionsAssignPerCycle then return end