Merge pull request #13020 from abcdefg30/airHunt

Fixed aircraft not being able to hunt
This commit is contained in:
Oliver Brakmann
2017-04-02 21:40:34 +02:00
committed by GitHub

View File

@@ -20,9 +20,11 @@ namespace OpenRA.Mods.Common.Activities
public class Hunt : Activity public class Hunt : Activity
{ {
readonly IEnumerable<Actor> targets; readonly IEnumerable<Actor> targets;
readonly IMove move;
public Hunt(Actor self) public Hunt(Actor self)
{ {
move = self.Trait<IMove>();
var attack = self.Trait<AttackBase>(); var attack = self.Trait<AttackBase>();
targets = self.World.ActorsHavingTrait<Huntable>().Where( targets = self.World.ActorsHavingTrait<Huntable>().Where(
a => self != a && !a.IsDead && a.IsInWorld && a.AppearsHostileTo(self) a => self != a && !a.IsDead && a.IsInWorld && a.AppearsHostileTo(self)
@@ -39,7 +41,7 @@ namespace OpenRA.Mods.Common.Activities
return this; return this;
return ActivityUtils.SequenceActivities( return ActivityUtils.SequenceActivities(
new AttackMoveActivity(self, new Move(self, target.Location, WDist.FromCells(2))), new AttackMoveActivity(self, move.MoveTo(target.Location, 2)),
new Wait(25), new Wait(25),
this); this);
} }