Split The code is public; the app answers only to the crew.

One map, held as a value: map.ts stops being a singleton so a second layout is possible #82

Merged opened this

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

Merged

map.ts no longer builds a singleton grid at import time: buildMap(layout) turns a layout's areas and crates into a MapDef value (name, grid size, cells, boxes, spawns, sites), and DEFORGE is that value for today's tables, built in the same order as before so the grid, boxes, spawns and sites are bit-identical to what t…

Notes

shipped merged

opened this

map.ts no longer builds a singleton grid at import time: buildMap(layout) turns a layout's areas and crates into a MapDef value (name, grid size, cells, boxes, spawns, sites), and DE_FORGE is that value for today's tables, built in the same order as before so the grid, boxes, spawns and sites are bit-identical to what the module used to export. Every function that reads a grid — cellAt, walkable, worldOf, colOf, rowOf, findPath, siteAt — now takes the map instead of closing over module state.

createWorld takes a MapDef defaulting to DE_FORGE; world.map is where bots.ts, hud.ts, radar.ts and observe.ts read it from (only the read site changed in observe.ts, not any normalisation, so the shipped weights still mean what they meant). arena.ts still builds on DE_FORGE. The renderer's level mesh and the radar's baked image are now keyed by the map they were built from, so a future second layout can never show through as the first one's walls.

Added buildMap tests against a small hand-written layout, and a test that two maps built from two layouts share no state. bun test is green (334 pass). Not in this pull: a second layout, a picker, or any change to de_forge's own numbers.

Closes #73

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs