five-on-it / packages/world/src/nav-links
packages/world/src/nav-links
The links of the layered navigation (NavLayers): the ways between floors that are no walk, typed by how someone takes them, and which nodes reach which with them.
- A ladder (
LevelData.ladders) joins the node at its foot (a step back from its wall) and the node where it is stepped off at the top (beyond the wall's edge), both ways: its height at a climber's run and a second to get on. - A lift joins the floors at its stops, each to each: half its round on the timetable to wait for it, then the ride.
- A drop goes off the edge of an upper floor (a roof, a deck) down to the floor beside it, one way, from 0.5 m to 4 m below: a fall that hurts nobody.
- A hop goes up 0.5 to 1.2 m onto an upper floor beside it: the jump a player makes onto a low roof. Only onto a level floor with room on it (a node walked to on all four sides): never the top of a wall or a parapet, nor the side of a flight of stairs.
- Stairs too narrow for a cell (a flight over a hidden slope,
*stairs-slope, whose ends the grid does not join: the compound's fire stairs, 1.4 m wide) join the node at their foot and the one at their top, both ways.
Drops, hops and stairs are made only between nodes a walk does not join already, so a level whose floors are all walked onto is planned on exactly as before. A drop or a hop looks across up to two cells (a wall's clearance blocks the cell beside it) and is made only where nothing solid stands between its ends over the higher floor.
The components (NavComponents): the nodes a walk joins, by union-find over the walk links (forEachLink); then those the two-way links join; then the sets the one-way links make strongly connected (a hop up and a drop back down) merged; what is left of the one-way links between components are the edges down (off a roof nothing leads up to). navReachable answers from them whether one node reaches another, without a search. Pure and deterministic. Isomorphic: no DOM, no Node.