feat(walls): presets, label rule and one switch-set validation path (#55)
wall.add/wall.update now take a preset or raw switches, never both:
resolveWall expands the four 5.8 presets to switches before validating, so
a preset never touches geometry and preset+switch or preset+open is invalid.
A raw create starts from the wall defaults; a raw update patches only the
switches it names and {door:false} closes and de-secrets.
The switch-set invariants are enforced by that one path for add and update:
open/secret/locked without a door, a secret door that is open/one-way/not
opaque, open with secret or locked, and a direction with no sight to block
are all invalid. The DB gains the missing open+locked CHECK as the backstop,
and the now-redundant open/door parity test is gone from the server path.
A wall label is now the 6.5 text rule: trimmed, 1..64 code points, no control
characters, null clears, stored verbatim and GM-only. window/one_way presets
are accepted and expanded to their switch sets per DESIGN 5.8/6.1; their
player-facing behaviour stays with #57/#58.
Tests: WS black-box presets/patch semantics/every refusal/label round-trip;
Nim shape pins for expansion, invariants and the label rule.
Nim 385 / Node 117 green.
This commit is contained in:
@@ -230,6 +230,7 @@ CREATE TABLE wall (
|
||||
CHECK (secret = 0 OR (door = 1 AND open = 0 AND blocks_sight = 1 AND blocks_movement = 1
|
||||
AND sight_dir = 'both')),
|
||||
CHECK (locked = 0 OR door = 1),
|
||||
CHECK (open = 0 OR locked = 0),
|
||||
CHECK (sight_dir = 'both' OR blocks_sight = 1)
|
||||
)""", """
|
||||
INSERT INTO wall (scene_id, id, ax, ay, bx, by, thickness, position, blocks_sight,
|
||||
|
||||
Reference in New Issue
Block a user