Fix units stuck on transit-only when resupplying

This commit is contained in:
Adam Mitchell
2020-04-11 17:59:30 +01:00
committed by reaperrr
parent 942dd0e5f7
commit 0a9eb1ff83
5 changed files with 23 additions and 5 deletions

View File

@@ -347,10 +347,15 @@ namespace OpenRA.Mods.Common.Activities
}
public override void Cancel(Actor self, bool keepQueue = false)
{
Cancel(self, keepQueue, false);
}
public void Cancel(Actor self, bool keepQueue, bool forceClearPath)
{
// We need to clear the path here in order to prevent MovePart queueing new instances of itself
// when the unit is making a turn.
if (path != null && mobile.CanStayInCell(mobile.ToCell))
if (path != null && (forceClearPath || mobile.CanStayInCell(mobile.ToCell)))
path.Clear();
base.Cancel(self, keepQueue);