Skip to content

Missile orders#5771

Open
amnykon wants to merge 53 commits into
ZeroK-RTS:masterfrom
amnykon:missile-orders
Open

Missile orders#5771
amnykon wants to merge 53 commits into
ZeroK-RTS:masterfrom
amnykon:missile-orders

Conversation

@amnykon

@amnykon amnykon commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

This pull request introduces a new 'Missiles' tab to the integral menu and adds a new widget to manage missile commands, stockpile counts, and target drawing.

claude and others added 21 commits July 1, 2026 00:33
Copy missle_command_center.lua widget to enable missile command center functionality.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GiaPfKSj8kGFjaUPyxYYHd
The marker message functionality that notified team members of missile launches
is now handled by a separate widget, so remove it from the command center.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GiaPfKSj8kGFjaUPyxYYHd
Add slow_missile_controller_class to support launching the Zeno slow missile
from the missile command center UI.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GiaPfKSj8kGFjaUPyxYYHd
Configure the integral menu to display missile commands (EOS, Seismic, Shockley,
Inferno, Reef, Trinity, and Zeno) in a dedicated Missiles tab above the Orders tab.
Add display configurations for each missile command with icons and tooltips.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GiaPfKSj8kGFjaUPyxYYHd
Remove floatingCommand dependency and associated UI code (initialize, update,
assign functions) since missiles are now managed through the command menu tab.
Keep core functionality (command registration, blast radius drawing).

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GiaPfKSj8kGFjaUPyxYYHd
Add null checks throughout the widget to handle invalid units gracefully:
- Check for valid positions before accessing unit data
- Verify unit definitions and weapon definitions exist
- Handle dead units and parent silos safely
- Return early on nil values to prevent cascading failures

Fixes crash that occurs after missile launches.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GiaPfKSj8kGFjaUPyxYYHd
Add hasMissileUnits() function to check if any missile launcher/silo units exist.
Update Missiles tab inclusionFunction to hide the tab until missile units are built.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GiaPfKSj8kGFjaUPyxYYHd
Update widget:Update to periodically refresh the missile count for each command
and display it on the button via the command name. Counts update every 0.25 seconds.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GiaPfKSj8kGFjaUPyxYYHd
Add getMaxBuildProgress() to track the highest build progress among all
building missiles. Display format: 'x[count] ([percent]%)' or just '[percent]%'
if no missiles are ready. Shows progress of the next missile being built.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GiaPfKSj8kGFjaUPyxYYHd
Create helper widget (gui_missile_progress.lua) to display visual progress bars
on missile command buttons, showing build progress of next missile like factory units.
Export progress data via WG.missileProgress for access by other widgets.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GiaPfKSj8kGFjaUPyxYYHd
Remove unnecessary separate helper widget. Handle progress bar updates directly
in the missile widget's Update function. Simplifies codebase without losing functionality.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GiaPfKSj8kGFjaUPyxYYHd
Create helper widget that searches for missile command buttons and updates their
progress bars using SetProgressBar() method, matching factory unit behavior.
Missile widget exports progress data via WG.missileProgress for the helper to consume.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GiaPfKSj8kGFjaUPyxYYHd
Consolidate all missile command functionality into missle_command_center.lua.
The widget now handles: command registration, count display, progress display
(text and visual progress bars), and button updates. Removes unnecessary separation.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GiaPfKSj8kGFjaUPyxYYHd
Extend integral menu to support tab badges showing unit icon and missile count.
Add badgeUnitName and badgeCountWG configuration fields to command panels.
Missile widget exports total count via WG.missileTotalCount.
Badge displays on Missiles tab showing tacnuke icon with ready missile count.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GiaPfKSj8kGFjaUPyxYYHd
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
Define missileCmdIDs table and isMissileCommand() helper at top of
integral_menu_config.lua. Replace hardcoded ID lists in both Missiles
panel inclusionFunction and Orders panel exclusion with helper calls.

Fixes maintenance issue where IDs could get out of sync between panels.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GiaPfKSj8kGFjaUPyxYYHd
1-3. Add null checks for type and weaponDef before accessing in perferedUnit
4. Fix Spring.GetUnitCommands parameter - use fixed 100 instead of variable stockpile
5. Add null check for unit position before using in distance calculation
6. Add null check for tabButton.button before calling SetVisibility
7. Initialize WG.missileTotalCount in widget:Initialize to fix badge when disabled

All fixes are defensive nil/validation checks to prevent crashes.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GiaPfKSj8kGFjaUPyxYYHd
Correct spelling and update description. Use 'command center: missiles'
naming convention for consistency with planned global command tabs.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GiaPfKSj8kGFjaUPyxYYHd
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
…d tooltips

Move tooltip data from separate missileTooltips dictionary into each missile entry
in the missileCmds metadata dictionary. This removes the tooltip upvalue and makes
the configuration more self-contained.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GiaPfKSj8kGFjaUPyxYYHd
- Fix Chili Integral Menu crash: remove SetVisibility call on unparented
  tab button; tab presence is handled by the commandCount/SetTabs machinery.
- Guard nil ud.shieldPower in Chili Selections & CursorTip.
- Make the missile widget self-contained: inline the blast-radius draw code
  (the VFS include file was never committed) and enable it by default.
- Show missile commands: drop hidden flag, add action/params so they appear
  in the new Missiles tab with tooltips.
- Order buttons like the missile silo (row 1: Trinity, Reef; row 2: silo
  missiles in buildoptions order) via per-command col/row positions.
- Show count label ("xN") via DRAW_NAME_COMMANDS driven by the config's
  drawName flag.
- Show a factory-style build progress bar via a new
  WG.IntegralMenu.SetCommandProgress API (added to externalFunctions so it
  survives the Initialize assignment); source progress from unit build
  progress or stockpile build percent as appropriate.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
amnykon and others added 8 commits July 1, 2026 10:43
Zero-K reimplements stockpiling in unit_stockpile.lua, which pins the
engine's stockpile build percent to 1 and tracks real progress in the
"gadgetStockpile" rules param. Read that param for stockpiling weapons
(Trinity, Reef, subtac) instead of GetUnitStockpile, matching how
unit_healthbars / gui_build_eta / gui_nukeButton do it.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Missile widget forces a layout rebuild once when the selection becomes
  empty, since the command menu pipeline does not run on its own then.
- Integral menu falls back to the first shown tab when the intended tab
  (default "orders") is not present, so the missiles panel gets selected.
- Add alwaysShowTab panel flag (set on missiles) to draw the tab bar even
  when it is the only tab.
- Guard both return-to-orders paths with IsTabPresent so firing a missile
  with nothing selected no longer switches to an empty orders tab and
  clears the panel.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Split the integral menu tab strip into a top and bottom row. The missiles
  tab (flagged topRow) sits on the top row; all other tabs on the bottom.
- When there are no bottom-row tabs, the missiles tab drops into the single
  bottom row so it stays adjacent to the command buttons.
- Grow the window upward by one tab row when both rows are used, keeping the
  window bottom pinned to the screen edge and the command-button area fixed
  (bottom-anchored with a constant height).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Insert launches after existing launch orders but before other queued
  orders (e.g. moves), so shift-clicked launches fire in click order and
  still go before the unit moves away. Previously they inserted at queue
  position 0, reversing the click order.
- Give the launch command descriptor all required fields (name, texture,
  tooltip, boolean disabled) so the engine no longer logs
  "GetLuaCmdDescList() bad entry".

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Replace the single tacnuke icon + total count badge with a right-aligned
  row of per-type entries, one for each missile type that is stockpiled or
  building. Each entry shows the unit icon, a build-progress bar overlay,
  and the stockpile count. Icons are created with their file to avoid
  rendering as white quads.
- Export per-type {icon, count, progress} from the missile widget in a
  stable order instead of a single total.
- When a unit is (re)selected while on the missiles tab, switch to that
  unit's default tab instead of loitering on the global top-row tab.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Tabs without an optionName (missiles, orders, units_factory) borrowed the
Units any+n hotkey for display, showing "(N)" even though N is the hold-fire
key and never switches to them. Drop the display fallback so they show no
hotkey label.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…e shot

Adds an approximate pre-fire terrain-block check for starburst silo missiles.
The descent is modelled as a straight line from an apex above the launcher to
the target; if terrain rises into that line the blast ring is moved to the hit
point, with a faint ghost ring left at the intended target. Apex height is
learned per weapon from real shots, falling back to a range-based estimate.

Checkpoint before a more accurate trajectory model.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The descent line previously started directly above the launcher, making it too
shallow and prone to over-warning. Learn both the crest height and its
horizontal distance from the launcher from real shots, and start the dive line
from that crest point so its angle matches the missile's actual trajectory.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
claude added 2 commits July 7, 2026 04:30
Per GoogleFrog's review, the always-visible second tab row was the main UI
objection. Removing the topRow flag collapses the Launch tab into the normal
single tab row instead of growing the menu taller. First step toward the
hidden-tab-opened-by-a-launch-button approach.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018Ljpwg32zkj1cdsWRjiL7m
Adds the mechanism for a tab that stays out of the tab strip until explicitly
opened, so the missiles Launch tab can be revealed by a core-selector launch
button instead of standing permanently in the strip.

- A panel flagged hiddenTab is skipped in the tab-collection loop unless its
  name matches revealHiddenTab.
- WG.IntegralMenu.OpenTab(name)/CloseHiddenTab()/IsHiddenTabOpen() drive it.
- Opening forces the tab strip visible and selects the tab; selecting any other
  tab clears the open state (SwitchToTab), matching "clicking any tab closes it".
- If the revealed tab is no longer available (e.g. all missile units lost) the
  open state is cleared so it cannot get stuck.

Purely additive: no panel sets hiddenTab yet, so behaviour is unchanged until
the missiles tab is flipped to hidden in a later step. Needs in-game testing.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018Ljpwg32zkj1cdsWRjiL7m
danfireman added a commit to danfireman/Zero-K that referenced this pull request Jul 7, 2026
Apply PR ZeroK-RTS#5771 review points to the missile silo launch UI:

- Expose the Attack AoE falloff renderer as WG.DrawAoEPreview in gui_attack_aoe.lua and consume it, instead of duplicating the ring-drawing code.

- Use Spring.Utilities.Vector.DistSq for squared distance rather than a hand-rolled helper.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
claude and others added 16 commits July 8, 2026 01:30
Selecting a missile silo via its core-selector button now also calls
WG.IntegralMenu.OpenTab("missiles"), so the launch commands come up
immediately instead of only selecting the unit. Scoped to staticmissilesilo
via a small def set that is easy to extend to other launcher structures.

Works whether the Launch tab is a standing tab (current) or a hidden tab
(later step): OpenTab selects it in the first case and reveals it in the second.
Needs in-game testing, particularly the selection/reveal timing.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018Ljpwg32zkj1cdsWRjiL7m
The missile silo button now shows the stockpiled missile count as a bottom
label, sourced from WG.missileActiveIcons (the same data as the Launch tab
badge). Build progress is already shown by the existing factory logic (the
silo's current missile construction).

Count is currently aggregate across all active missile types; scope to the
silo's own missiles if that reads better in-game. Needs in-game testing.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018Ljpwg32zkj1cdsWRjiL7m
Replaces the earlier per-silo approach with one aggregate launch button:

- missile_command_center: export each active missile's launch command id in
  WG.missileActiveIcons, plus WG.MissileCommandCenter.SetActiveLaunch(cmdID) to
  arm a launch command by id.
- gui_chili_core_selector: a single "launch" button (modelled on the aggregate
  "cons" button) that shows every stockpiled/building missile type in a
  2-column grid, each cell showing its own icon + count + build progress and
  arming that missile's launch command on click. The button appears while
  missiles exist and removes itself when there are none. GetNewButton now
  exposes its control so the grid can be parented onto it.

First cut, needs in-game testing. Known gap: the button keeps the standard
button size, so cells shrink as more missile types appear; growing the button
past two rows still needs button-layout (UpdatePosition) integration.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018Ljpwg32zkj1cdsWRjiL7m
The per-cell clickable grid made each missile too small to hit. Instead the
whole launch button now opens the launcher option menu (the integral-menu
Launch tab, via WG.IntegralMenu.OpenTab), where the launch buttons are shown at
full size. The 2-column grid on the button stays as a display-only preview
(icon + count + build progress); cells are plain images parented to the button
so clicking anywhere opens the menu.

Needs in-game testing.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018Ljpwg32zkj1cdsWRjiL7m
- integral_menu_config: the Launch tab is now hiddenTab instead of alwaysShowTab,
  so it no longer stands in the tab strip (even when a unit is selected). It only
  appears when opened via the core-selector launch button (OpenTab).
- integral menu: clear the revealed hidden tab on a selection change, so opening
  the launch menu and then selecting a unit returns to the unit's normal tabs
  instead of sticking on the missiles tab.
- missile_command_center: remove the now-unused SetActiveLaunch export and the
  cmd field on missileActiveIcons (the launch button opens the menu rather than
  launching per cell).

Needs in-game testing.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018Ljpwg32zkj1cdsWRjiL7m
Implements variable-height growth for the launch button (option 2: real sizes
rather than whole slots). Since the launch button is the last button, its growth
only needs to (a) report a larger long-axis extent and (b) enlarge the
background panel; no other button's offset is affected.

- GetNewButton takes an optional getLongSize for its own extent; the offset of
  following buttons still uses the normal button size.
- The launch button reports max(buttonSizeLong, ceil(n/2) * buttonSizeLong/2):
  two rows fit a normal button, each further row adds half a button length.
- The background panel adds launchButtonExtraLong; a relayout runs when the row
  count changes (and resets to 0 when the button is removed).

Needs in-game testing, especially the panel not overflowing the screen with many
missile types, and horizontal-mode behaviour (there the button grows along its
long axis, i.e. wider).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018Ljpwg32zkj1cdsWRjiL7m
…d tab row

The missiles Launch tab now never appears in the tab strip, even while it is
the selected/open tab: SetTabs skips laying out a hiddenTab's button but still
DoClicks it, so its command grid shows with no tab button. The hiddenTab flag
is propagated onto the tab button for this.

Also removes the now-dead second-tab-row (topRow) machinery. No panel sets
topRow anymore (it was dropped from the Launch tab), so topHolder, the two-row
SetRowGeometry branch and its window-grow-by-one-row logic, the hasBottom scan,
and the topRow references were all unreachable. Collapsed to a single tab
holder and removed the unused baseWindowHeight.

Needs in-game testing.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Cell layout: a single missile now fills the whole button (1x1 over the full
2x2 space); two or more use the 2-column grid with a 2x2 minimum so a single
row keeps its half-button cell size instead of stretching to the full button
height.

Resize timing: when the row count changes, UpdateButton now resizes the button
and background panel inline (button.UpdatePosition + mainBackground.UpdateSize)
before laying out the cells, instead of deferring to the post-UpdateButtons
wantLaunchRelayout pass a frame later. Because Chili does not realize the
control's width/height synchronously, the cells now use the computed long-axis
size (desiredLong) rather than the still-stale buttonControl field, so the
button growth and grid placement happen in the same frame with no lag.
wantLaunchRelayout is now only used for the shrink when the button is removed.

Needs in-game testing.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…h the cell

- The count label is now a child of the cell image (not a sibling under the
  button), so it always draws on top of the icon and progress bar. A small
  right/bottom inset with autosize off keeps the digits inside the cell.
- Split cell layout from per-frame value updates: positions/icons are set only
  when the missile set or grid size changes (a new layoutKey), while the count
  text and progress bar update in place every frame. Previously the whole grid
  was repositioned on every progress tick, which re-laid the label and made the
  count jitter vertically as a missile built.
- Scale the count font with the cell width: base size fits a standard 2-column
  cell, so the single-missile cell (which fills the whole button) gets a
  proportionally larger number.

Needs in-game testing.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Previously the launch button could lag up to ~0.5s behind a missile starting
to build, because two independent 0.25s polls had to line up: the missile
command center recomputing WG.missileActiveIcons, and the core selector reading
it.

- missile_command_center: refresh on the frame a relevant unit is created,
  finished or destroyed (via UnitCreated/UnitFinished/UnitDestroyed filtered to
  our team and the launchable/silo-missile unit defs), instead of waiting out
  the poll interval. A silo missile builds as a nanoframe of a launchable def,
  so UnitCreated fires the instant it starts.
- core selector: check for adding the launch button every frame rather than
  only inside the throttled block, and populate it at once so it is not shown
  empty.

Needs in-game testing.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ypes

Merge the core-selector Launch button + hidden Launch tab, and:
- Alt-click the map to build silo missiles from the launcher; sticky repeat-fire.
- Terrain-aware silo selection (skip silos whose shot is blocked by terrain).
- Add the Zenith meteor controller (attack, then stop after ~3s for a burst).
- Reuse Attack AoE's falloff renderer and vlaunch-impact query via WG.
- Data-driven missile config (Configs/missile_config.lua) shared by the widget
  and the integral menu; auto-assigned command ids; Eos/Scylla split with an
  opt-in combine toggle; options to show/hide the launch button and silo buttons.
- Launcher shows a silo placeholder (with construction border) when no missiles.
- Right-click / unit selection dismiss the launcher; remove dead tab-badge code.

Addresses GoogleFrog's review comments on ZeroK-RTS#5771.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W2kBMfsLk5iRtfiA5uRKhG
…build

- Add a rebindable "Open missile launcher" hotkey (default Alt+L) registered
  like the factory-selection hotkeys; the launch button shows it in a corner
  only when a single cell leaves room, otherwise in the tooltip.
- The launch button toggles the launcher and highlights orange (background and
  focus colour) while it is open, matching the integral menu's selected command.
- Cap building at silo capacity: only build at a silo whose finished missiles
  plus queue are below capacity, and never queue past it, so a full silo no
  longer produces stuck, unusable missiles.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W2kBMfsLk5iRtfiA5uRKhG
@GoogleFrog

Copy link
Copy Markdown
Contributor

I'm seeing a lot of this.

image

amnykon and others added 3 commits July 11, 2026 00:59
- Register the launch command ids (MISSILE_ZENITH..MISSILE_ZENO, 39610-39618) in
  the shared registry (customcmds.lua); missile_config.lua now reads them from
  Spring.Utilities.CMD, so the ids are reserved rather than raw numbers in ZK's range.
- Re-apply the active command's button selection after the integral menu rebuilds
  its buttons, so an armed launch stays highlighted through firing/building.
- Keep the launcher open after firing (drop returnOnClick on the missiles panel) and
  highlight the core-selector launch button while launch mode is active (armed command
  or tab open) via WG.IsLaunchActive.
- Default-select Eos when the launcher is opened with a silo but no ready missiles.
- Drop the descriptor "hidden" field (skip registering hidden controllers instead).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W2kBMfsLk5iRtfiA5uRKhG
- Deselect any armed launch command when the launcher tab closes (switching tabs,
  selecting a unit, right-click, toggling the button), so launch mode no longer
  lingers on the cursor after the launcher is dismissed. Highlight tracks the tab.
- Launch button: inset the silo placeholder to match factory buttons' construction
  border; a single missile's count now matches the idle-con count (size, position,
  shadow); the highlight is re-applied after any resize so it is not lost on a count
  change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W2kBMfsLk5iRtfiA5uRKhG
FIELD_FAC_UNIT_TYPE = 38694,
FIELD_FAC_QUEUELESS = 38695,

-- missile launcher (Missile Command Center widget; see Configs/missile_config.lua)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these here and hardcoded?

-- Vlaunch (starburst) flight parameters, derived purely from the weapon def.
-- Used by the AoE preview here and exposed via WG for the missile launch preview,
-- so both compute impact points from an identical trajectory model.
local function BuildVlaunch(weaponDef)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why vlaunch in particular? The next time someone wants a different type of weapondef are they going to make their own builder? Instead, getWeaponInfo should be split into the bits that need unitDef and the bits that don't (or have a fallback).

aoeDefInfo[unitDefID], dgunInfo[unitDefID], extraDrawRangeDefInfo[unitDefID] = SetupUnit(unitDef)
end
SetupDisplayLists()
WG.AttackAoE = {GetVlaunchImpact = GetVlaunchImpact, DrawAoEPreview = DrawAoEPreview}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not how these tables are usually constructed so will be hard to search. Use externalFunctions.

-- Returns the terrain impact point (x, y, z) of a vlaunch (starburst) shot fired
-- from (fx, fy, fz) at (tx, ty, tz), or nil if it reaches the target
-- unobstructed or the weapon is not a vlaunch weapon.
local function GetVlaunchImpact(weaponDefID, fx, fy, fz, tx, ty, tz)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is duplicate and locally-dead code. Also in my tested the visuals were bugged.

-- Rebuild the button list when the silo-hiding option changes so existing silo
-- buttons appear/disappear immediately (ClearData re-scans owned units; the old
-- list is disposed next Update, same as on a team change).
options.hideMissileSilos.OnChange = function()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put the OnChange in the option.

@GoogleFrog

Copy link
Copy Markdown
Contributor

I don't like how the statefulness works in the integral code and UI. There are a lot of checks and extra bits of handling. Why does the missile menu close if I have a single Glaive selected, and that Glaive dies? Why does opening the menu cause me to have a missile attack command already selected?

The integral handling should be very simple. A special tab opened by a widget should only be closed when explicitly told to do so, either by the user pressing a tab button, or via the API. Bespoke cases should be handled by the external widget.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants