Class LocalPathfinder
- java.lang.Object
-
- net.openosrs.api.service.movement.LocalPathfinder
-
@Singleton public class LocalPathfinder extends java.lang.ObjectBFS pathfinder over the active scene's collision flags. Scope: LOCAL SCENE ONLY (the ~104x104 tile world view around the player). Global/world travel is a separate concern (teleports + P10c path server). Collision model (net.runelite.api.CollisionDataFlag): - Each tile's flags block movement TOWARD a direction from that tile (e.g. BLOCK_MOVEMENT_NORTH means you cannot step north FROM this tile). - Moving north from A to B requires: !(A & NORTH) && !(B & SOUTH) plus neither tile being fully blocked (OBJECT/FLOOR). - Diagonals require both adjacent cardinals to be open as well.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLocalPathfinder.RouteA computed route: start tile excluded, destination included.static classLocalPathfinder.StepOne hop in a route.
-
Constructor Summary
Constructors Constructor Description LocalPathfinder(SceneService scenes)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.LongnearestReachable(int fromX, int fromY, int toX, int toY, int plane)Nearest reachable scene tile to an arbitrary target (may itself be blocked).java.util.List<java.lang.Long>reachableSet(int fromX, int fromY, int plane)Flood-fill every tile reachable from the start (bounded by scene size).LocalPathfinder.Routeroute(int fromX, int fromY, int toX, int toY, int plane)Find the shortest walking route between two scene-local points on one plane.LocalPathfinder.Routeroute(net.runelite.api.coords.WorldPoint from, net.runelite.api.coords.WorldPoint to)Convenience: route between two world points if both are in the active scene.
-
-
-
Constructor Detail
-
LocalPathfinder
@Inject public LocalPathfinder(SceneService scenes)
-
-
Method Detail
-
route
public LocalPathfinder.Route route(int fromX, int fromY, int toX, int toY, int plane)
Find the shortest walking route between two scene-local points on one plane.- Parameters:
fromX- scene x of start (0..103 within the current world view)fromY- scene y of starttoX- scene x of targettoY- scene y of targetplane- plane to search- Returns:
- route with steps excluding the start tile, or null when unreachable
-
route
public LocalPathfinder.Route route(net.runelite.api.coords.WorldPoint from, net.runelite.api.coords.WorldPoint to)
Convenience: route between two world points if both are in the active scene.
-
reachableSet
public java.util.List<java.lang.Long> reachableSet(int fromX, int fromY, int plane)Flood-fill every tile reachable from the start (bounded by scene size).- Returns:
- list of reachable scene coordinates as long-packed x|y values.
-
nearestReachable
public java.lang.Long nearestReachable(int fromX, int fromY, int toX, int toY, int plane)Nearest reachable scene tile to an arbitrary target (may itself be blocked).- Returns:
- scene coords packed as
(long)x<<32 | y, or null when nothing reachable.
-
-