fix: sync stair elevations with floor slabs (#216)

Mark stair nodes as dirty when slabs change so stairs properly stack on
top of floor slabs. StairSystem now computes slab-driven elevation by
sampling segment centers against the spatial grid.

Changes:
- spatial-grid-sync: mark stair nodes dirty on slab changes (same level)
- stair-system: syncStairGroupElevation + getStairSlabElevation compute
  Y offset from slab data; rotateXZ helper for world-space transforms
- stair-renderer: use position-x/position-z so the system controls Y
This commit is contained in:
Pascal
2026-04-06 12:02:57 -04:00
committed by GitHub
parent ed6ed3f018
commit d9965f487c
3 changed files with 74 additions and 2 deletions
@@ -124,7 +124,7 @@ function arraysEqual(a: number[], b: number[]): boolean {
}
/**
* Mark all floor items and walls that overlap a slab polygon as dirty.
* Mark all floor items, walls, and stairs that may be affected by a slab change as dirty.
*/
function markNodesOverlappingSlab(
slab: SlabNode,
@@ -157,6 +157,9 @@ function markNodesOverlappingSlab(
if (wallOverlapsPolygon(wall.start, wall.end, slab.polygon)) {
markDirty(node.id)
}
} else if (node.type === 'stair') {
if (resolveLevelId(node, nodes) !== slabLevelId) continue
markDirty(node.id)
}
}
}