Status: done (2026-11-25)
Priority: 3
Size: M
Arch: mill
Phase: implement
Design ref: Goods, production and animals (The mill and the loom, the kiln and the quarry); backlog/VB-185.md
Goal: st.facilities holds built things on sites with an owner, a kind, a condition and building stages that are plan steps; the bloomery, the loom’s house, kilns and mills use it. Slice 6’s plan (VB-185, 11 Nov), from Kim’s answers in the session.
Acceptance criteria:
sim/facilities owns st.facilities (ids are indexes, never reused): { id, kind, tile, owner (a household or a village), stage, done, condition, built }, after target-v2 4.3’s Facility, cut to what slice 6 needs; a live index by tile and by owner, a cache with one writer (rule 1); @state, src/owners.json, invariants, saves.FACILITY[kind]: the stages of its building as a recipe (hours, loads of each good taken from the owner’s stores through sim/stores with the reason build), where it may stand (a tile test), its capabilities and capacity. found(st, kind, tile, owner) checks and returns why not; a verb in src/sim/commands.js; each stage is a job kind raise whose hours and loads the stage names.npm run verify passes its hard checks.
Notes:raisestage and mendfacility, since raise is already the stone foundation’s kind (sim/building); the
verbs are found and upkeep. Condition is kept as condition at condAt (closed form, as a booth’s), the one field beyond the brief.
done is the hours on the open stage, kept on the facility (a half-built one outlives a dropped plan; founding it again on its tile
takes it up, the open step less those hours). The stages’ loads go as project steps’ spends (reserved at founding, taken with build).
Upkeep: a household’s on its planning day (planReviewed), a village’s at its review (sim/routines villageSteps), below FACILITIES.mend 0.6.
Test kinds only (tests/facilities.js); nothing moves in, so no run’s numbers change (counters the same, facilityAsk 0 everywhere).
The page’s drawing is page/facilityart.js, its own concern, not page/settlement (at 715 lines it would have crossed 700).