Added ATC commands

This commit is contained in:
Ambroise Garel 2025-07-29 16:27:04 +02:00
parent d603a3d8a1
commit 423ebbf7b8
2 changed files with 56 additions and 9 deletions

View File

@ -202,15 +202,15 @@ Library.radioMessages = {
},
atcRequireNearestAirbase = { -- TODO: voiceover
"Roger. Vectoring you to the nearest airbase.",
"Copy. Coordinates to nearest field inbound.",
"Roger. Guide you direct to the nearest recovery airfield."
"Roger. Vectoring you to the nearest airbase.\n$1",
"Copy. Coordinates to nearest field inbound.\n$1",
"Roger. Guide you direct to the nearest recovery airfield.\n$1"
},
atcRequireWeather = { -- TODO: voiceover
"Roger. Weather info coming up now.",
"Copy. Weather report inbound.",
"This is control, checking conditions now.",
"Copy. Weather data on the way."
atcWeatherUpdate = { -- TODO: voiceover
"Roger. Weather info coming up now.\n$1",
"Copy. Weather report inbound.\n$1",
"This is control, checking conditions now.\n$1",
"Copy. Weather data on the way.\n$1"
},
atcSafeLanding = { "Be advised: $1 is wheels down at $2 and clear of runway.", "All aircraft, $1 has landed at $2 and vacated active. Runway is open for next inbound.", "Traffic, $1 is on deck at $2 and heading to parking. Runway clear.", "All flights, $1 just rolled out at $2 and cleared the active.", "Heads up, $1 landed at $2 and moving to the ramp. Runway available for next approach." },
atcSafeLandingPlayer = { "$1, wheels on deck, welcome back. You may taxi to the parking area.", "$1, good copy on landing. Exit when able, proceed to the parking area.", "$1, touchdown confirmed. Continue to parking.", "$1, welcome home. Clear of runway and taxi to parking area.", "$1, nice landing. Taxi to parking when ready." },
@ -312,7 +312,7 @@ Library.radioMessages = {
"Control, negative on original destination, request alternate field nearest current position.",
"Control, requesting location and frequency for closest towered airfield."
},
playerATCRequireWeather = { -- TODO: voiceover
playerATCWeatherUpdate = { -- TODO: voiceover
"Control, request latest weather update, over.",
"Control, need current weather and visibility.",
"Control, what's the weather looking like out there?",

View File

@ -38,4 +38,51 @@ do
TUM.radio.playForUnit(DCSEx.dcs.getObjectIDAsNumber(p), "commandObjectiveCoordinates"..msgIDSuffix, { obj.name, navInfo }, "Command", delayRadioAnswer)
end
end
function TUM.atc.requireNearestAirbase(delayRadioAnswer)
local players = coalition.getPlayers(TUM.settings.getPlayerCoalition())
for _,p in ipairs(players) do
local airbaseInfo = "- No airbase available near you at the moment." -- TODO: proper "no airbase" message
local validAirbaseTypes = { Airbase.Category.AIRDROME }
if p:hasAttribute("Helicopters") then table.insert(validAirbaseTypes, Airbase.Category.HELIPAD) end
local pDesc = p:getDesc()
if pDesc.LandRWCategories and #pDesc.LandRWCategories > 0 then
-- TODO: check player unit description to filter compatible carrier types
table.insert(validAirbaseTypes, Airbase.Category.SHIP)
end
local allAirbases = coalition.getAirbases(TUM.settings.getPlayerCoalition())
if allAirbases and #allAirbases > 0 then
allAirbases = DCSEx.dcs.getNearestObjects(DCSEx.math.vec3ToVec2(p:getPoint()), allAirbases)
for i=1,#allAirbases do
local abDesc = airbaseInfo[i]:getDesc()
if DCSEx.table.contains(validAirbaseTypes, abDesc.category) then
airbaseInfo = abDesc.displayName
break
end
end
end
TUM.radio.playForUnit(DCSEx.dcs.getObjectIDAsNumber(p), "atcRequireNearestAirbase", { airbaseInfo }, "Control", delayRadioAnswer)
end
end
function TUM.atc.requestWeatherUpdate(delayRadioAnswer)
local weatherInfo = "- It is currenly "..DCSEx.string.getTimeString()
if Library.environment.isItNightTime() then
weatherInfo = weatherInfo.." (night, sunrise at "..DCSEx.string.getTimeString(Library.environment.getDayTime(nil, false))..")\n"
else
weatherInfo = weatherInfo.." (day, sunset at "..DCSEx.string.getTimeString(Library.environment.getDayTime(nil, true))..")\n"
end
weatherInfo = weatherInfo.."- Average windspeed is "..tostring(DCSEx.floor(Library.environment.getWindAverage())).."m/s\n"
local players = coalition.getPlayers(TUM.settings.getPlayerCoalition())
for _,p in ipairs(players) do
TUM.radio.playForUnit(DCSEx.dcs.getObjectIDAsNumber(p), "atcWeatherUpdate", { weatherInfo }, "Control", delayRadioAnswer)
end
end
end