Public: anyone can read this; the crew can change it.
forked from trevato/cs
Buying never takes the mouse off the game: number keys in the buy menu, and a rebuy #274
Check · Review · Land · Live done — Landed and live in production.
The buy panel now opens with the pointer still locked and is driven from the keyboard: every tile is printed with the key that presses it — the number row, `1`–`9` then `0` and `-`, left to right, because a CT's shelf is eleven tiles and a tile with no key on it is one you need the mouse for — and `X` buys last round's loadout again, in the order it was bought, as far as the money goes. `src/clien…
shipped production is serving it deploy ae07c2d
Sign in to join this conversation.
new above
offline
The buy panel now opens with the pointer still locked and is driven from the keyboard: every tile is printed with the key that presses it — the number row,
1–9then0and-, left to right, because a CT's shelf is eleven tiles and a tile with no key on it is one you need the mouse for — andXbuys last round's loadout again, in the order it was bought, as far as the money goes.src/client/loadout.tsis the new module behind that: it remembers a round's purchases, rolls them over on the round, steps over a gun you survived with and stops at the first thing the wallet cannot reach, saying what it bought or what it could not afford in one line — shown in the HUD's message line and in the panel's live region. Every purchase still goes througheconomy.buyand still only whencanBuysays so.Look at
src/client/main.ts:openBuyno longer callsexitPointerLockorrequestPointerLock, the focus lands on the shelf rather than on a tile (a focused tile is a tile Space presses, and Space is jump), and the frame now suppressesswitchToas well asfirewhile the panel is up, so the number row cannot also reach for a gun. Movement is still live — walking out of spawn while you buy is the point.src/pages/game.tsrenders the panel's frame:#buyshelf, whichbuy.tsdraws into and which is a named group that takes the focus, and#buysays, a server-rendered live region outside everything a redraw replaces, so a screen reader hears "Buy menu: $800 to spend…" and each purchase. The panel keeps its tiles as buttons — tab reaches them, 44px stands, and a thumb taps them exactly as before, including the new Rebuy control beside them.Two things I changed rather than added: the test that pinned "opening the buy menu drops the lock on purpose" now pins the opposite, and with the panel no longer dropping the lock, a lock lost while it is open is a real loss — the panel closes and the match pauses. One consequence worth knowing: with the lock kept there is no cursor over the panel on a desktop, so a mouse click on a tile is for a pointer that is not locked (a phone, or before the lock is granted); the keyboard is the way in while you are playing. I did not add a pause button for touch or change the shelf's order or prices. The app bundle went 334 bytes over its raw ceiling, so both halves moved to 110,000 / 43,500 against a measured 103,334 / 40,719 from
bun run scripts/build.ts.bun run testis green (1218 pass), and the digests did not move.🤖 Generated with Claude Code
Closes #153