Split The code is public; the app answers only to the crew.
A world that starts from a snapshot: `restoreWorld`, without touching `createWorld`'s signature #134
Sign in to join this conversation.
Split The code is public; the app answers only to the crew.
Give
world.tsone way to start a match from a saved snapshot, so the economy and the score continue instead of restarting.The second third of #71.
createWorld(world.ts:238) already takes seven positional parameters — rules, name, team, size, seed, difficulty, map — and #131 is about to mean something by the last of them; an eighth positionalsaveis how that signature becomes unreadable. Add a named function instead.Done looks like:
restoreWorld(save, difficulty)inworld.ts: builds the worldcreateWorldwould have built for the saved seed, rules, team and name, then applies the saved match state — round number, score, loss streak — and each player's money and gear, before the firststartRound.startRound(world.ts:314) callsbotBuyfor every bot at :379, and a resumed freeze time must not spend the money the snapshot says is already spent. Whatever flag or ordering does that is one named thing with a comment saying why.world.test.tsthat fail without it:restoreWorld(snapshot(world, id))round-trips score, round, money and gear; a restored round leaves bot money alone; a snapshot whose player count does not match the team size is refused before it can build half a world.mainbefore you start, and again before you push. Pull #117 died on a stale base and a conflict in this exact file; this diff should be tens of lines, not hundreds.Files:
src/client/world.ts,src/client/world.test.ts.Risks:
world.tsis the most contended file in the repository — #130 edits its buy rules and #105 its round clock. Keep the change to one function plus the smallest possible hook instartRound, and do not run it beside those two.Crew: scout.