tilesWithinCost
tilesWithinCost: (Reachability, number) -> { WorldPoint }Every tile within a step budget of the local player.
cost- Maximum path length in steps.
scene:reachability()
scene:reachabilityFrom(…)| Method | Returns | Description |
|---|---|---|
tilesWithinCost(number) | { WorldPoint } | Every tile within a step budget of the local player. |
reachable(WorldPoint) | boolean | Whether a tile can be walked to from where the player stands. |
source() | WorldPoint | The tile the flood was run from. |
pathLength(WorldPoint) | number? | Step cost to a tile. |
pathTo(WorldPoint) | { WorldPoint } | The full walk to a tile. |
tilesAtCost(number) | { WorldPoint } | Every tile at EXACTLY this step cost -- the ring. tilesWithinCost is the disc. |
reachableAdjacentTiles(WorldArea) | { WorldPoint } | Every reachable tile touching an area -- the tiles to stand on to use it. |
pathToArea(WorldArea) | { WorldPoint } | The walk to a tile that fronts an area. |
pathLengthToArea(WorldArea) | number? | Step cost to the nearest tile that fronts an area. |
reachableTileWithinRange(WorldArea, number, boolean) | WorldPoint? | A tile to stand on to attack an area from within a range. |
frontsArea(WorldPoint, WorldArea) | boolean | Whether a tile is one of reachableAdjacentTiles(area): the flood reached it, and it touches the area across no wall. Standing there is en… |
seesArea(WorldPoint, WorldArea) | boolean | Whether a tile has a clear line of sight to an area. |
canStep(WorldPoint, WorldPoint) | boolean | Whether one step between adjacent tiles is legal. |
hasLineOfSight(WorldPoint, WorldPoint) | boolean | Whether one tile can see another. |
pathToward(WorldPoint) | { WorldPoint } | The walk toward a tile: the path to it, or when it cannot be reached the path to the closest tile the flood did reach. pathTo is the one… |
reachabilityMap() | { ReachedTile } | The whole flood: every reached tile, its step cost, and the tile it was stepped from. |
cameFrom(WorldPoint) | WorldPoint? | The tile stepped from to reach one tile, for walking a path back without holding the whole map. |
tilesInSight(WorldPoint, number) | { WorldPoint } | Every tile within a radius that an origin can see. |
| Method | Returns | Description |
|---|---|---|
SceneDomain.reachability | Reachability? | Reachability flood from the local player: where you can GET. |
SceneDomain.reachabilityFrom | Reachability? | The same flood seeded somewhere other than the local player -- "could I reach that from over there", which is what a route or a safespot ch… |
tilesWithinCosttilesWithinCost: (Reachability, number) -> { WorldPoint }Every tile within a step budget of the local player.
costreachablereachable: (Reachability, WorldPoint) -> booleanWhether a tile can be walked to from where the player stands.
tilesourcesource: (Reachability) -> WorldPointThe tile the flood was run from.
A handle outlives the call that made it, and reachabilityFrom can seed one somewhere other than the player, so "reachable from where?" is not answerable without this.
pathLengthpathLength: (Reachability, WorldPoint) -> number?Step cost to a tile.
tilenil when the tile cannot be reached.pathTopathTo: (Reachability, WorldPoint) -> { WorldPoint }The full walk to a tile.
tiletilesAtCosttilesAtCost: (Reachability, number) -> { WorldPoint }Every tile at EXACTLY this step cost -- the ring. tilesWithinCost is the disc.
costreachableAdjacentTilesreachableAdjacentTiles: (Reachability, WorldArea) -> { WorldPoint }Every reachable tile touching an area -- the tiles to stand on to use it.
areapathToAreapathToArea: (Reachability, WorldArea) -> { WorldPoint }The walk to a tile that fronts an area.
areapathLengthToAreapathLengthToArea: (Reachability, WorldArea) -> number?Step cost to the nearest tile that fronts an area.
areanil when nothing fronting it can be reached.reachableTileWithinRangereachableTileWithinRange: (Reachability, WorldArea, number, boolean) -> WorldPoint?A tile to stand on to attack an area from within a range.
arearangerequireLineOfSightnil when no such tile is reachable.frontsAreafrontsArea: (Reachability, WorldPoint, WorldArea) -> booleanWhether a tile is one of reachableAdjacentTiles(area): the flood reached it, and it touches the area across no wall. Standing there is enough to act on the area, with no line of sight asked; seesArea is the other way to act on one.
fromareaseesAreaseesArea: (Reachability, WorldPoint, WorldArea) -> booleanWhether a tile has a clear line of sight to an area.
fromareacanStepcanStep: (Reachability, WorldPoint, WorldPoint) -> booleanWhether one step between adjacent tiles is legal.
fromtohasLineOfSighthasLineOfSight: (Reachability, WorldPoint, WorldPoint) -> booleanWhether one tile can see another.
fromtopathTowardpathToward: (Reachability, WorldPoint) -> { WorldPoint }The walk toward a tile: the path to it, or when it cannot be reached the path to the closest tile the flood did reach. pathTo is the one that answers empty instead.
local path = scene:reachability():pathToward(tile)
local stop = path[#path]tilereachabilityMapreachabilityMap: (Reachability) -> { ReachedTile }The whole flood: every reached tile, its step cost, and the tile it was stepped from.
This is what a reachability map is -- costs and came-froms from the source. Cost and came-from are what the flood computes, and what a caller cannot recover afterwards without searching again.
One call, because the alternative is a pathLength and a cameFrom per tile and a scene flood is thousands of them.
cameFromcameFrom: (Reachability, WorldPoint) -> WorldPoint?The tile stepped from to reach one tile, for walking a path back without holding the whole map.
tilenil at the source, or when the tile is unreachable.tilesInSighttilesInSight: (Reachability, WorldPoint, number) -> { WorldPoint }Every tile within a radius that an origin can see.
originradius