Class Collision

java.lang.Object
dev.twilite.game.navigation.Collision

public class Collision extends Object
Local collision and reachability helpers for the currently loaded scene.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    reachable(Coord destination)
    Returns whether destination is reachable from the local player using only loaded local-world collision.
    static boolean
    reachable(Coord destination, Collection<Coord> dangerous, Collection<Coord> impassible)
    Returns whether destination is reachable while avoiding dangerous and impassible tiles.
    static boolean
    reachable(Coord destination, Collection<Coord> dangerous, Collection<Coord> impassible, Collection<Coord> walkable)
    Returns whether destination is reachable within walkable, while avoiding dangerous and impassible tiles.
    static boolean
    Returns whether unit can be reached from the local player using only loaded local-world collision.
    static boolean
    reachable(Unit unit, Collection<Coord> dangerous, Collection<Coord> impassible)
    Returns whether unit is reachable while avoiding dangerous and impassible tiles.
    static boolean
    reachable(Unit unit, Collection<Coord> dangerous, Collection<Coord> impassible, Collection<Coord> walkable)
    Returns whether unit is reachable within walkable, while avoiding dangerous and impassible tiles.
    static boolean
    Returns whether object can be interacted with from a reachable tile.
    static boolean
    reachableWithin(Coord destination, int maxDistance)
    Returns whether destination is reachable within maxDistance local movement steps.
    static boolean
    reachableWithin(Unit unit, int maxDistance)
    Returns whether unit is reachable within maxDistance local movement steps.

    Methods inherited from class java.lang.Object

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

    • Collision

      public Collision()
  • Method Details

    • reachable

      public static boolean reachable(Coord destination)
      Returns whether destination is reachable from the local player using only loaded local-world collision.
    • reachableWithin

      public static boolean reachableWithin(Coord destination, int maxDistance)
      Returns whether destination is reachable within maxDistance local movement steps.
    • reachableWithin

      public static boolean reachableWithin(Unit unit, int maxDistance)
      Returns whether unit is reachable within maxDistance local movement steps.
    • reachable

      public static boolean reachable(Coord destination, Collection<Coord> dangerous, Collection<Coord> impassible)
      Returns whether destination is reachable while avoiding dangerous and impassible tiles.

      Dangerous tiles are physically walkable tiles that should be avoided, such as temporary hazard or damage tiles. Impassible tiles are additional hard blockers that should be treated as unwalkable even if collision allows them.

    • reachable

      public static boolean reachable(Coord destination, Collection<Coord> dangerous, Collection<Coord> impassible, Collection<Coord> walkable)
      Returns whether destination is reachable within walkable, while avoiding dangerous and impassible tiles.

      Dangerous tiles are physically walkable tiles that should be avoided, such as temporary hazard or damage tiles. Impassible tiles are additional hard blockers that should be treated as unwalkable even if collision allows them. Walkable tiles restrict the search space; tiles outside this collection are not considered.

    • reachable

      public static boolean reachable(Unit unit)
      Returns whether unit can be reached from the local player using only loaded local-world collision.
    • reachable

      public static boolean reachable(SceneObject object)
      Returns whether object can be interacted with from a reachable tile.
    • reachable

      public static boolean reachable(Unit unit, Collection<Coord> dangerous, Collection<Coord> impassible)
      Returns whether unit is reachable while avoiding dangerous and impassible tiles.

      Dangerous tiles are physically walkable tiles that should be avoided, such as temporary hazard or damage tiles. Impassible tiles are additional hard blockers that should be treated as unwalkable even if collision allows them.

    • reachable

      public static boolean reachable(Unit unit, Collection<Coord> dangerous, Collection<Coord> impassible, Collection<Coord> walkable)
      Returns whether unit is reachable within walkable, while avoiding dangerous and impassible tiles.

      Dangerous tiles are physically walkable tiles that should be avoided, such as temporary hazard or damage tiles. Impassible tiles are additional hard blockers that should be treated as unwalkable even if collision allows them. Walkable tiles restrict the search space; tiles outside this collection are not considered.