Final touches

This commit is contained in:
ceikry 2023-04-22 09:14:57 -05:00
parent 6e77e0cb60
commit 0228ddfa46
2 changed files with 7 additions and 1 deletions

View file

@ -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 } })
}
/**

View file

@ -78,6 +78,8 @@ public abstract class MovementPulse extends Pulse {
private Function2<Entity,Node,Location> 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();
}