Disallow units idling on service depot.
This commit is contained in:
@@ -146,7 +146,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
if (evaluateNearestMovableCell && destination.HasValue)
|
||||
{
|
||||
var movableDestination = mobile.NearestMoveableCell(destination.Value);
|
||||
destination = mobile.CanEnterCell(movableDestination) ? movableDestination : (CPos?)null;
|
||||
destination = mobile.CanEnterCell(movableDestination, check: BlockedByActor.Immovable) ? movableDestination : (CPos?)null;
|
||||
}
|
||||
|
||||
path = EvalPath(BlockedByActor.Stationary);
|
||||
@@ -160,8 +160,13 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
// If the actor is inside a tunnel then we must let them move
|
||||
// all the way through before moving to the next activity
|
||||
if (IsCanceling && self.Location.Layer != CustomMovementLayerType.Tunnel)
|
||||
if (IsCanceling && self.Location.Layer != CustomMovementLayerType.Tunnel && mobile.CanStayInCell(mobile.ToCell))
|
||||
{
|
||||
if (path != null)
|
||||
path.Clear();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (mobile.IsTraitDisabled || mobile.IsTraitPaused)
|
||||
return false;
|
||||
@@ -225,7 +230,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
{
|
||||
// Are we close enough?
|
||||
var cellRange = nearEnough.Length / 1024;
|
||||
if (!containsTemporaryBlocker && (mobile.ToCell - destination.Value).LengthSquared <= cellRange * cellRange)
|
||||
if (!containsTemporaryBlocker && (mobile.ToCell - destination.Value).LengthSquared <= cellRange * cellRange && mobile.CanStayInCell(mobile.ToCell))
|
||||
{
|
||||
path.Clear();
|
||||
return null;
|
||||
@@ -312,7 +317,9 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
public override void Cancel(Actor self, bool keepQueue = false)
|
||||
{
|
||||
if (path != null)
|
||||
// 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))
|
||||
path.Clear();
|
||||
|
||||
base.Cancel(self, keepQueue);
|
||||
|
||||
Reference in New Issue
Block a user