Reach

Methods
4
Fields
None

Methods

MethodReturnsDescription
blockingTiles({WorldPoint}, {WorldPoint}){WorldPoint}?The tiles of removable to clear, in walk order, to reach any tile of goals from the player ("next to any vein", "any attack position":…
blockingTilesTo(WorldPoint, {WorldPoint}){WorldPoint}?The same, to one target tile, and empty whenever target is reachable by a normal walk.
blockingTilesToArea(WorldArea, {WorldPoint}){WorldPoint}?The same, to any tile of area, and empty whenever one of them is reachable by a normal walk.
pathLengthAvoiding(WorldPoint, {WorldPoint})number?Steps from the player to target with the tiles of blocked as walls for this one query, not a setting later queries inherit; nil when…

Method details

blockingTiles

blockingTiles: ({WorldPoint}, {WorldPoint}) -> {WorldPoint}?

The tiles of removable to clear, in walk order, to reach any tile of goals from the player ("next to any vein", "any attack position": add them to goals): empty when the best route enters no removable tile, nil when no goal is reachable even after clearing every removable tile. A removable tile on the route counts even where it is walkable.

pathLengthAvoiding

pathLengthAvoiding: (WorldPoint, {WorldPoint}) -> number?

Steps from the player to target with the tiles of blocked as walls for this one query, not a setting later queries inherit; nil when target cannot be reached so.

local past = Reach.pathLengthAvoiding(goal, { npc:getWorldLocation() })
if past ~= nil then player:walkTo(goal) end