Class Reachable

java.lang.Object
net.storm.sdk.movement.Reachable

public class Reachable extends Object
Provides utilities for checking tile reachability and collision flags.

This class offers methods to determine whether tiles are walkable, check for obstacles and walls, and analyze collision flags. It is essential for understanding what areas the player can access and interact with.

Key features include:

  • Collision checking: Query collision flags for specific tiles
  • Obstacle detection: Check if tiles contain blocking obstacles
  • Wall detection: Determine if movement is blocked by walls
  • Door detection: Check for doors that might block or allow passage
  • Reachability analysis: Determine which tiles can be reached from a position

Example Usage:


 // Check if a tile is walkable
 WorldPoint target = new WorldPoint(3200, 3200, 0);
 if (Reachable.isWalkable(target)) {
     // The tile can be walked on
 }

 // Check if an entity can be interacted with
 if (Reachable.isInteractable(npc)) {
     npc.interact("Talk-to");
 }

 // Check for walls between tiles
 WorldPoint from = Players.getLocal().getWorldLocation();
 WorldPoint to = from.dx(1);
 if (!Reachable.isWalled(from, to)) {
     // No wall blocking movement
 }

 // Get all tiles reachable from the player
 List<WorldPoint> reachableTiles = Reachable.getVisitedTiles(Players.getLocal());
 
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    canWalk(net.runelite.api.coords.Direction direction, int startFlag, int endFlag)
    Checks if walking is possible in a specific direction given the collision flags.
    static boolean
    check(int flag, int checkFlag)
    Checks if a specific flag bit is set in a collision flag value.
    static int
    getCollisionFlag(net.runelite.api.coords.WorldPoint point)
    Retrieves the collision flag for a specific tile.
    static net.runelite.api.coords.WorldPoint
    getNeighbour(net.runelite.api.coords.Direction direction, net.runelite.api.coords.WorldPoint source)
    Gets the neighboring tile in a specific direction from a source point.
    static List<net.runelite.api.coords.WorldPoint>
    getVisitedTiles(net.runelite.api.coords.WorldPoint worldPoint)
    Gets all tiles that can be visited (reached) from a world point.
    static List<net.runelite.api.coords.WorldPoint>
    Gets all tiles that can be visited (reached) from a locatable entity.
    static boolean
    hasDoor(net.runelite.api.coords.WorldPoint source, net.runelite.api.coords.Direction direction)
    Checks if there is a door at the specified tile in the given direction.
    static boolean
    hasDoor(ITile source, net.runelite.api.coords.Direction direction)
    Checks if there is a door at the specified tile in the given direction.
    static boolean
    isDoored(ITile source, ITile destination)
    Checks if movement between two tiles is blocked by a closed door.
    static boolean
    Checks if a locatable entity can be interacted with from the player's position.
    static boolean
    isObstacle(int endFlag)
    Checks if a collision flag indicates an obstacle.
    static boolean
    isObstacle(net.runelite.api.coords.WorldPoint worldPoint)
    Checks if a tile contains an obstacle.
    static boolean
    isWalkable(net.runelite.api.coords.WorldPoint worldPoint)
    Checks if a tile is walkable (not blocked by collision).
    static boolean
    isWalled(net.runelite.api.coords.Direction direction, int startFlag)
    Checks if a wall blocks movement in a specific direction from a tile.
    static boolean
    isWalled(net.runelite.api.coords.WorldPoint source, net.runelite.api.coords.WorldPoint destination)
    Checks if a wall blocks movement between two adjacent tiles.
    static boolean
    isWalled(ITile source, ITile destination)
    Checks if a wall blocks movement between two adjacent tiles.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Reachable

      public Reachable()
  • Method Details

    • check

      public static boolean check(int flag, int checkFlag)
      Checks if a specific flag bit is set in a collision flag value.
      Parameters:
      flag - the collision flag to check
      checkFlag - the specific flag bit to test for
      Returns:
      true if the check flag is set in the flag, false otherwise
    • isObstacle

      public static boolean isObstacle(int endFlag)
      Checks if a collision flag indicates an obstacle.
      Parameters:
      endFlag - the collision flag to check
      Returns:
      true if the flag represents an obstacle, false otherwise
    • isObstacle

      public static boolean isObstacle(net.runelite.api.coords.WorldPoint worldPoint)
      Checks if a tile contains an obstacle.
      Parameters:
      worldPoint - the tile to check
      Returns:
      true if the tile contains an obstacle, false otherwise
    • getCollisionFlag

      public static int getCollisionFlag(net.runelite.api.coords.WorldPoint point)
      Retrieves the collision flag for a specific tile.

      Collision flags indicate what types of movement are blocked on a tile.

      Parameters:
      point - the tile to query
      Returns:
      the collision flag value for the tile
    • isWalled

      public static boolean isWalled(net.runelite.api.coords.Direction direction, int startFlag)
      Checks if a wall blocks movement in a specific direction from a tile.
      Parameters:
      direction - the direction of attempted movement
      startFlag - the collision flag of the starting tile
      Returns:
      true if a wall blocks movement in that direction, false otherwise
    • isWalled

      public static boolean isWalled(net.runelite.api.coords.WorldPoint source, net.runelite.api.coords.WorldPoint destination)
      Checks if a wall blocks movement between two adjacent tiles.
      Parameters:
      source - the source tile
      destination - the destination tile
      Returns:
      true if a wall blocks movement between the tiles, false otherwise
    • isWalled

      public static boolean isWalled(ITile source, ITile destination)
      Checks if a wall blocks movement between two adjacent tiles.
      Parameters:
      source - the source tile
      destination - the destination tile
      Returns:
      true if a wall blocks movement between the tiles, false otherwise
    • hasDoor

      public static boolean hasDoor(net.runelite.api.coords.WorldPoint source, net.runelite.api.coords.Direction direction)
      Checks if there is a door at the specified tile in the given direction.
      Parameters:
      source - the tile to check
      direction - the direction to check for a door
      Returns:
      true if a door exists in that direction, false otherwise
    • hasDoor

      public static boolean hasDoor(ITile source, net.runelite.api.coords.Direction direction)
      Checks if there is a door at the specified tile in the given direction.
      Parameters:
      source - the tile to check
      direction - the direction to check for a door
      Returns:
      true if a door exists in that direction, false otherwise
    • isDoored

      public static boolean isDoored(ITile source, ITile destination)
      Checks if movement between two tiles is blocked by a closed door.
      Parameters:
      source - the source tile
      destination - the destination tile
      Returns:
      true if a closed door blocks movement, false otherwise
    • canWalk

      public static boolean canWalk(net.runelite.api.coords.Direction direction, int startFlag, int endFlag)
      Checks if walking is possible in a specific direction given the collision flags.
      Parameters:
      direction - the direction of attempted movement
      startFlag - the collision flag of the starting tile
      endFlag - the collision flag of the destination tile
      Returns:
      true if walking in that direction is possible, false otherwise
    • getNeighbour

      public static net.runelite.api.coords.WorldPoint getNeighbour(net.runelite.api.coords.Direction direction, net.runelite.api.coords.WorldPoint source)
      Gets the neighboring tile in a specific direction from a source point.
      Parameters:
      direction - the direction to move
      source - the source point
      Returns:
      the world point of the neighboring tile
    • getVisitedTiles

      public static List<net.runelite.api.coords.WorldPoint> getVisitedTiles(Locatable locatable)
      Gets all tiles that can be visited (reached) from a locatable entity.

      This performs a flood-fill from the entity's location to find all connected walkable tiles.

      Parameters:
      locatable - the entity to start the search from
      Returns:
      a list of all reachable world points
    • getVisitedTiles

      public static List<net.runelite.api.coords.WorldPoint> getVisitedTiles(net.runelite.api.coords.WorldPoint worldPoint)
      Gets all tiles that can be visited (reached) from a world point.

      This performs a flood-fill from the starting point to find all connected walkable tiles.

      Parameters:
      worldPoint - the starting point for the search
      Returns:
      a list of all reachable world points
    • isInteractable

      public static boolean isInteractable(Locatable locatable)
      Checks if a locatable entity can be interacted with from the player's position.

      This checks if the player can reach an adjacent tile to the entity.

      Parameters:
      locatable - the entity to check interaction with
      Returns:
      true if the entity can be interacted with, false otherwise
    • isWalkable

      public static boolean isWalkable(net.runelite.api.coords.WorldPoint worldPoint)
      Checks if a tile is walkable (not blocked by collision).
      Parameters:
      worldPoint - the tile to check
      Returns:
      true if the tile is walkable, false otherwise