Obelisk improvements

Made the wilderness teleport obelisks roll the destination obelisk fairly
Improved obelisk teleport positioning logic
Made the obelisk teleport capture a 3-by-3 bounding box of players, in accordance with the teleport animation
This commit is contained in:
Player Name
2023-08-17 12:55:32 +00:00
committed by Ryan
parent 11ebc0c0c4
commit 162cfe3d6b
2 changed files with 43 additions and 15 deletions
@@ -756,6 +756,31 @@ object RegionManager {
return players
}
/**
* Gets a list of local players within a symmetric bounding box.
* @param l The location.
* @param xdist The distance from the location on the x plane that is considered within bounds.
* @param ydist The distance from the location on the y plane that is considered within bounds.
* @return The list of players.
*/
@JvmStatic
fun getLocalPlayersBoundingBox(l: Location, xdist: Int, ydist: Int): MutableList<Player> {
val players: MutableList<Player> = LinkedList()
for (regionX in ((l.regionX - 6) shr 3)..((l.regionX + 6) shr 3)) {
for (regionY in ((l.regionY - 6) shr 3)..((l.regionY + 6) shr 3)) {
for (player in forId((regionX shl 8) or regionY).planes[l.z].players) {
if (player.location.x >= l.getX() - xdist &&
player.location.x <= l.getX() + xdist &&
player.location.y >= l.getY() - ydist &&
player.location.y <= l.getY() + ydist) {
players.add(player)
}
}
}
}
return players
}
/**
* Gets a list of local players.
* @param l The location.