Friendly CAP flights now take off from near the centerpoint of mission player slots

This commit is contained in:
Ambroise Garel
2025-07-29 13:25:40 +02:00
parent 0694fc8822
commit a2b9b6d530
2 changed files with 11 additions and 17 deletions
+2 -1
View File
@@ -232,10 +232,11 @@ The core script is quite simple and small, I probably won't need too much help w
- Added "Using the mission menu" section to this README file, detailing all available commands - Added "Using the mission menu" section to this README file, detailing all available commands
- Added "weapons introduction date" table for upcoming "time period" setting (datamined from Briefing Room, many thanks to @john681611) - Added "weapons introduction date" table for upcoming "time period" setting (datamined from Briefing Room, many thanks to @john681611)
- All AI aircraft now despawned on landing to free CPU cycles and allow space for new aircraft - All AI aircraft now despawned on landing to free CPU cycles and allow space for new aircraft
- AWACS aircraft now spawned near the centerpoint of all mission player slots - AWACS aircraft now spawned near the centerpoint of mission player slots
- Changed AWACS aircraft detection logic (a tiny bit less realistic but more efficient) - Changed AWACS aircraft detection logic (a tiny bit less realistic but more efficient)
- Changed some UTF-8 symbols in F10 menu, added UTF-8 symbol for "Objectives" submenu - Changed some UTF-8 symbols in F10 menu, added UTF-8 symbol for "Objectives" submenu
- Fixed missing airbase name in "aircraft landed safely" messages - Fixed missing airbase name in "aircraft landed safely" messages
- Friendly CAP flights now take off from near the centerpoint of mission player slots
- Improved display of XP modifiers in menu - Improved display of XP modifiers in menu
- Improved wording of many lines and commands, correct a bunch of typos - Improved wording of many lines and commands, correct a bunch of typos
- Increased minimum aircraft spawn altitude to avoir crashes in nearby hills - Increased minimum aircraft spawn altitude to avoir crashes in nearby hills
+9 -16
View File
@@ -136,13 +136,11 @@ do
end end
if not validAirbases or #validAirbases == 0 then return false end -- No airbases found for this coalition, nowhere to take off from if not validAirbases or #validAirbases == 0 then return false end -- No airbases found for this coalition, nowhere to take off from
local center = nil
if side == TUM.settings.getPlayerCoalition() then if side == TUM.settings.getPlayerCoalition() then
center = playerCenter validAirbases = { DCSEx.dcs.getNearestObject(playerCenter, validAirbases) }
else else
center = TUM.objectives.getCenter() validAirbases = DCSEx.dcs.getNearestObjects(TUM.objectives.getCenter(), validAirbases)
end end
validAirbases = DCSEx.dcs.getNearestObjects(center, validAirbases)
local airborneUnitCount = getAirborneUnitCount(side) local airborneUnitCount = getAirborneUnitCount(side)
@@ -152,7 +150,8 @@ do
randomizeDesiredAircraftCount(side) randomizeDesiredAircraftCount(side)
end end
return launchNewAircraftGroup(side, airbases) -- return launchNewAircraftGroup(side, airbases)
return launchNewAircraftGroup(side, validAirbases)
end end
end end
@@ -195,19 +194,13 @@ do
end end
function TUM.airForce.onStartUp() function TUM.airForce.onStartUp()
playerCenter = { x = env.mission.map.centerX, y = env.mission.map.centerY } playerCenter = DCSEx.envMission.getPlayerGroupsCenterPoint()
if not playerCenter then
local playerSlots = DCSEx.envMission.getPlayerGroups() playerCenter = { x = env.mission.map.centerX, y = env.mission.map.centerY }
if #playerSlots > 0 then
playerCenter = { x = 0, y = 0 }
for _,p in ipairs(playerSlots) do
playerCenter.x = playerCenter.x + p.x
playerCenter.y = playerCenter.y + p.y
end
playerCenter.x = playerCenter.x / #playerSlots
playerCenter.y = playerCenter.y / #playerSlots
end end
-- TODO: build list of airbases now instead of of each update() (but what about destroyed airbases?)
return true return true
end end
end end