Added "Give weather report" radio command

This commit is contained in:
Ambroise Garel 2025-09-14 12:12:25 +02:00
parent 104fee86e9
commit 3af259f048
4 changed files with 28 additions and 17 deletions

View File

@ -88,9 +88,9 @@ Please also note that PvP is not supported at the moment and that the mission wi
- Extras
- [x] First draft of the PDF manual
- New features
- [ ] Additional commands in the "navigation" menu
- [ ] Vector to nearest airfield
- [ ] Weather report
- [x] Additional commands in the "navigation" menu
- [x] Vector to nearest airfield
- [x] Weather report
- [ ] Administrative settings
- [x] Use of "Client" slot instead of "Player" slot even in single-player missions, allowing the player to respawn on death/ejection instead of having to start the whole mission again
- [x] Mission now autostarts (if it wasn't started yet) when all players have taken off

View File

@ -210,10 +210,10 @@ Library.radioMessages = {
"No friendly airbase is available at the moment.",
},
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"
"Roger. Weather info coming up now.\n\n$1",
"Copy. Weather report inbound.\n\n$1",
"This is control, checking conditions now.\n\n$1",
"Copy. Weather data on the way.\n\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." },
@ -333,7 +333,6 @@ Library.radioMessages = {
"Command, mission timeline check, are we on schedule?"
},
playerCommandRequireObjectives = {
"Command, request objective $1 coordinates, over.",
"Command, send me grid for objective $1.",

View File

@ -20,6 +20,13 @@ do
end
end
local function getTemperatureCelsiusAndFarenheit(temperature, inKelvins)
inKelvins = inKelvins or false
if inKelvins then temperature = temperature - 273.15 end
return tostring(math.floor(temperature)).."°C/"..tostring(math.floor(DCSEx.converter.celsiusToFahrenheit(temperature))).."°F"
end
function TUM.atc.requestNavAssistanceToObjective(index, delayRadioAnswer)
local obj = TUM.objectives.getObjective(index)
if not obj then return end
@ -118,18 +125,23 @@ do
end
function TUM.atc.requestWeatherUpdate(delayRadioAnswer)
local weatherInfo = "- It is currenly "..DCSEx.string.getTimeString()
local commonWeatherInfo = "- 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"
commonWeatherInfo = commonWeatherInfo.." (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"
commonWeatherInfo = commonWeatherInfo.." (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)
local lTemperature, _ = atmosphere.getTemperatureAndPressure(p:getPoint())
local localWeatherInfo = "- Average windspeed is "..tostring(math.floor(Library.environment.getWindAverage())).."m/s\n"
localWeatherInfo = localWeatherInfo.."- Windspeed at your location is "..DCSEx.math.getLength3D(atmosphere.getWind(p:getPoint())).."m/s\n"
localWeatherInfo = localWeatherInfo.."- Average ground-level temperature is "..getTemperatureCelsiusAndFarenheit(env.mission.weather.season.temperature).."\n"
localWeatherInfo = localWeatherInfo.."- Temperature at your location is "..getTemperatureCelsiusAndFarenheit(lTemperature, true)
TUM.radio.playForUnit(DCSEx.dcs.getObjectIDAsNumber(p), "atcWeatherUpdate", { commonWeatherInfo..localWeatherInfo }, "Control", delayRadioAnswer)
end
end
end

View File

@ -30,7 +30,7 @@ do
local function doCommandWeatherUpdate()
TUM.radio.playForCoalition(TUM.settings.getPlayerCoalition(), "playerATCWeatherUpdate", nil, TUM.mission.getPlayerCallsign(), false)
TUM.atc.requestWeatherUpdate(false)
TUM.atc.requestWeatherUpdate(true)
end
function TUM.missionMenu.create()
@ -38,9 +38,9 @@ do
missionCommands.addCommand("☱ Mission status", rootMenu, doCommandMissionStatus, nil)
local objectivesMenuRoot = missionCommands.addSubMenu("❖ Objectives", rootMenu)
local navigationMenuRoot = missionCommands.addSubMenu("➽ Navigation", rootMenu)
missionCommands.addCommand("Nav to nearest airbase", navigationMenuRoot, doCommandNearestAirbase, nil)
for i=1,TUM.objectives.getCount() do
local obj = TUM.objectives.getObjective(i)
if obj then
@ -51,7 +51,7 @@ do
missionCommands.addCommand("Nav to objective "..objNameAndDescription, navigationMenuRoot, doCommandObjectiveLocation, i)
end
end
-- missionCommands.addCommand("Weather update", navigationMenuRoot, doCommandWeatherUpdate, nil)
missionCommands.addCommand("Weather update", navigationMenuRoot, doCommandWeatherUpdate, nil)
TUM.wingmenMenu.create()
TUM.supportAWACS.createMenu()