From 9bc9ddd0ce0ebc36a9e492725e30aebf105d64ce Mon Sep 17 00:00:00 2001 From: Major- Date: Fri, 8 Aug 2014 03:43:44 +0100 Subject: [PATCH] Cheaply prevent distanced action from executing when the mob is within the required distance but on the wrong side. --- src/org/apollo/game/action/DistancedAction.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/org/apollo/game/action/DistancedAction.java b/src/org/apollo/game/action/DistancedAction.java index 5beae597..5b599c33 100644 --- a/src/org/apollo/game/action/DistancedAction.java +++ b/src/org/apollo/game/action/DistancedAction.java @@ -58,8 +58,9 @@ public abstract class DistancedAction extends Action { if (reached) { // 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 - executeAction(); - } else if (mob.getPosition().getDistance(position) <= distance) { + executeAction(); // TODO checking the walking queue size is a really cheap fix, and relies on the client not + // being edited... this class needs to be completely re-written. + } else if (mob.getPosition().getDistance(position) <= distance && mob.getWalkingQueue().size() == 0) { reached = true; setDelay(delay); if (immediate) { @@ -71,6 +72,6 @@ public abstract class DistancedAction extends Action { /** * Executes the actual action. Called when the distance requirement is met. */ - public abstract void executeAction(); + protected abstract void executeAction(); } \ No newline at end of file