Require cancelled move orders to exit tunnels before completion.

This commit is contained in:
Paul Chote
2017-04-17 21:29:28 +00:00
parent c6d8957307
commit 0b0f8bc51e

View File

@@ -142,7 +142,9 @@ namespace OpenRA.Mods.Common.Activities
public override Activity Tick(Actor self)
{
if (IsCanceled)
// If the actor is inside a tunnel then we must let them move
// all the way through before moving to the next activity
if (IsCanceled && self.Location.Layer != CustomMovementLayerType.Tunnel)
return NextActivity;
if (mobile.IsTraitDisabled)
@@ -277,12 +279,6 @@ namespace OpenRA.Mods.Common.Activities
return Pair.New(nextCell, subCell);
}
public override bool Cancel(Actor self)
{
path = NoPath;
return base.Cancel(self);
}
public override IEnumerable<Target> GetTargets(Actor self)
{
if (path != null)
@@ -426,6 +422,8 @@ namespace OpenRA.Mods.Common.Activities
var fromSubcellOffset = map.Grid.OffsetOfSubCell(mobile.FromSubCell);
var toSubcellOffset = map.Grid.OffsetOfSubCell(mobile.ToSubCell);
if (!IsCanceled || self.Location.Layer == CustomMovementLayerType.Tunnel)
{
var nextCell = parent.PopPath(self);
if (nextCell != null)
{
@@ -447,6 +445,7 @@ namespace OpenRA.Mods.Common.Activities
parent.path.Add(nextCell.Value.First);
}
}
var toPos = mobile.ToCell.Layer == 0 ? map.CenterOfCell(mobile.ToCell) :
self.World.GetCustomMovementLayers()[mobile.ToCell.Layer].CenterOfCell(mobile.ToCell);