Remove ActorExtensionsForMove
And use IMove.IsMoving instead.
This commit is contained in:
@@ -825,7 +825,8 @@ namespace OpenRA.Mods.Common.AI
|
|||||||
|
|
||||||
foreach (var mcv in mcvs)
|
foreach (var mcv in mcvs)
|
||||||
{
|
{
|
||||||
if (mcv.IsMoving())
|
var mover = mcv.TraitOrDefault<IMove>();
|
||||||
|
if (mover != null && mover.IsMoving)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var factType = mcv.Info.TraitInfo<TransformsInfo>().IntoActor;
|
var factType = mcv.Info.TraitInfo<TransformsInfo>().IntoActor;
|
||||||
|
|||||||
@@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -179,14 +179,14 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
static bool IsMovingInMyDirection(Actor self, Actor other)
|
static bool IsMovingInMyDirection(Actor self, Actor other)
|
||||||
{
|
{
|
||||||
if (!other.IsMoving()) return false;
|
|
||||||
|
|
||||||
var selfMobile = self.TraitOrDefault<Mobile>();
|
var selfMobile = self.TraitOrDefault<Mobile>();
|
||||||
if (selfMobile == null) return false;
|
if (selfMobile == null) return false;
|
||||||
|
|
||||||
var otherMobile = other.TraitOrDefault<Mobile>();
|
var otherMobile = other.TraitOrDefault<Mobile>();
|
||||||
if (otherMobile == null) return false;
|
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:
|
// 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);
|
var dp = CVec.Dot(selfMobile.ToCell - self.Location, otherMobile.ToCell - other.Location);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user