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

@@ -866,7 +866,13 @@ namespace OpenRA.Mods.Common.Traits
void INotifyBecomingIdle.OnBecomingIdle(Actor self)
{
if (self.Location.Layer == 0)
{
// Make sure that units aren't left idling in a transit-only cell
// HACK: activities should be making sure that this can't happen in the first place!
if (!Locomotor.CanStayInCell(self.Location))
self.QueueActivity(MoveTo(self.Location, evaluateNearestMovableCell: true));
return;
}
var cml = self.World.WorldActor.TraitsImplementing<ICustomMovementLayer>()
.First(l => l.Index == self.Location.Layer);