diff --git a/OpenRA.Mods.Common/AI/HackyAI.cs b/OpenRA.Mods.Common/AI/HackyAI.cs index 9ba3e77f65..cbc3146afd 100644 --- a/OpenRA.Mods.Common/AI/HackyAI.cs +++ b/OpenRA.Mods.Common/AI/HackyAI.cs @@ -825,7 +825,8 @@ namespace OpenRA.Mods.Common.AI foreach (var mcv in mcvs) { - if (mcv.IsMoving()) + var mover = mcv.TraitOrDefault(); + if (mover != null && mover.IsMoving) continue; var factType = mcv.Info.TraitInfo().IntoActor; diff --git a/OpenRA.Mods.Common/Activities/Move/Move.cs b/OpenRA.Mods.Common/Activities/Move/Move.cs index e3feb51545..0b290a7fee 100644 --- a/OpenRA.Mods.Common/Activities/Move/Move.cs +++ b/OpenRA.Mods.Common/Activities/Move/Move.cs @@ -432,22 +432,4 @@ namespace OpenRA.Mods.Common.Activities } } } - - public static class ActorExtensionsForMove - { - public static bool IsMoving(this Actor self) - { - var a = self.GetCurrentActivity(); - if (a == null) - return false; - - // HACK: Dirty, but it suffices until we do something better: - if (a.GetType() == typeof(Move)) return true; - if (a.GetType() == typeof(MoveAdjacentTo)) return true; - if (a.GetType() == typeof(AttackMoveActivity)) return true; - - // Not a move: - return false; - } - } } diff --git a/OpenRA.Mods.Common/Traits/Mobile.cs b/OpenRA.Mods.Common/Traits/Mobile.cs index 0a3cd8c0ee..091705e00b 100644 --- a/OpenRA.Mods.Common/Traits/Mobile.cs +++ b/OpenRA.Mods.Common/Traits/Mobile.cs @@ -179,14 +179,14 @@ namespace OpenRA.Mods.Common.Traits static bool IsMovingInMyDirection(Actor self, Actor other) { - if (!other.IsMoving()) return false; - var selfMobile = self.TraitOrDefault(); if (selfMobile == null) return false; var otherMobile = other.TraitOrDefault(); if (otherMobile == null) return false; + if (!otherMobile.IsMoving) return false; + // Sign of dot-product indicates (roughly) if vectors are facing in same or opposite directions: var dp = CVec.Dot(selfMobile.ToCell - self.Location, otherMobile.ToCell - other.Location);