1package com.runehive.game.world.pathfinding.path.impl;
3import com.runehive.game.world.Interactable;
4import com.runehive.game.world.entity.mob.Direction;
5import com.runehive.game.world.entity.mob.Mob;
6import com.runehive.game.world.pathfinding.path.Path;
7import com.runehive.game.world.pathfinding.path.PathFinder;
8import com.runehive.game.world.position.Position;
9import com.runehive.game.world.region.Region;
10import com.runehive.util.Utility;
12import java.util.ArrayDeque;
13import java.util.Deque;
15import static com.runehive.game.world.entity.mob.Direction.NONE;
16import static com.runehive.game.world.entity.mob.Direction.getDirection;
37 Deque<Position> positions =
new ArrayDeque<>(approximation);
38 return new Path(
addWalks(source, end, targetWidth, targetLength, positions));
50 private Deque<Position>
addWalks(
Mob source,
Position target,
int targetWidth,
int targetLength, Deque<Position> positions) {
55 if (targetWidth > 0 || targetLength > 0)
61 Direction direction = getDirection(current, target);
63 if (!
traversable(source, current, targInt, direction, projectiles)) {
96 if (direction == NONE)
100 positions.addLast(current);
boolean pathfinderProjectiles
An algorithm used to find a path between two Positions.
boolean projectileCheck(Position current, Position going)
Returns whether or not a Position shooting projectile to another Position would lead to is traversabl...
Represents a single path in the path finding system.
Represents a simple path finder which determines a straight path to the first blocked tile or it's de...
Path find(Mob source, Position end, int targetWidth, int targetLength)
A default method to find a path for the specified position.
boolean traversable(Mob source, Position current, Interactable target, Direction direction, boolean projectiles)
Deque< Position > addWalks(Mob source, Position target, int targetWidth, int targetLength, Deque< Position > positions)
Performs the path finding calculations to find the path using the A* algorithm.
Represents a single tile on the game world.
int getLongestDelta(Position other)
Gets the longest horizontal or vertical delta between the two positions.
Position transform(int diffX, int diffY, int diffZ)
Creates a new location based on this location.
Represents a single region.
static boolean reachable(Interactable source, Interactable target)
Handles miscellaneous methods.
static boolean inside(Interactable source, Interactable target)
static Position findBestInside(Interactable source, Interactable target)
Represents the enumerated directions an entity can walk or face.
Position getFaceLocation()
An object implementing Interactable has uses.
static Interactable create(Position position)
Creates a new instance of an Interactable.