Add MinRange plumbing to attack activities.
This commit is contained in:
@@ -25,13 +25,10 @@ namespace OpenRA.Mods.RA.Activities
|
||||
const int delayBetweenPathingAttempts = 20;
|
||||
const int delaySpread = 5;
|
||||
|
||||
public Attack(Target target, WRange range)
|
||||
: this(target, range, true) {}
|
||||
|
||||
public Attack(Target target, WRange range, bool allowMovement)
|
||||
public Attack(Actor self, Target target, WRange minRange, WRange maxRange, bool allowMovement)
|
||||
{
|
||||
Target = target;
|
||||
Range = range;
|
||||
Range = maxRange;
|
||||
AllowMovement = allowMovement;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,13 +17,15 @@ namespace OpenRA.Mods.RA.Activities
|
||||
{
|
||||
Target target;
|
||||
Plane plane;
|
||||
WRange range;
|
||||
WRange minRange;
|
||||
WRange maxRange;
|
||||
|
||||
public FlyFollow(Actor self, Target target, WRange range)
|
||||
public FlyFollow(Actor self, Target target, WRange minRange, WRange maxRange)
|
||||
{
|
||||
this.target = target;
|
||||
plane = self.Trait<Plane>();
|
||||
this.range = range;
|
||||
this.minRange = minRange;
|
||||
this.maxRange = maxRange;
|
||||
}
|
||||
|
||||
public override Activity Tick(Actor self)
|
||||
@@ -31,13 +33,13 @@ namespace OpenRA.Mods.RA.Activities
|
||||
if (IsCanceled || !target.IsValidFor(self))
|
||||
return NextActivity;
|
||||
|
||||
if (target.IsInRange(self.CenterPosition, range))
|
||||
if (target.IsInRange(self.CenterPosition, maxRange) && !target.IsInRange(self.CenterPosition, minRange))
|
||||
{
|
||||
Fly.FlyToward(self, plane, plane.Facing, plane.Info.CruiseAltitude);
|
||||
return this;
|
||||
}
|
||||
|
||||
return Util.SequenceActivities(new Fly(self, target, WRange.Zero, range), this);
|
||||
return Util.SequenceActivities(new Fly(self, target, minRange, maxRange), this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,11 +22,11 @@ namespace OpenRA.Mods.RA.Activities
|
||||
const int delayBetweenPathingAttempts = 20;
|
||||
const int delaySpread = 5;
|
||||
|
||||
public Follow(Actor self, Target target, WRange range)
|
||||
public Follow(Actor self, Target target, WRange minRange, WRange maxRange)
|
||||
{
|
||||
this.target = target;
|
||||
move = self.Trait<IMove>();
|
||||
this.range = range;
|
||||
this.range = maxRange;
|
||||
}
|
||||
|
||||
public override Activity Tick(Actor self)
|
||||
|
||||
@@ -12,11 +12,10 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Activities
|
||||
{
|
||||
/* non-turreted attack */
|
||||
public class Heal : Attack
|
||||
{
|
||||
public Heal(Target target, WRange range, bool allowMovement)
|
||||
: base(target, range, allowMovement) { }
|
||||
public Heal(Actor self, Target target, WRange minRange, WRange maxRange, bool allowMovement)
|
||||
: base(self, target, minRange, maxRange, allowMovement) { }
|
||||
|
||||
protected override Activity InnerTick(Actor self, AttackBase attack)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user