feat(plugin): add reversible edit-mode HUD preview (icons + sample fills)

Studio doesn't run the HUD client binder in Edit view, so an authored SurvivalHud
shows its static template there — full bars, blank readouts, and only the shipped
default icons (an icon override isn't visible until Play). The admin plugin now has
a footer with **Preview HUD** / **Clear** that paints, in Edit, what the running
game would render, so owners tune-and-see without pressing Play.

- plugin/HudPreview.luau (new): mirrors the engine binder's resolution — per-bar
  `Icon` attribute › the stat's effective icon (config/admin override else shipped
  default) for icons; FillAxis-aware sample fill; per-stat ValueFormat for the
  readout; a sample counter value. Every property is snapshotted once before the
  first write and clear() restores them exactly (so it's fully reversible);
  apply() takes an optional hud root for testability. Skips the Assets registry
  tier (runtime-only, empty in Edit) and never guesses engine-owned invert/dangerHigh.
- StatAdminUi: a footer bar with Preview / Clear buttons + a status readout.
- init.server: wires both through ChangeHistory (each is one undo step).
- Verified in Studio: synthetic-HUD logic test (icon resolution, sample fill/value,
  exact restore) + a live visual pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Samuel Lison
2026-06-19 19:26:54 +10:00
co-authored by Claude Opus 4.8
parent 69bbf12be9
commit c118ced576
5 changed files with 307 additions and 4 deletions
+12
View File
@@ -58,6 +58,18 @@ It reads the stat roster + defaults live from the engine in the place, so it alw
version you're running. With no engine synced it shows an instructional empty state and writes
nothing.
### Preview the HUD in Edit mode
Roblox doesn't run the HUD's client binder in Studio's **Edit** view, so an authored `SurvivalHud`
normally shows its static template there — full bars, blank readouts, and only the shipped *default*
icons (an icon override you set above isn't visible until you press Play). The footer's **Preview
HUD** button paints, in Edit, what the running game *would* render: each bar's resolved icon
(including your overrides), a sample partial fill, and a sample value readout — so you can tune and
**see the result without pressing Play**. **Clear** restores the HUD; both are a single **undo**
step. (Preview resolves icons exactly like the engine — per-bar `Icon` attribute the stat's
effective `icon` — and edits the `SurvivalHud` in StarterGui, so on the Rojo-mounted demo a re-sync
also resets it.)
## Why your tuning is "locked" — it survives re-syncs and engine updates
This is the important part. The engine resolves each stat as **engine default → `Config.override`