five-on-it / packages/world/src/nav-layers / forEachLink
Function: forEachLink()
forEachLink(
layers,node,diagonals,visit):void
Defined in: packages/world/src/nav-layers.ts:194
Calls visit with every node linked to node in the four (or, with diagonals, eight) neighbouring cells, and the step's length in cells (1, or √2 across a corner), always in the same order. A diagonal step is taken only where it can be walked round both ways: a node of each cell it cuts between is linked to node and to the node it reaches, so no wall's corner nor a floor's edge is cut.
Parameters
layers
node
number
diagonals
boolean
visit
(to, step) => void
Returns
void