Skip to content

Commit f083735

Browse files
committed
Improve missile configuration with metadata dictionary
Convert missileCmdIDs to dictionary with id, name, and icon fields. Use loop to generate commandDisplayConfig from dictionary instead of hardcoding each ID. Use missile/launcher unit icons instead of generic attack icon. Consolidates missile metadata in one place. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GiaPfKSj8kGFjaUPyxYYHd
1 parent 908d1bb commit f083735

1 file changed

Lines changed: 27 additions & 16 deletions

File tree

LuaUI/Configs/integral_menu_config.lua

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
local buildCmdFactory, buildCmdEconomy, buildCmdDefence, buildCmdSpecial, buildCmdUnits, cmdPosDef, factoryUnitPosDef = include("Configs/integral_menu_commands_processed.lua", nil, VFS.RAW_FIRST)
22

33
local missileCmdIDs = {
4-
39610, -- EOS
5-
39611, -- Seismic
6-
39612, -- Shockley
7-
39613, -- Inferno
8-
39614, -- Reef Missile
9-
39615, -- Trinity
10-
39616, -- Zeno
4+
{id = 39610, name = "EOS", icon = "tacnuke"},
5+
{id = 39611, name = "Seismic", icon = "seismic"},
6+
{id = 39612, name = "Shockley", icon = "empmissile"},
7+
{id = 39613, name = "Inferno", icon = "napalmmissile"},
8+
{id = 39614, name = "Reef Missile", icon = "shipcarrier"},
9+
{id = 39615, name = "Trinity", icon = "staticnuke"},
10+
{id = 39616, name = "Zeno", icon = "missileslow"},
1111
}
1212

1313
local function isMissileCommand(cmdID)
14-
for _, id in ipairs(missileCmdIDs) do
15-
if cmdID == id then return true end
14+
for _, missile in ipairs(missileCmdIDs) do
15+
if cmdID == missile.id then return true end
1616
end
1717
return false
1818
end
@@ -494,13 +494,24 @@ local factoryButtonLayoutOverride = {
494494
}
495495

496496
-- Missile command display configurations
497-
commandDisplayConfig[39610] = { texture = imageDir .. 'Bold/attack.png', tooltip = "Launch EOS (Tactical Nuke)\nTactical nuclear missile with high damage."}
498-
commandDisplayConfig[39611] = { texture = imageDir .. 'Bold/attack.png', tooltip = "Launch Seismic\nArea denial seismic missile, slows units."}
499-
commandDisplayConfig[39612] = { texture = imageDir .. 'Bold/attack.png', tooltip = "Launch Shockley (EMP)\nElectromagnetic pulse missile disables units."}
500-
commandDisplayConfig[39613] = { texture = imageDir .. 'Bold/attack.png', tooltip = "Launch Inferno (Napalm)\nNapalm missile with persistent damage."}
501-
commandDisplayConfig[39614] = { texture = imageDir .. 'Bold/attack.png', tooltip = "Launch Disarm Missile\nDisables units temporarily."}
502-
commandDisplayConfig[39615] = { texture = imageDir .. 'Bold/attack.png', tooltip = "Launch Trinity (Strategic Nuke)\nLong-range nuclear missile."}
503-
commandDisplayConfig[39616] = { texture = imageDir .. 'Bold/attack.png', tooltip = "Launch Zeno (Slow Missile)\nSlow homing missile with lingering damage."}
497+
local missileTooltips = {
498+
[39610] = "Launch EOS (Tactical Nuke)\nTactical nuclear missile with high damage.",
499+
[39611] = "Launch Seismic\nArea denial seismic missile, slows units.",
500+
[39612] = "Launch Shockley (EMP)\nElectromagnetic pulse missile disables units.",
501+
[39613] = "Launch Inferno (Napalm)\nNapalm missile with persistent damage.",
502+
[39614] = "Launch Disarm Missile\nDisables units temporarily.",
503+
[39615] = "Launch Trinity (Strategic Nuke)\nLong-range nuclear missile.",
504+
[39616] = "Launch Zeno (Slow Missile)\nSlow homing missile with lingering damage.",
505+
}
506+
507+
for _, missile in ipairs(missileCmdIDs) do
508+
local unitDef = UnitDefNames[missile.icon]
509+
local icon = unitDef and ("#" .. unitDef.id) or (imageDir .. 'Bold/attack.png')
510+
commandDisplayConfig[missile.id] = {
511+
texture = icon,
512+
tooltip = missileTooltips[missile.id]
513+
}
514+
end
504515

505516
local function hasMissileUnits()
506517
local teamUnits = Spring.GetTeamUnits(Spring.GetMyTeamID()) or {}

0 commit comments

Comments
 (0)