Browse Source

teleport to runegate power action fix for closest gate

lakebane-strongholds
FatBoy-DOTC 4 months ago
parent
commit
f93b1ce30e
  1. 9
      src/engine/powers/poweractions/RunegateTeleportPowerAction.java

9
src/engine/powers/poweractions/RunegateTeleportPowerAction.java

@ -45,13 +45,10 @@ public class RunegateTeleportPowerAction extends AbstractPowerAction {
Vector3fImmutable rgLoc; Vector3fImmutable rgLoc;
for (Runegate runegate : Runegate._runegates.values()) { for (Runegate runegate : Runegate._runegates.values()) {
rgLoc = runegate.gateBuilding.getLoc(); rgLoc = runegate.gateBuilding.getLoc();
float disToGate = source.getLoc().distanceSquared2D(rgLoc);
float distanceToRunegateSquared = source.getLoc().distanceSquared2D(rgLoc); if(disToGate < dist){
dist = disToGate;
if (distanceToRunegateSquared < sqr(dist)) {
dist = sqrt(distanceToRunegateSquared);
rg = runegate.gateBuilding; rg = runegate.gateBuilding;
} }
} }

Loading…
Cancel
Save