feat(walls): proto 2 typed wall record, inert geometry, derived kind (#54)

wall.add/wall.update take thickness, position, height and the eight raw
switches; kind is output-only and the GM wall frames echo the full typed
record. Geometry is stored but inert (0/full/centre behaviour), and the
legacy kind/open wire adapter is gone. proto is bumped to 2 with the
harness default, and BannedAlways gains every wall field name with a
WALLDATA positive control.

Tests: schema-7 migrated scene vs the same walls authored via raw switches
gives byte-identical player frames, refusals and per-tile statuses.
Nim 382 / Node 113 green.
This commit is contained in:
2026-11-19 22:21:47 +01:00
parent c1b1e9cf91
commit 77fa2dfe4c
23 changed files with 852 additions and 318 deletions
+5 -3
View File
@@ -60,7 +60,7 @@ async function sceneWithVision(s, gmKey, ngx) {
const gm = await gmConnect(ngx.origin, gmKey)
const player = await createPlayer(gm.ws)
await namePlayer(ngx.origin, player.key, 'Alice')
const wall = await addWall(gm, { a: [400, 100], b: [400, 700], kind: 'wall' })
const wall = await addWall(gm, { a: [400, 100], b: [400, 700] })
const created = await gm.ws.request({ t: 'token.create', scene: gm.scene, kind: 'pc',
pos: [300, 300], flags: { vision: true },
vision_radius: 400, controller: player.id,
@@ -112,8 +112,10 @@ function segGap(p, q, a, b) {
}
function blockingWalls(wallsFrame) {
// A wall blocks sight unless it is an open door (today's rule; the raw switches gain their
// behaviour in the window/one-way rounds, #57/#58).
return wallsFrame.walls
.filter(w => w.kind === 'wall' || w.open === false)
.filter(w => !(w.door && w.open))
.map(w => ({ a: { x: w.a[0], y: w.a[1] }, b: { x: w.b[0], y: w.b[1] } }))
}
@@ -414,7 +416,7 @@ test('concurrent scene edits and tile requests answer whole tiles, never a mixtu
assert.equal((await ctx.gm.ws.request({ t: 'scene.set', scene: scene.id,
name: `Cave ${i}` })).ok, true)
const w = await ctx.gm.ws.request({ t: 'wall.add', scene: scene.id,
a: [380, 200], b: [380, 420], kind: 'wall' })
a: [380, 200], b: [380, 420] })
assert.equal(w.ok, true, JSON.stringify(w))
assert.equal((await ctx.gm.ws.request({ t: 'wall.remove', scene: scene.id,
id: w.id })).ok, true)