Merge pull request #12 from VEAF/davidp57/administrative_settings

Introduced administrative settings.
This commit is contained in:
Ambroise Garel
2025-08-05 16:57:28 +02:00
committed by GitHub
8 changed files with 245 additions and 109 deletions
+1 -1
View File
@@ -94,7 +94,7 @@ do
function TUM.debugMenu.createMenu()
if not TUM.DEBUG_MODE then return end
local rootMenu = missionCommands.addSubMenu("[DEBUG]")
local rootMenu = missionCommands.addSubMenu("[DEBUG]", TUM.getOrCreateRootMenu())
missionCommands.addCommand("Detonate - BOOM map markers", rootMenu, doMarkersBoom, nil)
missionCommands.addCommand("Detonate - AIRBOOM map markers", rootMenu, doMarkersAirBoom, nil)
missionCommands.addCommand("Wingman - kill", rootMenu, doKillWingman, nil)
@@ -86,7 +86,7 @@ do
-- Creates the mission briefing menu
-------------------------------------
function TUM.intermission.createMenu()
missionCommands.removeItem() -- Clear the menu
local rootMenu = TUM.getOrCreateRootMenu(true) -- Clear the menu
local briefingText = "Welcome to The Universal Mission for DCS World, a highly customizable mission available for single-player and PvE.\n\nOpen the communication menu and select the ''F10. Other'' option to access mission settings."
DCSEx.envMission.setBriefing(coalition.side.RED, briefingText)
@@ -94,9 +94,9 @@ do
TUM.intermission.createMissionZonesMarkers() -- Show the available mission zones on the F10 map
missionCommands.addCommand(" Display mission settings", nil, TUM.settings.printSettingsSummary, false)
missionCommands.addCommand(" Display mission settings", rootMenu, TUM.settings.printSettingsSummary, false)
local settingsMenu = missionCommands.addSubMenu("✎ Change mission settings")
local settingsMenu = missionCommands.addSubMenu("✎ Change mission settings", rootMenu)
createSubMenu(TUM.settings.id.COALITION_BLUE, settingsMenu)
createSubMenu(TUM.settings.id.COALITION_RED, settingsMenu)
createSubMenu(TUM.settings.id.TASKING, settingsMenu)
@@ -107,7 +107,7 @@ do
createSubMenu(TUM.settings.id.WINGMEN, settingsMenu)
createSubMenu(TUM.settings.id.AI_CAP, settingsMenu)
TUM.playerCareer.createMenu()
missionCommands.addCommand("➤ Begin mission", nil, doCommandStartMission, nil)
missionCommands.addCommand("➤ Begin mission", rootMenu, doCommandStartMission, nil)
TUM.debugMenu.createMenu() -- Append debug menu to other menus (if debug mode enabled)
end
+6 -6
View File
@@ -34,11 +34,11 @@ do
end
function TUM.missionMenu.create()
missionCommands.removeItem() -- Clear the menu
missionCommands.addCommand("☱ Mission status", nil, doCommandMissionStatus, nil)
local rootMenu = TUM.getOrCreateRootMenu(true) -- Clear the menu
missionCommands.addCommand("☱ Mission status", rootMenu, doCommandMissionStatus, nil)
local objectivesMenuRoot = missionCommands.addSubMenu("❖ Objectives")
local navigationMenuRoot = missionCommands.addSubMenu("➽ Navigation")
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
@@ -57,10 +57,10 @@ do
TUM.supportAWACS.createMenu()
if not TUM.settings.getValue(TUM.settings.id.MULTIPLAYER) then -- If not multiplayer, add "show mission score" command
missionCommands.addCommand("★ Display mission score", nil, TUM.playerScore.showScore, nil)
missionCommands.addCommand("★ Display mission score", rootMenu, TUM.playerScore.showScore, nil)
end
local abortRoot = missionCommands.addSubMenu("⬣ Abort mission")
local abortRoot = missionCommands.addSubMenu("⬣ Abort mission", rootMenu)
if not TUM.settings.getValue(TUM.settings.id.MULTIPLAYER) and DCSEx.io.canReadAndWrite() then
missionCommands.addCommand("✓ Confirm (all xp since last landing will be lost!)", abortRoot, doCommandAbortMission, nil)
else
@@ -146,10 +146,11 @@ do
-- Appends the career menu to the F10 menu. Only works in single-player missions
-------------------------------------
function TUM.playerCareer.createMenu()
local rootMenu = TUM.getOrCreateRootMenu()
if not DCSEx.io.canReadAndWrite() then return end -- IO disabled, career and scoring disabled
if TUM.settings.getValue(TUM.settings.id.MULTIPLAYER) then return end -- No career in multiplayer
missionCommands.addCommand("✪ View pilot career stats", nil, TUM.playerCareer.displayMedalBox, true)
missionCommands.addCommand("✪ View pilot career stats", rootMenu, TUM.playerCareer.displayMedalBox, true)
end
-------------------------------------
@@ -91,8 +91,9 @@ do
function TUM.supportAWACS.createMenu()
if not awacsGroupID then return end -- No AWACS
local rootMenu = TUM.getOrCreateRootMenu()
local rootPath = missionCommands.addSubMenu("⌾ Awacs")
local rootPath = missionCommands.addSubMenu("⌾ Awacs", rootMenu)
missionCommands.addCommand("Bogey dope", rootPath, doCommandBogeyDope, nil)
missionCommands.addCommand("Picture", rootPath, doCommandPicture, nil)
end
+21 -1
View File
@@ -125,7 +125,27 @@ do
elseif DCSEx.string.startsWith(z.name:lower(), "water") then
table.insert(waterZones, z)
else
table.insert(missionZones, z)
local onlyZonesStartingWith = TUM.administrativeSettings.getValue(TUM.administrativeSettings.ONLY_ZONES_STARTINGWITH)
if onlyZonesStartingWith and #onlyZonesStartingWith > 0 then
if type(onlyZonesStartingWith) ~= "table" then
onlyZonesStartingWith = { onlyZonesStartingWith }
end
for _, zonePrefix in ipairs(onlyZonesStartingWith) do
if DCSEx.string.startsWith(z.name:lower(), zonePrefix:lower()) then
table.insert(missionZones, z)
break
end
end
else
local ignoreZonesStartingWith = TUM.administrativeSettings.getValue(TUM.administrativeSettings.IGNORE_ZONES_STARTINGWITH)
if ignoreZonesStartingWith then
if not DCSEx.string.startsWith(z.name:lower(), ignoreZonesStartingWith:lower()) then
table.insert(missionZones, z)
end
else
table.insert(missionZones, z)
end
end
end
end
+2 -1
View File
@@ -75,11 +75,12 @@ do
end
function TUM.wingmenMenu.create()
local rootMenu = TUM.getOrCreateRootMenu()
if TUM.settings.getValue(TUM.settings.id.MULTIPLAYER) then return end -- No wingmen in multiplayer
if TUM.settings.getValue(TUM.settings.id.WINGMEN) <= 1 then return end -- No wingmen
local isWW2 = (TUM.settings.getValue(TUM.settings) == DCSEx.enums.timePeriod.WORLD_WAR_2) -- Some options are different when time period is WW2
local rootPath = missionCommands.addSubMenu("✈ Flight")
local rootPath = missionCommands.addSubMenu("✈ Flight", rootMenu)
missionCommands.addCommand("Cover me!", rootPath, radioCommandCoverMe, nil)
------------------------------------------------------