Don't calculate range when it is unused

This commit is contained in:
Gustas
2022-11-29 21:41:36 +02:00
committed by Pavel Penev
parent 813d48dd70
commit 1edf313090

View File

@@ -92,8 +92,7 @@ namespace OpenRA.Mods.Common.Activities
}
// Wait until we are near the target before we try to lock it
var distSq = (cargo.CenterPosition - self.CenterPosition).HorizontalLengthSquared;
if (state == PickupState.Intercept && distSq <= targetLockRange.LengthSquared)
if (state == PickupState.Intercept && (cargo.CenterPosition - self.CenterPosition).HorizontalLengthSquared <= targetLockRange.LengthSquared)
state = PickupState.LockCarryable;
if (state == PickupState.LockCarryable)