mirror of
https://github.com/akaAgar/the-universal-mission-for-dcs-world.git
synced 2025-11-25 19:31:01 +00:00
Check that objectives are spawned on unique parking spots
This commit is contained in:
parent
0bc9780dd4
commit
13d341c4a8
@ -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
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user