Class ActorService


  • public class ActorService
    extends java.lang.Object
    Utility service for calculating line of sight (LoS), collision, and reachability for actors and tiles within the game world.
    • Constructor Summary

      Constructors 
      Constructor Description
      ActorService()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static net.runelite.api.coords.WorldPoint getActorLineOfSightTerminationTile​(net.runelite.api.NPC npc)
      Finds the tile where an NPC path would terminate once the NPC has line of sight to the local player.
      static net.runelite.api.coords.WorldPoint getActorLineOfSightTerminationTile​(net.runelite.api.NPC npc, net.runelite.api.Player player)
      Finds the tile where an NPC path would terminate once the NPC has line of sight to the target player.
      static java.util.List<net.runelite.api.coords.WorldPoint> getActorPath​(net.runelite.api.Actor actor, net.runelite.api.coords.WorldPoint destination)
      Computes the movement path an actor would take towards a destination tile using local collision data.
      static java.util.List<net.runelite.api.coords.WorldPoint> getActorPath​(net.runelite.api.Actor actor, net.runelite.api.Player player)
      Computes the movement path an actor would take towards a target player using local collision data.
      static java.util.List<net.runelite.api.coords.WorldPoint> getActorPath​(net.runelite.api.NPC npc)
      Computes the movement path an NPC would take towards the local player using local collision data.
      static java.util.List<net.runelite.api.coords.WorldPoint> getActorPathUntilLineOfSight​(net.runelite.api.NPC npc)
      Computes the movement path an NPC would take towards the local player and truncates it at the first tile where the NPC gains line of sight to the player.
      static java.util.List<net.runelite.api.coords.WorldPoint> getActorPathUntilLineOfSight​(net.runelite.api.NPC npc, net.runelite.api.Player player)
      Computes the movement path an NPC would take towards a target player and truncates it at the first tile where the NPC gains line of sight to that player.
      static java.util.List<net.runelite.api.coords.WorldPoint> getLineOfSightTiles​(net.runelite.api.NPC npc, int range)
      Retrieves a list of all tiles within a specified radius that an NPC currently has line of sight to.
      static boolean hasLineOfSightTo​(net.runelite.api.coords.WorldPoint source, net.runelite.api.coords.WorldPoint other)
      Checks if there is a clear line of sight between two world points.
      static boolean hasLineOfSightTo​(net.runelite.api.Tile source, net.runelite.api.Tile other)
      Checks if there is a clear line of sight between two scene tiles.
      • Methods inherited from class java.lang.Object

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

      • ActorService

        public ActorService()
    • Method Detail

      • getActorPath

        public static java.util.List<net.runelite.api.coords.WorldPoint> getActorPath​(net.runelite.api.NPC npc)
        Computes the movement path an NPC would take towards the local player using local collision data. The returned list does not include the NPC's current tile.
        Parameters:
        npc - The source NPC.
        Returns:
        The predicted step-by-step path toward the local player.
      • getActorPath

        public static java.util.List<net.runelite.api.coords.WorldPoint> getActorPath​(net.runelite.api.Actor actor,
                                                                                      net.runelite.api.Player player)
        Computes the movement path an actor would take towards a target player using local collision data. The returned list does not include the actor's current tile.
        Parameters:
        actor - The source actor.
        player - The target player.
        Returns:
        The predicted step-by-step path.
      • getActorPath

        public static java.util.List<net.runelite.api.coords.WorldPoint> getActorPath​(net.runelite.api.Actor actor,
                                                                                      net.runelite.api.coords.WorldPoint destination)
        Computes the movement path an actor would take towards a destination tile using local collision data. The returned list does not include the actor's current tile.
        Parameters:
        actor - The source actor.
        destination - The destination world tile.
        Returns:
        The predicted step-by-step path.
      • getActorPathUntilLineOfSight

        public static java.util.List<net.runelite.api.coords.WorldPoint> getActorPathUntilLineOfSight​(net.runelite.api.NPC npc)
        Computes the movement path an NPC would take towards the local player and truncates it at the first tile where the NPC gains line of sight to the player.
        Parameters:
        npc - The source NPC.
        Returns:
        Path steps up to and including the first line-of-sight tile. Returns an empty list when line of sight is already available from the NPC's current tile.
      • getActorPathUntilLineOfSight

        public static java.util.List<net.runelite.api.coords.WorldPoint> getActorPathUntilLineOfSight​(net.runelite.api.NPC npc,
                                                                                                      net.runelite.api.Player player)
        Computes the movement path an NPC would take towards a target player and truncates it at the first tile where the NPC gains line of sight to that player.
        Parameters:
        npc - The source NPC.
        player - The target player.
        Returns:
        Path steps up to and including the first line-of-sight tile. Returns an empty list when line of sight is already available from the NPC's current tile.
      • getActorLineOfSightTerminationTile

        public static net.runelite.api.coords.WorldPoint getActorLineOfSightTerminationTile​(net.runelite.api.NPC npc)
        Finds the tile where an NPC path would terminate once the NPC has line of sight to the local player. If line of sight is already available, the NPC's current tile is returned.
        Parameters:
        npc - The source NPC.
        Returns:
        The termination tile, or null when inputs are invalid.
      • getActorLineOfSightTerminationTile

        public static net.runelite.api.coords.WorldPoint getActorLineOfSightTerminationTile​(net.runelite.api.NPC npc,
                                                                                            net.runelite.api.Player player)
        Finds the tile where an NPC path would terminate once the NPC has line of sight to the target player. If line of sight is already available, the NPC's current tile is returned.
        Parameters:
        npc - The source NPC.
        player - The target player.
        Returns:
        The termination tile, or null when inputs are invalid.
      • hasLineOfSightTo

        public static boolean hasLineOfSightTo​(net.runelite.api.coords.WorldPoint source,
                                               net.runelite.api.coords.WorldPoint other)
        Checks if there is a clear line of sight between two world points.
        Parameters:
        source - The starting WorldPoint.
        other - The target WorldPoint.
        Returns:
        True if there is an unobstructed line of sight, false otherwise.
      • hasLineOfSightTo

        public static boolean hasLineOfSightTo​(net.runelite.api.Tile source,
                                               net.runelite.api.Tile other)
        Checks if there is a clear line of sight between two scene tiles. Automatically dispatches to the client thread to safely access collision maps.
        Parameters:
        source - The starting Tile.
        other - The target Tile.
        Returns:
        True if there is an unobstructed line of sight, false otherwise.
      • getLineOfSightTiles

        public static java.util.List<net.runelite.api.coords.WorldPoint> getLineOfSightTiles​(net.runelite.api.NPC npc,
                                                                                             int range)
        Retrieves a list of all tiles within a specified radius that an NPC currently has line of sight to.
        Parameters:
        npc - The source NPC.
        range - The radius to check for visible tiles.
        Returns:
        A list of WorldPoints representing visible tiles. Returns an empty list if none are found.