Disallow units idling on service depot.
This commit is contained in:
@@ -27,7 +27,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
HasStationaryActor = 2,
|
||||
HasMovableActor = 4,
|
||||
HasCrushableActor = 8,
|
||||
HasTemporaryBlocker = 16
|
||||
HasTemporaryBlocker = 16,
|
||||
HasTransitOnlyActor = 32,
|
||||
}
|
||||
|
||||
public static class LocomoterExts
|
||||
@@ -309,6 +310,11 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool CanStayInCell(CPos cell)
|
||||
{
|
||||
return !GetCache(cell).CellFlag.HasCellFlag(CellFlag.HasTransitOnlyActor);
|
||||
}
|
||||
|
||||
public SubCell GetAvailableSubCell(Actor self, CPos cell, BlockedByActor check, SubCell preferredSubCell = SubCell.Any, Actor ignoreActor = null)
|
||||
{
|
||||
if (MovementCostForCell(cell) == short.MaxValue)
|
||||
@@ -496,6 +502,15 @@ namespace OpenRA.Mods.Common.Traits
|
||||
var isMovable = mobile != null && !mobile.IsTraitDisabled && !mobile.IsTraitPaused && !mobile.IsImmovable;
|
||||
var isMoving = isMovable && mobile.CurrentMovementTypes.HasMovementType(MovementType.Horizontal);
|
||||
|
||||
var building = actor.OccupiesSpace as Building;
|
||||
var isTransitOnly = building != null && building.TransitOnlyCells().Contains(cell);
|
||||
|
||||
if (isTransitOnly)
|
||||
{
|
||||
cellFlag |= CellFlag.HasTransitOnlyActor;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (crushables.Any())
|
||||
{
|
||||
cellFlag |= CellFlag.HasCrushableActor;
|
||||
|
||||
Reference in New Issue
Block a user