From 13d341c4a862754a082aa9be56337489f6a5041f Mon Sep 17 00:00:00 2001 From: Ambroise Garel <47314805+akaAgar@users.noreply.github.com> Date: Wed, 17 Sep 2025 14:24:11 +0200 Subject: [PATCH] Check that objectives are spawned on unique parking spots --- Script/The Universal Mission/Mission.lua | 1 + Script/The Universal Mission/ObjectivesMaker.lua | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Script/The Universal Mission/Mission.lua b/Script/The Universal Mission/Mission.lua index b60cdd7..1081d27 100644 --- a/Script/The Universal Mission/Mission.lua +++ b/Script/The Universal Mission/Mission.lua @@ -62,6 +62,7 @@ do closeMission(true) TUM.intermission.removeMissionZonesMarkers() + TUM.objectivesMaker.clear() for _=1,TUM.settings.getValue(TUM.settings.id.TARGET_COUNT) do TUM.objectives.add() end diff --git a/Script/The Universal Mission/ObjectivesMaker.lua b/Script/The Universal Mission/ObjectivesMaker.lua index 17a1707..d75df1f 100644 --- a/Script/The Universal Mission/ObjectivesMaker.lua +++ b/Script/The Universal Mission/ObjectivesMaker.lua @@ -6,6 +6,8 @@ TUM.objectivesMaker = {} do + local usedParkingSpots = {} + local function pickRandomTask() local taskFamily = TUM.settings.getValue(TUM.settings.id.TASKING) @@ -41,6 +43,10 @@ do return possiblePoints[1] end + function TUM.objectivesMaker.clear() + usedParkingSpots = {} + end + function TUM.objectivesMaker.create() local zone = DCSEx.zones.getByName(TUM.settings.getValue(TUM.settings.id.TARGET_LOCATION, true)) @@ -88,7 +94,11 @@ do local parkings = pickedAirbase:getParking() local validParkings = {} for _,p in pairs(parkings) do - if p.Term_Type == 104 then table.insert(validParkings, p) end + local parkingUniqueID = pickedAirbase:getID() * 10000 + p.Term_Index + if p.Term_Type == 104 and not DCSEx.table.contains(usedParkingSpots, parkingUniqueID) then + table.insert(usedParkingSpots, parkingUniqueID) -- Make sure parking spot won't be used by another objective + table.insert(validParkings, p) + end end if #validParkings == 0 then TUM.log("Failed to find a valid airbase parking to spawn a target.", TUM.logger.logLevel.WARNING)