Define plumbing to pass initial target positions to inner move activities.
This commit is contained in:
@@ -24,7 +24,8 @@ namespace OpenRA.Mods.Common.Activities
|
||||
readonly IMove move;
|
||||
readonly Color? targetLineColor;
|
||||
|
||||
public Follow(Actor self, Target target, WDist minRange, WDist maxRange, Color? targetLineColor = null)
|
||||
public Follow(Actor self, Target target, WDist minRange, WDist maxRange,
|
||||
WPos? initialTargetPosition, Color? targetLineColor = null)
|
||||
{
|
||||
this.target = target;
|
||||
this.minRange = minRange;
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
Activity inner;
|
||||
bool repath;
|
||||
|
||||
public MoveAdjacentTo(Actor self, Target target, Color? targetLineColor = null)
|
||||
public MoveAdjacentTo(Actor self, Target target, WPos? initialTargetPosition = null, Color? targetLineColor = null)
|
||||
{
|
||||
Target = target;
|
||||
|
||||
@@ -56,7 +56,9 @@ namespace OpenRA.Mods.Common.Activities
|
||||
pathFinder = self.World.WorldActor.Trait<IPathFinder>();
|
||||
domainIndex = self.World.WorldActor.Trait<DomainIndex>();
|
||||
|
||||
if (target.IsValidFor(self))
|
||||
if (initialTargetPosition.HasValue)
|
||||
targetPosition = self.World.Map.CellContaining(initialTargetPosition.Value);
|
||||
else if (target.IsValidFor(self) && target.Actor.CanBeViewedByPlayer(self.Owner))
|
||||
targetPosition = self.World.Map.CellContaining(target.CenterPosition);
|
||||
|
||||
repath = true;
|
||||
|
||||
@@ -21,8 +21,9 @@ namespace OpenRA.Mods.Common.Activities
|
||||
readonly WDist maxRange;
|
||||
readonly WDist minRange;
|
||||
|
||||
public MoveWithinRange(Actor self, Target target, WDist minRange, WDist maxRange, Color? targetLineColor = null)
|
||||
: base(self, target, targetLineColor)
|
||||
public MoveWithinRange(Actor self, Target target, WDist minRange, WDist maxRange,
|
||||
WPos? initialTargetPosition = null, Color? targetLineColor = null)
|
||||
: base(self, target, initialTargetPosition, targetLineColor)
|
||||
{
|
||||
this.minRange = minRange;
|
||||
this.maxRange = maxRange;
|
||||
|
||||
Reference in New Issue
Block a user