mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-04 16:49:11 +00:00
Cheaply prevent distanced action from executing when the mob is within the required distance but on the wrong side.
This commit is contained in:
@@ -58,8 +58,9 @@ public abstract class DistancedAction<T extends Mob> extends Action<T> {
|
|||||||
if (reached) {
|
if (reached) {
|
||||||
// some actions (e.g. agility) will cause the player to move away again
|
// some actions (e.g. agility) will cause the player to move away again
|
||||||
// so we don't check once the player got close enough once
|
// so we don't check once the player got close enough once
|
||||||
executeAction();
|
executeAction(); // TODO checking the walking queue size is a really cheap fix, and relies on the client not
|
||||||
} else if (mob.getPosition().getDistance(position) <= distance) {
|
// being edited... this class needs to be completely re-written.
|
||||||
|
} else if (mob.getPosition().getDistance(position) <= distance && mob.getWalkingQueue().size() == 0) {
|
||||||
reached = true;
|
reached = true;
|
||||||
setDelay(delay);
|
setDelay(delay);
|
||||||
if (immediate) {
|
if (immediate) {
|
||||||
@@ -71,6 +72,6 @@ public abstract class DistancedAction<T extends Mob> extends Action<T> {
|
|||||||
/**
|
/**
|
||||||
* Executes the actual action. Called when the distance requirement is met.
|
* Executes the actual action. Called when the distance requirement is met.
|
||||||
*/
|
*/
|
||||||
public abstract void executeAction();
|
protected abstract void executeAction();
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user