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

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 "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
- 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 some UTF-8 symbols in F10 menu, added UTF-8 symbol for "Objectives" submenu
- 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 wording of many lines and commands, correct a bunch of typos
- Increased minimum aircraft spawn altitude to avoir crashes in nearby hills

View File

@ -136,13 +136,11 @@ do
end
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
center = playerCenter
validAirbases = { DCSEx.dcs.getNearestObject(playerCenter, validAirbases) }
else
center = TUM.objectives.getCenter()
validAirbases = DCSEx.dcs.getNearestObjects(TUM.objectives.getCenter(), validAirbases)
end
validAirbases = DCSEx.dcs.getNearestObjects(center, validAirbases)
local airborneUnitCount = getAirborneUnitCount(side)
@ -152,7 +150,8 @@ do
randomizeDesiredAircraftCount(side)
end
return launchNewAircraftGroup(side, airbases)
-- return launchNewAircraftGroup(side, airbases)
return launchNewAircraftGroup(side, validAirbases)
end
end
@ -195,19 +194,13 @@ do
end
function TUM.airForce.onStartUp()
playerCenter = { x = env.mission.map.centerX, y = env.mission.map.centerY }
local playerSlots = DCSEx.envMission.getPlayerGroups()
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
playerCenter = DCSEx.envMission.getPlayerGroupsCenterPoint()
if not playerCenter then
playerCenter = { x = env.mission.map.centerX, y = env.mission.map.centerY }
end
-- TODO: build list of airbases now instead of of each update() (but what about destroyed airbases?)
return true
end
end