M4: GM token panel sets vision (flags.vision, vision_radius) #78
Notifications
Due Date
No due date set.
Blocks
#77 M4: real-phone playtest gate (Note 10, 60 fps)
SirStone/FFF_vtt_frozen
Reference: SirStone/FFF_vtt_frozen#78
Reference in New Issue
Block a user
Part of #63
Goal
The GM token panel must be able to set vision (
flags.visionandvision_radius) on both create and edit, so a token placed through the UI actually sees the map. Todayclient/src/panels/admin.tssends neither field:createTokensendsscene, kind, pos, descriptive_name, actual_name, radius, gm_only, controller, andsaveTokensendsid, kind, descriptive_name, actual_name, gm_only, controller. DESIGN §8 defaults a new token'sflagsto'{}'; §4.1 says only owned entities withvisionproduce polygons; with no polygon the player's explored set stays empty and, since a tile is allowed iff an explored cell overlaps it (§3.3), every tile answers 403 — the player sees no map at all, only fog.Story 36 and #74's acceptance criterion "Token panel drives intents and reflects frames" both assume this works. #70's e2e only passes because the harness posts
flags:{vision:true}, vision_radius:300straight at the wire (client/e2e/fog.test.mjs), bypassing the UI under test.Acceptance criteria
tokenframe carries the sameflags.visionandvision_radius.visionframe and grows that player's explored set: a probe of an explored tile answers 200 and an unexplored one 403 for that player (no wire poking).vision_radiusblank still means the scene default (vision_radius: null), and a non-positive value is refused client-side like the existing radius field.client/e2e/fog.test.mjsbuilds its world through the UI only: no rawflags/vision_radiusin a wiretoken.createin the test, and the player still sees map + three-state fog (all existing probes kept).devbox run test,devbox run client-test,devbox run e2egreen on a clean checkout, no test weakened or skipped.Proven at
GM panels DOM + reducer admin slice; client e2e (fog pixel probes, world authored through the UI); client unit test on the token edit state.
Notes
vision_radiusis also the player step cap (DESIGN §5.5), so the GM setting it has a second visible effect; cover it in the e2e only if it is cheap, otherwise note it.flagsis free-form (§8): send only thevisionkey, never rebuild the whole flags object from the panel, so future GM flags survive an edit.Implemented on
mainasbacf2e1.flags.visionandvision_radius(client/src/tokenPanel.tspure seam +panels/admin.ts). Edits merge only thevisionkey into the stored flags; other GM flags survive.flags: '{}'. Recorded as a dated FIXED note in DESIGN §8 and DESIGN-history §C; no wire default changed.client/e2e/fog.test.mjsnow authors the sighted token through the GM panel (no rawflags/vision_radiusin a wiretoken.create).client/e2e/admin.test.mjsproves the create/edit round-trip on the GMtokenframe and an explored tile 200 / unexplored 403 probe for that player.client/test/token-panel.test.ts(radius validation, create flags, edit merge) and admin-slice flags parsing.Gates on the rebased tree:
devbox run test159 pass;devbox run client-test173 pass;devbox run e2e27 pass. No test weakened or skipped.