mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-19 23:03:56 -07:00
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:
parent
0a6a42321d
commit
03ecf8508f
1 changed files with 1 additions and 9 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue