mirror of
https://github.com/akaAgar/the-universal-mission-for-dcs-world.git
synced 2026-08-23 17:55:18 +00:00
Moved "Request objective coordinates" radio commands to new "Navigation" submenu
This commit is contained in:
@@ -1,4 +1,41 @@
|
||||
TUM.atc = {}
|
||||
|
||||
do
|
||||
function TUM.atc.requestNavAssistanceToObjective(index, delayRadioAnswer)
|
||||
local obj = TUM.objectives.getObjective(index)
|
||||
if not obj then return end
|
||||
|
||||
local msgIDSuffix = ""
|
||||
if obj.preciseCoordinates then msgIDSuffix = "Precise" end
|
||||
|
||||
local players = coalition.getPlayers(TUM.settings.getPlayerCoalition())
|
||||
for _,p in ipairs(players) do
|
||||
-- Give BRA to objective
|
||||
local navInfo = "- Fly "..DCSEx.dcs.getBRAA(obj.waypoint3, p:getPoint(), false).."\n"
|
||||
|
||||
-- Give flight time and ETA
|
||||
local velocity = p:getVelocity()
|
||||
local speed = math.max(1, math.sqrt(velocity.x * velocity.x + velocity.y * velocity.y + velocity.z * velocity.z))
|
||||
local distance = DCSEx.math.getDistance2D(obj.waypoint2, DCSEx.math.vec3ToVec2(p:getPoint()))
|
||||
local timeInMinutes = math.max(1, math.floor(distance / (speed * 60)))
|
||||
local eta = DCSEx.string.getTimeString(timer.getAbsTime() + timeInMinutes * 60)
|
||||
if timeInMinutes > 600 then
|
||||
navInfo = navInfo.."- More than ten hours of flight time at current airspeed\n"
|
||||
elseif timeInMinutes > 120 then
|
||||
navInfo = navInfo.."- "..tostring(math.floor(timeInMinutes / 60)).." hours of flight time at current airspeed, ETA "..eta.."\n"
|
||||
else
|
||||
navInfo = navInfo.."- "..tostring(timeInMinutes).." minute(s) of flight time at current airspeed, ETA "..eta.."\n"
|
||||
end
|
||||
|
||||
-- Give objective coordinates
|
||||
if obj.preciseCoordinates then
|
||||
navInfo = navInfo.."\nExact coordinates for objective are:\n"
|
||||
else
|
||||
navInfo = navInfo.."\nNo exact coordinates for objective. Approximate coordinates are:\n"
|
||||
end
|
||||
navInfo = navInfo..DCSEx.world.getCoordinatesAsString(obj.waypoint3, false)
|
||||
|
||||
TUM.radio.playForUnit(DCSEx.dcs.getObjectIDAsNumber(p), "commandObjectiveCoordinates"..msgIDSuffix, { obj.name, navInfo }, "Command", delayRadioAnswer)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -19,17 +19,8 @@ do
|
||||
local obj = TUM.objectives.getObjective(index)
|
||||
if not obj then return end
|
||||
|
||||
local messageSuffix = ""
|
||||
if obj.preciseCoordinates then messageSuffix = "Precise" end
|
||||
|
||||
TUM.radio.playForCoalition(TUM.settings.getPlayerCoalition(), "playerCommandRequireObjectives", { obj.name }, "Flight", false)
|
||||
|
||||
local players = coalition.getPlayers(TUM.settings.getPlayerCoalition())
|
||||
for _,p in ipairs(players) do
|
||||
local coordinates = DCSEx.world.getCoordinatesAsString(obj.waypoint3, false)
|
||||
local braa = DCSEx.dcs.getBRAA(obj.waypoint3, p:getPoint(), false)
|
||||
TUM.radio.playForUnit(DCSEx.dcs.getObjectIDAsNumber(p), "commandObjectiveCoordinates"..messageSuffix, { obj.name, coordinates, braa }, "Command", true)
|
||||
end
|
||||
TUM.atc.requestNavAssistanceToObjective(index, true)
|
||||
end
|
||||
|
||||
function TUM.missionMenu.create()
|
||||
@@ -37,15 +28,20 @@ do
|
||||
missionCommands.addCommand("☱ Mission status", nil, doCommandMissionStatus, nil)
|
||||
|
||||
local objectivesMenuRoot = missionCommands.addSubMenu("❖ Objectives")
|
||||
local navigationMenuRoot = missionCommands.addSubMenu("➽ Navigation")
|
||||
|
||||
for i=1,TUM.objectives.getCount() do
|
||||
local obj = TUM.objectives.getObjective(i)
|
||||
if obj then
|
||||
local objRoot = missionCommands.addSubMenu("Objective "..obj.name.." ("..Library.tasks[obj.taskID].description.short..")", objectivesMenuRoot)
|
||||
missionCommands.addCommand("Request objective coordinates", objRoot, doCommandObjectiveLocation, i)
|
||||
local objNameAndDescription = obj.name.." ("..Library.tasks[obj.taskID].description.short..")"
|
||||
local objRoot = missionCommands.addSubMenu("Objective "..objNameAndDescription, objectivesMenuRoot)
|
||||
TUM.supportJTAC.setupJTACOnObjective(i, objRoot)
|
||||
|
||||
missionCommands.addCommand("Navigation to objective "..objNameAndDescription, navigationMenuRoot, doCommandObjectiveLocation, i)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
TUM.wingmenMenu.create()
|
||||
TUM.supportAWACS.createMenu()
|
||||
|
||||
|
||||
@@ -88,6 +88,6 @@ do
|
||||
local objectiveDB = Library.tasks[obj.taskID]
|
||||
if not DCSEx.table.contains(objectiveDB.flags, DCSEx.enums.taskFlag.ALLOW_JTAC) then return end -- No JTAC for this objective
|
||||
|
||||
missionCommands.addCommand("Require smoke marker on target ("..tostring(SMOKE_MARKER_PENALTY).."xp)", menuRoot, doCommandSmoke, index)
|
||||
missionCommands.addCommand("Smoke marker on target ("..tostring(SMOKE_MARKER_PENALTY).."xp)", menuRoot, doCommandSmoke, index)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user