Merge branch 'master' of git://github.com/beedee/OpenRA

This commit is contained in:
Bob
2009-12-10 00:41:51 +13:00

View File

@@ -13,9 +13,10 @@ namespace OpenRa.Game.Traits
{
var attack = self.traits.WithInterface<AttackBase>().First();
if (attack.target == null)
attack.target = ChooseTarget(self,
Rules.WeaponInfo[self.Info.Primary].Range);
var range = Rules.WeaponInfo[self.Info.Primary].Range;
if (attack.target == null ||
(attack.target.Location - self.Location).LengthSquared > range * range + 2)
attack.target = ChooseTarget(self, range);
}
Actor ChooseTarget(Actor self, float range)