Features
Tile injection
Mutate tile state after the board is built — terrain swaps, depth lifts, connectivity rewires.
Note:
Screenshot embedding lands once the F-Gallery test harness flips on with the RB browser-CI gate.
Problem
A river runs through your board. At runtime a quest objective dams the river upstream; downstream tiles need to switch from water to mud for the next 50 simulation ticks, then revert.
Snippet
import { gameboardCommandActions } from 'declarative-hex-worlds/commands';
import { HexTileState } from 'declarative-hex-worlds/traits';
const swap = world.actions(gameboardCommandActions).plan({
kind: 'inject-tile',
tileKey: '4,2',
patch: { terrain: 'mud' },
});
world.actions(gameboardCommandActions).execute(swap);
// Later, revert.
world.actions(gameboardCommandActions).execute({
...swap,
patch: { terrain: 'water' },
});What the library handles
- Trait mutation under koota's transaction model. Tile state changes are observable by queries.
- Re-validation. Connectivity rules re-run; downstream placements that depended on
waterneighbors may flag warnings. - Snapshot stability. Post-mutation
runtime.snapshot()reflects the new state; deterministic replay from the same script reproduces the same sequence.
