Explicitly implement interfaces in AttackBase.

This commit is contained in:
Paul Chote
2017-05-28 14:41:01 +01:00
committed by atlimit8
parent 34844e87a3
commit 45b13dabfb
3 changed files with 18 additions and 14 deletions

View File

@@ -82,11 +82,12 @@ namespace OpenRA.Mods.D2k.Traits
// If close enough, we don't care about other actors.
var target = self.World.FindActorsInCircle(self.CenterPosition, WormInfo.IgnoreNoiseAttackRange)
.FirstOrDefault(x => attackTrait.HasAnyValidWeapons(Target.FromActor(x)));
if (target != null)
.Select(t => Target.FromActor(t))
.FirstOrDefault(t => attackTrait.HasAnyValidWeapons(t));
if (target.Type == TargetType.Actor)
{
self.CancelActivity();
attackTrait.ResolveOrder(self, new Order("Attack", target, true) { TargetActor = target });
attackTrait.AttackTarget(target, false, true, false);
return;
}