diff --git a/Server/src/main/core/game/bots/ScriptAPI.kt b/Server/src/main/core/game/bots/ScriptAPI.kt index 42c955d04..4400f66e5 100644 --- a/Server/src/main/core/game/bots/ScriptAPI.kt +++ b/Server/src/main/core/game/bots/ScriptAPI.kt @@ -369,7 +369,7 @@ class ScriptAPI(private val bot: Player) { val norm = vec.normalized() val tiles = kotlin.math.min(kotlin.math.floor(vec.magnitude()).toInt(), ServerConstants.MAX_PATHFIND_DISTANCE - 1) val loc = bot.location.transform(norm * tiles) - Pathfinder.find(bot, loc).walk(bot) + bot.pulseManager.run(object : MovementPulse(bot, loc) { override fun pulse() : Boolean { return true } }) } /** diff --git a/Server/src/main/core/game/interaction/MovementPulse.java b/Server/src/main/core/game/interaction/MovementPulse.java index 647d6e86f..92a36b028 100644 --- a/Server/src/main/core/game/interaction/MovementPulse.java +++ b/Server/src/main/core/game/interaction/MovementPulse.java @@ -78,6 +78,8 @@ public abstract class MovementPulse extends Pulse { private Function2 overrideMethod; + private Location previousLoc; + /** * Constructs a new {@code MovementPulse} {@code Object}. * @@ -265,6 +267,9 @@ public abstract class MovementPulse extends Pulse { } } + if (loc == previousLoc) + return; + if (destination == null) { return; } @@ -330,6 +335,7 @@ public abstract class MovementPulse extends Pulse { } } } + previousLoc = loc; } last = destination.getLocation(); }