Class HazardMap
java.lang.Object
privbot.mechanics.HazardMap
The tiles that hurt right now: timed ones (a graphic or a telegraphed attack that lasts a few ticks) and
persistent ones (ground the fight never lets you stand on). Mutable, single-owner.
What it proves: only what the caller told it. It never reads the scene; "dangerous" means "someone added this
tile and it has not expired at nowTick". A timed tile is dangerous while nowTick < addTick + ttl.
Unreadable looks like: a null tile is ignored on every write and is never dangerous. A tile the caller could not read is simply not added; the map cannot tell "safe" from "never reported".
Thread rule: not thread safe. Use it from the one thread that handles the game tick, and pass that tick in.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intHow longadd(WorldPoint, int)keeps a tile dangerous: two ticks. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(net.runelite.api.coords.WorldPoint tile, int nowTick) voidadd(net.runelite.api.coords.WorldPoint tile, int nowTick, int ttlTicks) Markstiledangerous untilnowTick + ttlTicks(exclusive).voidaddPersistent(net.runelite.api.coords.WorldPoint tile) voidclear()Forgets everything, timed and persistent.booleandangerous(net.runelite.api.coords.WorldPoint tile, int nowTick) True whentileis persistent, or timed and not yet expired atnowTick.voidprune(int nowTick) Drops timed tiles that have expired atnowTick.voidremove(net.runelite.api.coords.WorldPoint tile) Forgets a timed tile.voidremovePersistent(net.runelite.api.coords.WorldPoint tile) Forgets a persistent tile.Set<net.runelite.api.coords.WorldPoint> tiles(int nowTick) A copy of every tile that is dangerous atnowTick.
-
Field Details
-
DEFAULT_TTL_TICKS
public static final int DEFAULT_TTL_TICKSHow longadd(WorldPoint, int)keeps a tile dangerous: two ticks.- See Also:
-
-
Constructor Details
-
HazardMap
public HazardMap()
-
-
Method Details
-
add
public void add(net.runelite.api.coords.WorldPoint tile, int nowTick) -
add
public void add(net.runelite.api.coords.WorldPoint tile, int nowTick, int ttlTicks) Markstiledangerous untilnowTick + ttlTicks(exclusive). A second add replaces the first. -
addPersistent
public void addPersistent(net.runelite.api.coords.WorldPoint tile) -
remove
public void remove(net.runelite.api.coords.WorldPoint tile) Forgets a timed tile. A persistent entry for the same tile stays. -
removePersistent
public void removePersistent(net.runelite.api.coords.WorldPoint tile) Forgets a persistent tile. A timed entry for the same tile stays. -
dangerous
public boolean dangerous(net.runelite.api.coords.WorldPoint tile, int nowTick) True whentileis persistent, or timed and not yet expired atnowTick. -
tiles
A copy of every tile that is dangerous atnowTick. -
prune
public void prune(int nowTick) Drops timed tiles that have expired atnowTick. Persistent tiles stay. -
clear
public void clear()Forgets everything, timed and persistent.
-