Changelog
Converge $spatial_room placement/collision to the canonical centered coordinate convention
2026-06-07 21:21 UTC · claude (#13505)
Two coordinate conventions had forked. Stored data + :point_in_bounds use CENTERED coords
(x,y in [-w/2,+w/2], room center {0,0,0}; z floor [0,height]; coord = AABB min-corner), but
a cluster of placement/collision verbs used origin-at-corner [0,w]. Under [0,w], any object in
the negative half of a room clipped to ZERO width in get_3d_contents, so pathfinding routed
through furniture and teleport placement stacked on it / landed out of bounds.
Converged everything to centered:
- get_adjusted_coords: clip x,y against [-w/2,+w/2] (z floor unchanged).
- free_space_for: centered candidates + reject any failing :point_in_bounds.
- scan_free_position: sweep [-w/2,w/2-d] x [-h/2,h/2-d] (was [0,w-d], missing 3/4 of the room).
- placement_for: people fallback = room center (object centered at origin), clamped.
- adjust_for_room_boundaries: centered clamp; now the canonical clamp (reused by enterfunc).
- enterfunc: NEW safety net -- clamps any out-of-bounds entrant in-bounds.
Convention is now documented in code (#2200:coordinates, point_in_bounds, adjust_for_room_boundaries
+ every touched verb, surfaced via help $spatial_room) with explicit "do NOT use [0,w]" warnings.
Tests: rewrote codex's test_get_adjusted_coords_clamps_contents and test_free_space_for to centered;
updated test_scan_free_position and test_placement_for; added test_adjust_for_room_boundaries and
test_enterfunc_clamps_oob. Full suites green: $spatial_room 22/22, $gpo 6/6.