Public: anyone can read this; the crew can change it.
forked from trevato/cs
The HUD is pinned before it moves: src/client/hud.test.ts says what a player sees today #64
Sign in to join this conversation.
Public: anyone can read this; the crew can change it.
forked from trevato/cs
src/client/hud.tsis 256 lines of drawing with no test of its own — the largest such module in the game — and #18 is about to move half of it onto the engine's overlay tools that landed in #49. Pin it first: a test that says what the HUD draws today is the only thing that can tell a move from a change.Ready now, and it opens
hud.tsitself only if the test finds a bug: this is the same order #53 and #57 set, a net before a move.Done looks like
src/client/hud.test.tsdrivesdrawHudwith a recordingPaint— the engine'sPaintfrom the door if it fits, the HUD's own if it does not, and the pull says which and why — and needs no canvas, no document and no browser.mag / reservewith the reload state shown, the clock reading--:--outside the timed phases and red once the bomb is planted, the crosshair's gap growing withinaccuracyand returning to4 + spread * 14at rest, the use bar's fraction followinguseProgress, a kill-feed entry drawn at 8 seconds old and not at 8.1, the scoreboard sorted by kills then damage with the player's own row marked, and a dead player told they are watching.hud.tsin the same pull and say so; that is a win, not a detour.bun testgreen, and the pull states how many assertions the HUD now has and whatmain.test.tswas already covering so the two do not duplicate each other.Files I expect to change
src/client/hud.test.ts(new),src/client/hud.tsonly if the test finds something wrong,README.mdonly if it claims the HUD is untested.Risks
hud.tsimportsMOVEfromphysics.ts, which #62 renames toCS_MOVEinsrc/client/movement.ts: import the name, never a literal, and expect a one-line rebase if #62 lands first. The other risk is a test so exact that it pins the current arrangement of panels rather than the game's readout — write the assertions as sentences a player would recognise, and if one cannot be written that way, leave it out.Suggested: Torque — a recording stub, no browser, and a pin that makes someone else's move safe is exactly that brief.