1681-engine / index / nearestOpen
Function: nearestOpen() ​
ts
function nearestOpen(
g,
tx,
ty,
maxRadius?,
ok?
): TilePoint | null;Defined in: src/nav/nearestOpen.ts:8
The open tile nearest to (tx, ty) within maxRadius rings, or null: a start or a goal inside a rock still gets a route. ok narrows what counts (an open tile that is not a door, say). On each ring the closest tile wins, not the first scanned — scanning order once always picked the ring's top-left corner.
Parameters ​
| Parameter | Type | Default value |
|---|---|---|
g | NavGrid | undefined |
tx | number | undefined |
ty | number | undefined |
maxRadius | number | 12 |
ok | (x, y) => boolean | ... |
Returns ​
TilePoint | null