Make locomotor cache and nudging logic aware of mobile trait status.

This commit is contained in:
tovl
2019-09-16 22:48:40 +02:00
committed by teinarss
parent 7e5b1abc0e
commit c4d1468f62
3 changed files with 45 additions and 12 deletions

View File

@@ -331,9 +331,12 @@ namespace OpenRA.Mods.Common.Traits
// If the check allows: We are not blocked by units that we can force to move out of the way.
if (check <= BlockedByActor.Immovable && cellFlag.HasCellFlag(CellFlag.HasMovableActor) &&
self.Owner.Stances[otherActor.Owner] == Stance.Ally &&
otherActor.TraitOrDefault<IMove>() != null)
return false;
self.Owner.Stances[otherActor.Owner] == Stance.Ally)
{
var mobile = otherActor.TraitOrDefault<Mobile>();
if (mobile != null && !mobile.IsTraitDisabled && !mobile.IsTraitPaused && !mobile.RequireForceMove)
return false;
}
// If the check allows: we are not blocked by moving units.
if (check <= BlockedByActor.Stationary && cellFlag.HasCellFlag(CellFlag.HasMovingActor) &&
@@ -484,7 +487,7 @@ namespace OpenRA.Mods.Common.Traits
var crushables = actor.TraitsImplementing<ICrushable>();
var mobile = actor.OccupiesSpace as Mobile;
var isMovable = mobile != null;
var isMovable = mobile != null && !mobile.IsTraitDisabled && !mobile.IsTraitPaused && !mobile.RequireForceMove;
var isMoving = isMovable && mobile.CurrentMovementTypes.HasMovementType(MovementType.Horizontal);
if (crushables.Any())