feat(walls): windows — see-through barrier, movement follows blocks_movement (#57)
- geometry.Wall carries the stored blocks_sight/blocks_movement switches; sight asks blocksSight, movement and the status rules ask blocks (open door passes both). - worldmap translates both switches; moverules only pushes on a movement barrier. - leakcheck and the tile oracle read blocks_sight independently. - Walls/token-details/tiles groups prove both forms, sight-through, stuck, push and the locked-window open refusal; existing scenes stay byte-identical. Ref #57 # Conflicts: # server/geometry.nim # server/world.nim # server/worldmap.nim # tools/leakcheck.nim
This commit is contained in:
+11
-8
@@ -18,26 +18,29 @@ import std/options
|
||||
import geometry, moverules, tokens, world, faults
|
||||
|
||||
proc geometryWalls*(sc: SceneRec, forSight = false): seq[Wall] =
|
||||
## The scene's walls as the vision code sees them: an open door does not block (5.1), and a
|
||||
## one-way wall carries the side that is blind (5.8, #58). Movement gets the same mapping and
|
||||
## ignores `sightDir` (two-way).
|
||||
## `forSight` is only the sight computation; `LEAK_FAULT=secretgap` (a -d:leakfault build only)
|
||||
## opens a secret door there, the negative control for the door-equivalence group (#56).
|
||||
## The scene's walls as the vision and move code see them. Each wall carries its stored switches:
|
||||
## the sight fan asks `blocksSight` (and the one-way `sightDir`, 5.8/#58), the move rules and the
|
||||
## statuses ask `blocks`, so a window is see-through but still a barrier to movement (#57). Every
|
||||
## wall stays in the list, in scene order: `moverules` addresses walls by that index. `forSight`
|
||||
## is only the sight computation; `LEAK_FAULT=secretgap` (a -d:leakfault build only) opens a
|
||||
## secret door there, the negative control for the door-equivalence group (#56).
|
||||
result = newSeqOfCap[Wall](sc.walls.len)
|
||||
for w in sc.walls:
|
||||
let dir = case w.sightDir
|
||||
of sdBoth: wdBoth
|
||||
of sdLeft: wdLeft
|
||||
of sdRight: wdRight
|
||||
var wall = Wall(a: w.a, b: w.b, door: w.door, open: w.open, sightDir: dir)
|
||||
var wall = Wall(a: w.a, b: w.b, door: w.door, open: w.open, sightDir: dir,
|
||||
sightBarrier: w.blocksSight, movementBarrier: w.blocksMovement)
|
||||
if forSight and w.secret and faultActive("secretgap"):
|
||||
wall.open = true
|
||||
result.add wall
|
||||
|
||||
proc ruleWall*(w: WallRec): Wall =
|
||||
## The same wall as the move rules see it (they need `door`/`open` to know what blocks; the
|
||||
## The same wall as the move rules see it (they need the movement switch and `door`/`open`; the
|
||||
## one-way direction is sight-only and never read by the move rules, so it is not mapped).
|
||||
Wall(a: w.a, b: w.b, door: w.door, open: w.open)
|
||||
Wall(a: w.a, b: w.b, door: w.door, open: w.open,
|
||||
sightBarrier: w.blocksSight, movementBarrier: w.blocksMovement)
|
||||
|
||||
proc ruleToken*(sc: SceneRec, t: TokenRec): moverules.Token =
|
||||
moverules.Token(pos: t.pos, owner: t.owner,
|
||||
|
||||
Reference in New Issue
Block a user