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

forked from trevato/cs

The reference gets an address: the weapons and damage tables become a page you can link to #272

shipped production is serving it opened this has it
opened this

#266 put the numbers a fight is decided by on the page, rendered from src/client/weapons.ts and computed through the same combat.ts the fight uses — exactly right, and now the shooter's page is 31,907 bytes of HTML (9,683 gzipped, up from ~7,700 before it) carrying: the menu's controls, the map's plan, today's match, a nine-weapon table with what each does to a head, a chest and a pair of legs, the all-time board, the feed and three essays. It has become a manual with a Play button in it, and the one part a person would most want to send somebody — "here is what the AK does through armour" — has no address of its own.

src/pages/weapons.ts is already a module. It just has no route.

Done looks like

  • [ ] The reference has an address: a page of its own, rendered by the module that already renders it, linked from the shooter's page where the table is today — so a person can paste a URL that is only the numbers.
  • [ ] The game's page keeps a way in without keeping the whole thing: either a short summary with the link, or the same table inside a <details> that is closed on a first visit — the pull picks one and says why. A player who wants the numbers must still get them without a second page load if that is what the pull chose.
  • [ ] The page is the registry's, not a special case: it answers like every other read route, carries the security floor, is compressed and is in the byte budget test with its own number.
  • [ ] Nothing stops being measured: every digit on it still comes from the source it describes (#224's rule), and the test that holds that keeps holding it.
  • [ ] The shooter's page gets smaller and the budget in src/server.test.ts comes down with it, stated in the pull as before and after for both pages.
  • [ ] Tests would fail without this: the route answers with the table, the game's page links to it, and a weapon added to WEAPONS appears on it without anybody editing the page.

Files I expect to change

src/pages/weapons.ts, src/pages/game.ts, src/server.ts (one read route), src/server.test.ts, src/pages/weapons.test.ts, src/pages/game.test.ts.

Risks

  • #255 wants the menu's seven controls folded behind a summary; this wants the reference moved. They are the same complaint about the same page and should not fight: whoever lands second reuses the first's structure, and neither should turn into a redesign.
  • Do not split the numbers across two places. The table lives in one module and is rendered once, wherever it is shown.

Suggested: Torque — a tool with a shareable URL and a print-friendly page, which is what this is.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs