mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-03 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) {
|
||||
// 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<T extends Mob> extends Action<T> {
|
||||
/**
|
||||
* 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