Status: done (2026-11-10)
Priority: 2
Size: M
Arch: life
Phase: implement
Design ref: The player and what they see (What the player sees, What it may do here: Proposed, VB-079); Which pawn (Decided, 3 Nov); docs/review-life.md, sections 2 and 3.
Goal: With VB-169 the simulation takes a player’s commands and VB-209 says what a pawn may do; this task makes it playable in the page. The pawn panel offers “Play as”, and while the player plays a pawn it shows what the pawn needs, what it is doing, what it may do here (each a button that queues the command), the queue, and the automatic switch.
Acceptance criteria:
Sim.opportunities, grouped as work, going, causes and at the moving round; each with its basis, and greyed with its reason where why is set.
A click queues the command; “Walk here” queues a walk to the next open tile clicked on the map.st); the played pawn is marked on the map, so it can be found among others.st and writes only through Sim, as the lint requires; the panel is rebuilt at its present rate (src/page/animate.js:144), and Sim.opportunities is called at most once per rebuild.tests/browser*.js: play as a pawn, queue a job, see it carried out, switch the automatic behaviour off and see the pawn idle in working hours; no console errors. The phone layout (tests/browser-mobile.js) shows the panel usable at its width.docs/img/vb-210-*.png, linked here and in the PR. Golden file unchanged.
Notes:src/page/play.js (after page/history.js in src/page.json). “Play as” on the card of any living adult (18 and over) and “Stop playing” on the played pawn’s, through Sim.inhabit and Sim.uninhabit. A new game offers the scenario’s suggestion over the toasts (#playOffer: the holder of the first household with a living adult holder, which is the first holder in founders and heirs and a holder in populous); it goes when a pawn is played, a panel opens or another world is built. While playing, the card shows hunger and health, the household’s food in days of need (grain above the seed reserve, cooked rations and the larder, over a day’s rations of its living) and its firewood, what it is doing, the automatic switch (Sim.setAuto), Follow, the queue (each with Remove, Sim.unqueue), the last refused command with its reason and time, and what it may do here from one Sim.opportunities call per rebuild, grouped as work, going, causes and at the moving round, each with its basis or, greyed, its why. Work and going queue through Sim.queue (idle for an hour from the click); “Walk here” waits for the next tile clicked on the map (page/tileinfo asks first), asks Sim.opportunities with that tile and queues the walk only where it is open, else says why and waits for another. Causes and the round’s acts are shown read-only until VB-211 and VB-212. Follow keeps the camera on the pawn, or its house while it is indoors (page state; a drag lets go). The played pawn has a gold pointer over its head (or its house), the same size on screen at any zoom. The card is rebuilt at its present rate (page/animate, four times a second), its HTML replaced only when it changes. docs/architecture/modules.md names the script.node tests/golden.js; the Sim API is unchanged, so the page computes a day’s rations from Sim.ECON.ration rather than adding dailyNeed to Sim); npm test passes; npm run verify passes but for tests/history.js, which fails identically at the base commit 2191d53 on this checkout’s local fixtures (all four stale: routeExpand 1.385, routeRefresh 1.978, roundPairs 3.706 against their baselines), and nothing under src/sim/ changed. No behaviour change in the simulation, so no numbers before and after.tests/browser.js: the new game’s suggestion is a holder and Play plays it; then after a skipped year, Play as, a job queued from the card and seen worked (the pawn on that job in phase work), Walk here on the tile at the middle of the view with Follow on, the automatic behaviour off and the queue emptied: the pawn takes no job for 4 game hours of working time once its job in hand is done; Stop playing; no console errors.tests/browser-mobile.js: at 390×844 the played pawn’s card fits, none of its buttons runs past the screen, the switch turns the behaviour off.docs/img/vb-210-before-desktop.png (1440×900) and docs/img/vb-210-before-phone.png (390×844); after, docs/img/vb-210-after-desktop.png and docs/img/vb-210-after-phone.png (playing, with Go home queued), and docs/img/vb-210-after-desktop-opportunities.png and docs/img/vb-210-after-phone-opportunities.png (what it may do here).