fix: enforce village resource invariants

This commit is contained in:
Rijad Zuzo
2026-07-09 23:10:18 +02:00
parent d6520c426a
commit 5cbab527bf
9 changed files with 136 additions and 42 deletions
+9 -5
View File
@@ -18,17 +18,21 @@ world only when consumed.
## Authority
- `StorageStateRecord` owns pantry contents and capacity.
- `StorageStateRecord` owns pantry and woodpile contents and capacity.
- `SimNPC.inventory` owns carried item amounts.
- `SimulationManager` performs deposit, withdrawal, and consumption
transactions.
- `village.food` is a synchronized aggregate view used by the existing UI,
priorities, and utility scoring. It is not a second mutation path.
- `village.food` and `village.wood` are synchronized aggregate views used by
the existing UI, priorities, and utility scoring. They are not second
mutation paths.
- `StorageNode` supplies the active-world interaction position and presentation
for deposit, withdrawal, eating, and current player pantry interaction.
The village pantry has stable ID `village_pantry`. Storage and NPC inventory
are included in versioned state and deterministic checksums.
The village pantry has stable ID `village_pantry`; the woodpile has stable ID
`village_woodpile`. Storage and NPC inventory are included in versioned state
and deterministic checksums. Patrol and study require one wood on completion:
the effect is applied only when that unit can be withdrawn, and selection does
not choose those actions while the woodpile is empty.
Successful extraction, deposit, withdrawal, and consumption also append
structured economic facts. See [the economic event stream](ECONOMIC_EVENTS.md).