Class LocalCollisionMap

java.lang.Object
net.storm.api.movement.pathfinder.LocalCollisionMap
All Implemented Interfaces:
CollisionMap

public class LocalCollisionMap extends Object implements CollisionMap
Real-time collision map based on the currently loaded game scene.

LocalCollisionMap provides collision checking using live game data from the current scene. Unlike GlobalCollisionMap, this implementation reflects real-time changes such as:

  • Opened/closed doors
  • Moved objects
  • Dynamic obstacles
  • Player-placed objects

Door Handling

The LocalCollisionMap can optionally treat doors as passable (when blockDoors is false). This is useful for pathfinding that assumes doors can be opened, but requires the path executor to actually open doors when encountered.

Limitations

  • Only works within the currently loaded scene (104x104 tiles)
  • Returns false for tiles outside the loaded area
  • May have slight delays in reflecting very recent changes

Usage Example


 // Create a local collision map that allows door passage
 LocalCollisionMap localMap = new LocalCollisionMap(false);

 // Check if you can move north from current position
 WorldPoint pos = Static.getPlayers().getLocal().getWorldLocation();
 boolean canMoveNorth = localMap.n(pos);
 
See Also:
  • Constructor Details

    • LocalCollisionMap

      public LocalCollisionMap()
  • Method Details

    • n

      public boolean n(int x, int y, int z)
      Checks if movement North (y+1) is allowed from the specified position.

      This implementation checks real-time collision data from the current scene, including dynamic obstacles and optionally treating doors as passable.

      Specified by:
      n in interface CollisionMap
      Parameters:
      x - the x coordinate
      y - the y coordinate
      z - the plane/level
      Returns:
      true if movement North is allowed
    • e

      public boolean e(int x, int y, int z)
      Checks if movement East (x+1) is allowed from the specified position.

      This implementation checks real-time collision data from the current scene, including dynamic obstacles and optionally treating doors as passable.

      Specified by:
      e in interface CollisionMap
      Parameters:
      x - the x coordinate
      y - the y coordinate
      z - the plane/level
      Returns:
      true if movement East is allowed