Class Destination
java.lang.Object
privbot.mechanics.Destination
A place to travel to: a name, a tile, how close counts as "there", and optionally a teleport to try first.
Immutable; pure (no game reads), safe on any thread.
What it proves: contains(net.runelite.api.coords.WorldPoint) is true only when the point is on the same plane as the tile and within
radius tiles of it (square, Chebyshev distance). That is the only meaning of "arrived" in
ctx.travel.go: a teleport that lands somewhere else is not arrival.
Unreadable looks like: a null point is never inside.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Destinationbooleancontains(net.runelite.api.coords.WorldPoint p) intdistance(net.runelite.api.coords.WorldPoint p) name()intradius()teleport()net.runelite.api.coords.WorldPointtile()toString()viaTeleport(String teleportName)
-
Method Details
-
at
- Parameters:
name- a plain-words name used in job reasons; blank becomes the tiletile- the centre of the placeradius- how many tiles from the centre still count as there (0 means the exact tile)- Returns:
- a destination with no teleport
-
viaTeleport
- Parameters:
teleportName- the teleport to try once when the player starts far away, asctx.teleports.tonames it; null or blank clears it- Returns:
- a copy that tries that teleport first
-
name
- Returns:
- the name used in reasons
-
tile
public net.runelite.api.coords.WorldPoint tile()- Returns:
- the centre tile
-
radius
public int radius()- Returns:
- the arrival radius in tiles
-
teleport
- Returns:
- the teleport to try first, or null
-
contains
public boolean contains(net.runelite.api.coords.WorldPoint p) - Parameters:
p- a tile, or null- Returns:
- true when
pis on the same plane and within the radius; false for null
-
distance
public int distance(net.runelite.api.coords.WorldPoint p) - Parameters:
p- a tile, or null- Returns:
- the Chebyshev distance to the centre, or
Integer.MAX_VALUEon another plane or for null
-
toString
-