Refactored movement pulse

Fixed bug with Vinesweeper gnomes not checking flags
Fixed hunter tracking
This commit is contained in:
Ceikry
2023-06-29 01:46:00 +00:00
committed by Ryan
parent da33c89a70
commit 06e8279f2a
13 changed files with 192 additions and 121 deletions
+16
View File
@@ -1099,6 +1099,22 @@ fun forceWalk(entity: Entity, dest: Location, type: String) {
path.walk(entity)
}
/**
* Returns a location truncated to the appropriate pathfinding limit
**/
fun truncateLoc (mover: Entity, destination: Location) : Pair<Boolean,Location> {
val vector = Vector.betweenLocs(mover.location, destination)
val normVec = vector.normalized()
val mag = vector.magnitude()
var multiplier = if (mover is NPC) 14.0 else ServerConstants.MAX_PATHFIND_DISTANCE.toDouble()
var clampedMultiplier = min(multiplier, mag)
var truncated = multiplier == clampedMultiplier
return Pair(truncated, mover.location.transform(normVec * clampedMultiplier))
}
/**
* Force a player to move from the start location to the dest location
* @param player the player we are moving