Prevent movement pausing at invalid position.

This commit is contained in:
Paul Chote
2019-10-18 22:52:31 +01:00
committed by reaperrr
parent ae34410c80
commit 69970d42f3
8 changed files with 84 additions and 49 deletions

View File

@@ -210,6 +210,13 @@ namespace OpenRA.Mods.Common.Activities
var nextCell = path[path.Count - 1];
// Something else might have moved us, so the path is no longer valid.
if (!Util.AreAdjacentCells(mobile.ToCell, nextCell))
{
path = EvalPath(BlockedByActor.Immovable);
return null;
}
var containsTemporaryBlocker = WorldUtils.ContainsTemporaryBlocker(self.World, nextCell, self);
// Next cell in the move is blocked by another actor
@@ -407,9 +414,6 @@ namespace OpenRA.Mods.Common.Activities
public override bool Tick(Actor self)
{
if (Move.mobile.IsTraitDisabled || Move.mobile.IsTraitPaused)
return false;
var ret = InnerTick(self, Move.mobile);
if (moveFraction > MoveFractionTotal)
@@ -491,7 +495,7 @@ namespace OpenRA.Mods.Common.Activities
var nextCell = parent.PopPath(self);
if (nextCell != null)
{
if (IsTurn(mobile, nextCell.Value.First, map))
if (!mobile.IsTraitPaused && !mobile.IsTraitDisabled && IsTurn(mobile, nextCell.Value.First, map))
{
var nextSubcellOffset = map.Grid.OffsetOfSubCell(nextCell.Value.Second);
var ret = new MoveFirstHalf(