diff options
Diffstat (limited to 'CLAUDE.md')
| -rw-r--r-- | CLAUDE.md | 36 |
1 files changed, 29 insertions, 7 deletions
@@ -37,7 +37,10 @@ refuses a plain re-setup), `make shell` (interactive container), `make clean`, layers don't rebuild) unless it must come earlier. **Verify without a display:** you can't run the GUI in the container, so validate -by (a) compiling clean and (b) parsing the Lua data. `make check` does both. +by (a) compiling clean, (b) parsing the Lua data and (c) settling every map in +the headless soak test (`tools/sim_check.cpp` — the solver needs no display, so +it catches "the fort collapses on load"). `make check` does all three; +`make sim-check SOAK=20` for a longer settle. Note mods must be validated **layered** (base file first) because they `table.insert` into globals the base defines — `make check-lua` already does this; running a mod file standalone always fails. @@ -114,14 +117,30 @@ the ImGui Dev panel** — use it; the constants were tuned by eye, not proven. Game content is **Lua data**, loaded at startup. This is the seam mods hook into. -Base files in `data/`: `materials.lua`, `weapons.lua`, `devices.lua`, -`structures.lua`, `map.lua`. Each defines a global table (`Materials`, `Weapons`, -`DeviceDefs`, `Structures`, `Deposits`/`MapDevices`) plus `Find*`/`IndexOf*` helpers. +Base files in `data/`: `materials.lua`, `weapons.lua`, `devices.lua`, `maps.lua`. +Each defines a global table (`Materials`, `Weapons`, `DeviceDefs`, `Maps`) plus +`Find*`/`IndexOf*` helpers. + +**Maps** (`data/maps.lua`) are the selectable scenarios: each entry bundles +`ground_level`, `deposits`, `devices`, the player's starting `weapons`, and the +prebuilt `structures` (lists of `{x1,y1,x2,y2,material}` beams). `Maps[1]` is the +default; the Dev panel's **Map** section switches between them at runtime, which +tears the graph down and rebuilds it via `build_map()`. Beams must be within the +material's `max_length` (they are welded raw, **not** auto-subdivided) and must +be triangulated, or the fort hinges apart on the 30° angle rule. + +> **Gotcha:** clearing `graph.nodes`/`graph.edges` does **not** clear the private +> `adj_`/`edge_set_` caches. Call `graph.rebuild()` straight after clearing, or +> the stale edge keys make `add_edge` reject the next map's beams as duplicates +> and the fort silently loads half-built. `build_map` warns on every rejected +> beam; `make sim-check` catches the collapse. **Layered loader** (`data.cpp::run_layered`): base file runs first, then every `data/mods/<name>/<file>.lua` runs on top in **(priority, name)** order, mutating or extending the global tables — exactly like Forts. A mod's `mod.lua` sets -`Priority`. Example: `data/mods/enemy-fort/` adds the target fort + enemy reactor. +`Priority`. Example: `data/mods/enemy-fort/maps.lua` uses `FindMap()` to bolt +extra armour plating onto the Proving Ground enemy fort — the worked example of +a mod mutating base data rather than replacing it. To add content, prefer **editing Lua data** over hard-coding C++. When you must add a field, add it to the `*Def` struct, read it in `data.cpp` (`get_or` with a @@ -168,8 +187,11 @@ See `requirements/milestones.org` for the live checklist. Roughly: device framework + placement. Two gaps: fire does **not** damage devices, and devices are not mounted on the strut graph, so the "cut its supports and the reactor falls" victory path does not exist. -- **M6 partial:** enemy fort (`data/mods/enemy-fort/`) + deposits both sides; - terrain is still a flat half-plane and there is no sky backdrop. +- **M6 partial:** three selectable scenarios in `data/maps.lua` (Proving Ground, + Iron Bastion, The Narrows), each with its own forts, deposits, player starter + structure and weapon spawns, switchable from the Dev panel. Terrain is still a + flat half-plane — maps can move the ground up and down but not change its + shape — and there is no sky backdrop. - **Not started / later:** repair & recycle (M7), armour/door/shield materials, tech tree + upgrades, commanders, real map/terrain, AI, netcode. |
