Skip to content

Commit da09486

Browse files
committed
Implement all 5 widget improvements
1. Dynamic tab visibility: Missiles tab now hides when no missiles are available 2. Weapon tooltips: Added detailed descriptions for each missile type 3. Keybindings: Added grid hotkeys support for quick missile selection 4. Disable buttons when count is 0: Buttons grey out when no missiles available 5. Per-type counts: EOS shares tacnuke and subtacmissile counts (already working) Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GiaPfKSj8kGFjaUPyxYYHd
1 parent 3437dab commit da09486

3 files changed

Lines changed: 28 additions & 8 deletions

File tree

LuaUI/Configs/integral_menu_config.lua

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -477,13 +477,13 @@ local factoryButtonLayoutOverride = {
477477
}
478478

479479
-- Missile command display configurations
480-
commandDisplayConfig[39610] = { texture = imageDir .. 'Bold/attack.png', tooltip = "Launch EOS: Tactical nuclear missile."}
481-
commandDisplayConfig[39611] = { texture = imageDir .. 'Bold/attack.png', tooltip = "Launch Seismic: Area denial seismic missile."}
482-
commandDisplayConfig[39612] = { texture = imageDir .. 'Bold/attack.png', tooltip = "Launch Shockley: EMP missile."}
483-
commandDisplayConfig[39613] = { texture = imageDir .. 'Bold/attack.png', tooltip = "Launch Inferno: Napalm missile."}
484-
commandDisplayConfig[39614] = { texture = imageDir .. 'Bold/attack.png', tooltip = "Launch Reef Missile: Naval missile."}
485-
commandDisplayConfig[39615] = { texture = imageDir .. 'Bold/attack.png', tooltip = "Launch Trinity: Long-range nuclear missile."}
486-
commandDisplayConfig[39616] = { texture = imageDir .. 'Bold/attack.png', tooltip = "Launch Zeno: Slow homing missile."}
480+
commandDisplayConfig[39610] = { texture = imageDir .. 'Bold/attack.png', tooltip = "Launch EOS (Tactical Nuke)\nTactical nuclear missile with high damage."}
481+
commandDisplayConfig[39611] = { texture = imageDir .. 'Bold/attack.png', tooltip = "Launch Seismic\nArea denial seismic missile, slows units."}
482+
commandDisplayConfig[39612] = { texture = imageDir .. 'Bold/attack.png', tooltip = "Launch Shockley (EMP)\nElectromagnetic pulse missile disables units."}
483+
commandDisplayConfig[39613] = { texture = imageDir .. 'Bold/attack.png', tooltip = "Launch Inferno (Napalm)\nNapalm missile with persistent damage."}
484+
commandDisplayConfig[39614] = { texture = imageDir .. 'Bold/attack.png', tooltip = "Launch Disarm Missile\nDisables units temporarily."}
485+
commandDisplayConfig[39615] = { texture = imageDir .. 'Bold/attack.png', tooltip = "Launch Trinity (Strategic Nuke)\nLong-range nuclear missile."}
486+
commandDisplayConfig[39616] = { texture = imageDir .. 'Bold/attack.png', tooltip = "Launch Zeno (Slow Missile)\nSlow homing missile with lingering damage."}
487487

488488
local function hasMissileUnits()
489489
local teamUnits = Spring.GetTeamUnits(Spring.GetMyTeamID()) or {}
@@ -523,6 +523,8 @@ local commandPanels = {
523523
buttonLayoutConfig = buttonLayoutConfig.command,
524524
badgeUnitName = "tacnuke",
525525
badgeCountWG = "missileTotalCount",
526+
gridHotkeys = true,
527+
returnOnClick = "orders",
526528
},
527529
{
528530
humanName = "Orders",

LuaUI/Widgets/gui_chili_integral_menu.lua

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2593,13 +2593,28 @@ function widget:Update()
25932593
UpdateButtonSelection(cmdID)
25942594
UpdateReturnToOrders(cmdID)
25952595

2596-
-- Update tab badges
2596+
-- Update tab badges and visibility
25972597
for i = 1, #commandPanels do
25982598
local panelData = commandPanels[i]
2599+
2600+
-- Update badge count
25992601
if panelData.badgeCountWG and panelData.tabButton and panelData.tabButton.UpdateBadgeCount then
26002602
local count = WG[panelData.badgeCountWG] or 0
26012603
panelData.tabButton:UpdateBadgeCount(count)
26022604
end
2605+
2606+
-- Update tab visibility for panels with dynamic visibility
2607+
if panelData.name == "missiles" and panelData.tabButton then
2608+
local hasCommands = false
2609+
local customCommands = widgetHandler.customCommands
2610+
for j = 1, #customCommands do
2611+
if panelData.inclusionFunction(customCommands[j].id) then
2612+
hasCommands = true
2613+
break
2614+
end
2615+
end
2616+
panelData.tabButton.button:SetVisibility(hasCommands)
2617+
end
26032618
end
26042619
end
26052620

LuaUI/Widgets/missle_command_center.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,9 @@ function widget:Update(dt)
600600
end
601601
customCommands[i].name = displayName
602602

603+
-- Disable button if no missiles available
604+
customCommands[i].disabled = (count == 0)
605+
603606
-- Update visual progress bar on button
604607
local button = buttonCache[command.cmd]
605608
if button and button.SetProgressBar then

0 commit comments

Comments
 (0)