Define plumbing to pass initial target positions to inner move activities.

This commit is contained in:
Paul Chote
2019-01-16 11:06:58 +00:00
parent b2d960ec19
commit 2080c72ab9
10 changed files with 70 additions and 40 deletions

View File

@@ -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;