From f93b1ce30ed716e9739ee20e0d90180245254e92 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Tue, 27 Aug 2024 19:43:31 -0500 Subject: [PATCH] teleport to runegate power action fix for closest gate --- .../powers/poweractions/RunegateTeleportPowerAction.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/engine/powers/poweractions/RunegateTeleportPowerAction.java b/src/engine/powers/poweractions/RunegateTeleportPowerAction.java index 09416a86..8f4753f1 100644 --- a/src/engine/powers/poweractions/RunegateTeleportPowerAction.java +++ b/src/engine/powers/poweractions/RunegateTeleportPowerAction.java @@ -45,13 +45,10 @@ public class RunegateTeleportPowerAction extends AbstractPowerAction { Vector3fImmutable rgLoc; for (Runegate runegate : Runegate._runegates.values()) { - rgLoc = runegate.gateBuilding.getLoc(); - - float distanceToRunegateSquared = source.getLoc().distanceSquared2D(rgLoc); - - if (distanceToRunegateSquared < sqr(dist)) { - dist = sqrt(distanceToRunegateSquared); + float disToGate = source.getLoc().distanceSquared2D(rgLoc); + if(disToGate < dist){ + dist = disToGate; rg = runegate.gateBuilding; } }