diff --git a/OpenRA.Mods.Cnc/Activities/LayMines.cs b/OpenRA.Mods.Cnc/Activities/LayMines.cs index 87b308ddfa..43699d4827 100644 --- a/OpenRA.Mods.Cnc/Activities/LayMines.cs +++ b/OpenRA.Mods.Cnc/Activities/LayMines.cs @@ -77,7 +77,7 @@ namespace OpenRA.Mods.Cnc.Activities // Add a CloseEnough range of 512 to the Rearm/Repair activities in order to ensure that we're at the host actor QueueChild(new MoveAdjacentTo(self, Target.FromActor(rearmTarget))); - QueueChild(movement.MoveTo(self.World.Map.CellContaining(rearmTarget.CenterPosition), rearmTarget)); + QueueChild(movement.MoveTo(self.World.Map.CellContaining(rearmTarget.CenterPosition), ignoreActor: rearmTarget)); QueueChild(new Resupply(self, rearmTarget, new WDist(512))); returnToBase = true; return false; diff --git a/OpenRA.Mods.Cnc/Traits/PortableChrono.cs b/OpenRA.Mods.Cnc/Traits/PortableChrono.cs index 6fc34fb621..0ab5342311 100644 --- a/OpenRA.Mods.Cnc/Traits/PortableChrono.cs +++ b/OpenRA.Mods.Cnc/Traits/PortableChrono.cs @@ -118,7 +118,7 @@ namespace OpenRA.Mods.Cnc.Traits self.QueueActivity(move.MoveWithinRange(order.Target, WDist.FromCells(maxDistance.Value), targetLineColor: Color.LawnGreen)); self.QueueActivity(new Teleport(self, cell, maxDistance, Info.KillCargo, Info.FlashScreen, Info.ChronoshiftSound)); - self.QueueActivity(move.MoveTo(cell, 5, Color.LawnGreen)); + self.QueueActivity(move.MoveTo(cell, 5, targetLineColor: Color.LawnGreen)); self.ShowTargetLines(); } } diff --git a/OpenRA.Mods.Cnc/Traits/TDGunboat.cs b/OpenRA.Mods.Cnc/Traits/TDGunboat.cs index 00bacbde33..40dd828dd6 100644 --- a/OpenRA.Mods.Cnc/Traits/TDGunboat.cs +++ b/OpenRA.Mods.Cnc/Traits/TDGunboat.cs @@ -180,8 +180,8 @@ namespace OpenRA.Mods.Cnc.Traits self.World.UpdateMaps(self, this); } - public Activity MoveTo(CPos cell, int nearEnough, Color? targetLineColor = null) { return null; } - public Activity MoveTo(CPos cell, Actor ignoreActor, Color? targetLineColor = null) { return null; } + public Activity MoveTo(CPos cell, int nearEnough = 0, Actor ignoreActor = null, + bool evaluateNearestMovableCell = false, Color? targetLineColor = null) { return null; } public Activity MoveWithinRange(Target target, WDist range, WPos? initialTargetPosition = null, Color? targetLineColor = null) { return null; } public Activity MoveWithinRange(Target target, WDist minRange, WDist maxRange, diff --git a/OpenRA.Mods.Common/Activities/Resupply.cs b/OpenRA.Mods.Common/Activities/Resupply.cs index c3f300e859..9b2f7ddfc9 100644 --- a/OpenRA.Mods.Common/Activities/Resupply.cs +++ b/OpenRA.Mods.Common/Activities/Resupply.cs @@ -127,7 +127,7 @@ namespace OpenRA.Mods.Common.Activities // HACK: Repairable needs the actor to move to host center. // TODO: Get rid of this or at least replace it with something less hacky. if (repairableNear == null) - QueueChild(move.MoveTo(targetCell, host.Actor)); + QueueChild(move.MoveTo(targetCell, ignoreActor: host.Actor)); var delta = (self.CenterPosition - host.CenterPosition).LengthSquared; var transport = transportCallers.FirstOrDefault(t => t.MinimumDistance.LengthSquared < delta); @@ -188,7 +188,7 @@ namespace OpenRA.Mods.Common.Activities if (wasRepaired || isHostInvalid || (!stayOnResupplier && aircraft.Info.TakeOffOnResupply)) { if (self.CurrentActivity.NextActivity == null && rp != null) - QueueChild(move.MoveTo(rp.Location, repairableNear != null ? null : host.Actor, targetLineColor: Color.Green)); + QueueChild(move.MoveTo(rp.Location, ignoreActor: repairableNear != null ? null : host.Actor, targetLineColor: Color.Green)); else QueueChild(new TakeOff(self)); @@ -208,7 +208,7 @@ namespace OpenRA.Mods.Common.Activities if (self.CurrentActivity.NextActivity == null) { if (rp != null) - QueueChild(move.MoveTo(rp.Location, repairableNear != null ? null : host.Actor)); + QueueChild(move.MoveTo(rp.Location, ignoreActor: repairableNear != null ? null : host.Actor)); else if (repairableNear == null) QueueChild(move.MoveToTarget(self, host)); } diff --git a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs index f093e118f0..8dbdb08885 100644 --- a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs +++ b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs @@ -814,16 +814,12 @@ namespace OpenRA.Mods.Common.Traits #region Implement IMove - public Activity MoveTo(CPos cell, int nearEnough, Color? targetLineColor = null) + public Activity MoveTo(CPos cell, int nearEnough = 0, Actor ignoreActor = null, + bool evaluateNearestMovableCell = false, Color? targetLineColor = null) { return new Fly(self, Target.FromCell(self.World, cell), WDist.FromCells(nearEnough), targetLineColor: targetLineColor); } - public Activity MoveTo(CPos cell, Actor ignoreActor, Color? targetLineColor = null) - { - return new Fly(self, Target.FromCell(self.World, cell), targetLineColor: targetLineColor); - } - public Activity MoveWithinRange(Target target, WDist range, WPos? initialTargetPosition = null, Color? targetLineColor = null) { diff --git a/OpenRA.Mods.Common/Traits/Mobile.cs b/OpenRA.Mods.Common/Traits/Mobile.cs index 620bea4cd2..6eba25a8bb 100644 --- a/OpenRA.Mods.Common/Traits/Mobile.cs +++ b/OpenRA.Mods.Common/Traits/Mobile.cs @@ -589,14 +589,10 @@ namespace OpenRA.Mods.Common.Traits return inner; } - public Activity MoveTo(CPos cell, int nearEnough, Color? targetLineColor = null) + public Activity MoveTo(CPos cell, int nearEnough = 0, Actor ignoreActor = null, + bool evaluateNearestMovableCell = false, Color? targetLineColor = null) { - return WrapMove(new Move(self, cell, WDist.FromCells(nearEnough), targetLineColor: targetLineColor)); - } - - public Activity MoveTo(CPos cell, Actor ignoreActor, Color? targetLineColor = null) - { - return WrapMove(new Move(self, cell, WDist.Zero, ignoreActor, targetLineColor: targetLineColor)); + return WrapMove(new Move(self, cell, WDist.FromCells(nearEnough), ignoreActor, evaluateNearestMovableCell, targetLineColor)); } public Activity MoveWithinRange(Target target, WDist range, diff --git a/OpenRA.Mods.Common/TraitsInterfaces.cs b/OpenRA.Mods.Common/TraitsInterfaces.cs index 2b8271c74c..887390f34b 100644 --- a/OpenRA.Mods.Common/TraitsInterfaces.cs +++ b/OpenRA.Mods.Common/TraitsInterfaces.cs @@ -425,8 +425,8 @@ namespace OpenRA.Mods.Common.Traits public interface IMove { - Activity MoveTo(CPos cell, int nearEnough, Color? targetLineColor = null); - Activity MoveTo(CPos cell, Actor ignoreActor, Color? targetLineColor = null); + Activity MoveTo(CPos cell, int nearEnough = 0, Actor ignoreActor = null, + bool evaluateNearestMovableCell = false, Color? targetLineColor = null); Activity MoveWithinRange(Target target, WDist range, WPos? initialTargetPosition = null, Color? targetLineColor = null); Activity MoveWithinRange(Target target, WDist minRange, WDist maxRange,