Public: anyone can read this; the crew can change it.

forked from trevato/cs · proposes

The round's rules stop being one 553-line file: the economy and the bomb get their own modules, and the digest does not move #188

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

`src/client/world.ts` goes from 758 lines to 645: the money moves to `src/client/economy.ts` (`priceOf`, `canBuy`, `buy`, the `CARRY` pocket limits, and the `Ammo`/`emptyAmmo` a buy hands over and a new round hands back) and the objective moves to `src/client/bomb.ts` (the `Bomb` type, `giveBomb`, `dropBomb`, `updateBomb`, `useProgress`, the two ranges and the kit's effect). Neither new module imp…

shipped production is serving it deploy ae07c2d

opened this

src/client/world.ts goes from 758 lines to 645: the money moves to src/client/economy.ts (priceOf, canBuy, buy, the CARRY pocket limits, and the Ammo/emptyAmmo a buy hands over and a new round hands back) and the objective moves to src/client/bomb.ts (the Bomb type, giveBomb, dropBomb, updateBomb, useProgress, the two ranges and the kit's effect). Neither new module imports world.ts, so there is no cycle — each names the slice of the world it touches the way combat.ts names an Actor: a Buyer and a Market in one, a Carrier and a Round in the other, which a World and a Player satisfy structurally. The Bomb and Ammo types moved out of world.ts to make that true; Player stayed.

The seam worth reading is updateBomb: it writes the fuse, the site and the planter's money, then hands back a BombEvent instead of calling into the world, because saying a line to ten people and paying ten people for a round both need all ten — so say and finishRound stay in world.ts, in a four-line bombTick. What stayed behind and why is in the header of each file.

Not one behaviour changes and the digest proves it: ROUND, DUEL and all eighty per-second checkpoints in src/client/replay.test.ts are unchanged to the byte and green. bun test is 832 pass / 0 fail. The app bundle moves 80 raw / 132 gzipped bytes (90,429 → 90,509 and 40,801 → 40,933) — two module wrappers and different short names from the minifier — which fits the ceiling #164 set with 1,491 raw to spare, so no ceiling in src/games.ts moves; the log there records it. economy.test.ts and bomb.test.ts are new and mostly run on plain fixtures with no world at all (armour bought twice is not paid for twice, a buy refused once the round is live, a plant that needs the site and not just the bomb, a defuse interrupted and resumed from nothing, a kit that halves it); each was checked against a mutated rule to confirm it fails without the behaviour. The buy test moved out of world.test.ts; the two there that are the world's rather than the bomb's — a plant that moves the match clock, a defuse that wins the round and pays for it — stay where they are.

🤖 Generated with Claude Code

Closes #113

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs