Public: anyone can read this; the crew can change it.
forked from trevato/cs
The shooter's entry sheds its first concept: the buy panel becomes its own module #257
Check · Review · Land · Live done — Landed and live in production.
The buy panel is out of `src/client/main.ts` and in `src/client/buy.ts`: the shelf a side is shown (its guns, the armour, the kit only a CT can carry), the price `economy.ts` gives for the body in front of you, which tiles the wallet and the round leave pressable, and the markup it is all drawn as. It takes the element to draw into, the round, the player, a call that makes a `<button>` and a call…
shipped production is serving it deploy ae07c2d
The buy panel is out of src/client/main.ts and in src/client/buy.ts: the shelf a side is shown (its guns, the armour, the kit only a CT can carry), the price economy.ts gives for the body in front of you, which tiles the wallet and the round leave pressable, and the markup it is all drawn as. It takes the element to draw into, the round, the player, a call that makes a <button> and a call that says which item was pressed — no document, no host, no world, and it buys nothing itself. What stayed in the entry is eight lines of wiring: the element found by id, the factory, and the press that spends the money on the world the frame is simulating, with the world read at the press rather than captured, exactly as before.
This is a move, not a rewrite: the same offers in the same order, the same prices, the same price > money || !canBuy rule, the same open/close keys, the same beep, and the same markup to the character. src/client/buy.test.ts pins the rendered panel for a real createWorld in its freeze time — the exact innerHTML and every tile's label and disabled flag — plus the shelf per side, the carried-kit prices, the to-the-dollar wallet edge, a live round, and that a press hands the item back and spends nothing. main.test.ts keeps only the wiring (B opens it, the pointer is let go, the first tile takes the focus, a press costs money and beeps and redraws). src/pages/game.ts is untouched: the panel's shell is rebuilt on every open so the prices are current, so there is nothing for the server to render into <div id="buy">.
main has been merged in. #165's smoke needed no line in buy.ts — the shelf is buyable(team), so the new row in the weapon table arrived on the panel by itself, which is the seam working; the test moved to that truth (eleven tiles for a CT) and now names tiles by label rather than index so the next weapon does not move a test about the armour. The one conflict was src/games.ts, where both sides appended to the size log: both paragraphs are kept, #165's raised ceiling of 103,000 / 41,000 stands, and #250's measurement is redone on top of it — 98,665 → 98,864 raw and 38,895 → 38,966 gzipped (+199 / +71, the seam itself), leaving 4,136 raw and 2,034 gzipped to spare. The other two bundles are unchanged to the byte. bun run test is green: 1,136 pass, 0 fail.
Two things found and deliberately left wrong: a player already wearing a vest sees Kevlar · $0 on an enabled tile that economy.buy then refuses, which is today's behaviour and is noted in the test where it is asserted; and bun test src/client/ on its own fails four world.test.ts cases because nothing in that subset has called usePolicy — pre-existing on main too, and the full suite the check runs is unaffected.
🤖 Generated with Claude Code
The buy panel is out of
src/client/main.tsand insrc/client/buy.ts: the shelf a side is shown (its guns, the armour, the kit only a CT can carry), the priceeconomy.tsgives for the body in front of you, which tiles the wallet and the round leave pressable, and the markup it is all drawn as. It takes the element to draw into, the round, the player, a call that makes a<button>and a call that says which item was pressed — no document, no host, no world, and it buys nothing itself. What stayed in the entry is eight lines of wiring: the element found by id, the factory, and the press that spends the money on the world the frame is simulating, with the world read at the press rather than captured, exactly as before.This is a move, not a rewrite: the same offers in the same order, the same prices, the same
price > money || !canBuyrule, the same open/close keys, the same beep, and the same markup to the character.src/client/buy.test.tspins the rendered panel for a realcreateWorldin its freeze time — the exactinnerHTMLand all ten tile labels and disabled flags — plus the shelf per side, the carried-kit prices, the to-the-dollar wallet edge, a live round, and that a press hands the item back and spends nothing.main.test.tskeeps only the wiring (B opens it, the pointer is let go, the first tile takes the focus, a press costs money and beeps and redraws) and says in its header where the content went.src/pages/game.tsis untouched: the panel's shell is rebuilt on every open so the prices are current, so there is nothing for the server to render into<div id="buy">.Bytes: app bundle 95,598 → 95,799 raw and 37,788 → 37,843 gzipped (+201 / +55, the seam itself — a module boundary the minifier will not inline across, the object the frame lends the panel, and the hint and shelf now named rather than inline). The ceiling in
src/games.tsdid not move; it has 2,201 raw and 1,157 gzipped to spare, and the measurement is logged there in the house style. The other two bundles are unchanged to the byte.bun run testis green: 1,130 pass, 0 fail.Two things found and deliberately left wrong: a player already wearing a vest sees
Kevlar · $0on an enabled tile thateconomy.buythen refuses, which is today's behaviour and is noted in the test where it is asserted; andbun test src/client/on its own fails fourworld.test.tscases because nothing in that subset has calledusePolicy— pre-existing on this branch's parent too, and the full suite the check runs is unaffected.🤖 Generated with Claude Code
Closes #250