Remove a useless function in AttackDetection. Accepted by wraitii.

Differential Revision: https://code.wildfiregames.com/D68
This was SVN commit r19147.
This commit is contained in:
fatherbushido 2017-01-16 12:19:38 +00:00
parent 0a6a42321d
commit 03ecf8508f

View file

@ -96,7 +96,7 @@ AttackDetection.prototype.AttackAlert = function(target, attacker, attackerOwner
// If the new attack is within suppression distance of this element,
// then check if the element should be updated and return
var dist = SquaredDistance(element.position, event.position);
var dist = element.position.horizDistanceToSquared(event.position);
if (dist >= this.suppressionRangeSquared)
continue;
@ -157,12 +157,4 @@ AttackDetection.prototype.GetIncomingAttacks = function()
return this.suppressedList;
};
// Utility function for calculating the squared-distance between two attack events
function SquaredDistance(pos1, pos2)
{
var xs = pos2.x - pos1.x;
var zs = pos2.z - pos1.z;
return xs*xs + zs*zs;
}
Engine.RegisterComponentType(IID_AttackDetection, "AttackDetection", AttackDetection);