Package com.kraken.api.simulation
Class SimulationSnapshot
- java.lang.Object
-
- com.kraken.api.simulation.SimulationSnapshot
-
public final class SimulationSnapshot extends java.lang.ObjectImmutable RuneLite-compatible snapshot used as the root input for fast simulations.
-
-
Constructor Summary
Constructors Constructor Description SimulationSnapshot(int gameTick, int plane, int baseX, int baseY, int[][] collisionFlags, @NonNull net.runelite.api.coords.WorldPoint playerWorldPoint, java.util.List<SimulationNpcSnapshot> npcs)Creates an immutable snapshot used to seed one or more simulation states.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int[][]copyCollisionFlags()SimulationStatecreateState()Creates a mutable simulation state initialized from this snapshot.intgetCollisionFlagAtScene(int sceneX, int sceneY)Reads a collision flag by scene coordinate.intgetCollisionFlagAtWorld(int worldX, int worldY)Reads a collision flag by world coordinate.intgetSceneHeight()intgetSceneWidth()booleanisSceneInBounds(int sceneX, int sceneY)Checks whether the provided scene coordinates are inside the captured collision grid.booleanisWorldInBounds(int worldX, int worldY)Checks whether a world tile is inside the captured scene bounds.
-
-
-
Constructor Detail
-
SimulationSnapshot
public SimulationSnapshot(int gameTick, int plane, int baseX, int baseY, int[][] collisionFlags, @NonNull @NonNull net.runelite.api.coords.WorldPoint playerWorldPoint, java.util.List<SimulationNpcSnapshot> npcs)Creates an immutable snapshot used to seed one or more simulation states.- Parameters:
gameTick- RuneLite client tick at capture time.plane- active scene plane.baseX- world-view base x.baseY- world-view base y.collisionFlags- copied scene collision flags indexed by [sceneX][sceneY].playerWorldPoint- local player world position at capture time.npcs- captured NPC snapshots.
-
-
Method Detail
-
getSceneWidth
public int getSceneWidth()
- Returns:
- scene width in tiles.
-
getSceneHeight
public int getSceneHeight()
- Returns:
- scene height in tiles.
-
isSceneInBounds
public boolean isSceneInBounds(int sceneX, int sceneY)Checks whether the provided scene coordinates are inside the captured collision grid.- Parameters:
sceneX- scene x coordinate.sceneY- scene y coordinate.- Returns:
- true when in bounds.
-
isWorldInBounds
public boolean isWorldInBounds(int worldX, int worldY)Checks whether a world tile is inside the captured scene bounds.- Parameters:
worldX- world x coordinate.worldY- world y coordinate.- Returns:
- true when in bounds.
-
getCollisionFlagAtScene
public int getCollisionFlagAtScene(int sceneX, int sceneY)Reads a collision flag by scene coordinate.- Parameters:
sceneX- scene x coordinate.sceneY- scene y coordinate.- Returns:
- collision flags, or
0when out of bounds.
-
getCollisionFlagAtWorld
public int getCollisionFlagAtWorld(int worldX, int worldY)Reads a collision flag by world coordinate.- Parameters:
worldX- world x coordinate.worldY- world y coordinate.- Returns:
- collision flags, or
0when out of bounds.
-
copyCollisionFlags
public int[][] copyCollisionFlags()
- Returns:
- deep copy of the captured collision flags.
-
createState
public SimulationState createState()
Creates a mutable simulation state initialized from this snapshot.- Returns:
- simulation state rooted at this snapshot.
-
-