Set BackwardDuration to -1 means ignore the time and set MaxBackwardCells to -1 means ignore the distance.
This commit is contained in:
@@ -160,7 +160,10 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
var firstFacing = self.World.Map.FacingBetween(mobile.FromCell, nextCell.Value.Cell, mobile.Facing);
|
||||
|
||||
if (mobile.Info.CanMoveBackward && path.Count < mobile.Info.MaxBackwardCells && self.World.WorldTick - startTicks < mobile.Info.BackwardDuration && Math.Abs(firstFacing.Angle - mobile.Facing.Angle) > 256)
|
||||
if (mobile.Info.CanMoveBackward
|
||||
&& (mobile.Info.MaxBackwardCells < 0 || path.Count < mobile.Info.MaxBackwardCells)
|
||||
&& (mobile.Info.BackwardDuration < 0 || self.World.WorldTick - startTicks < mobile.Info.BackwardDuration)
|
||||
&& Math.Abs(firstFacing.Angle - mobile.Facing.Angle) > 256)
|
||||
{
|
||||
ActorFacingModifier = new WAngle(512);
|
||||
firstFacing += ActorFacingModifier;
|
||||
|
||||
@@ -71,10 +71,12 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Can move backward if possible")]
|
||||
public readonly bool CanMoveBackward = false;
|
||||
|
||||
[Desc("After how many ticks the actor will turn forward during backoff")]
|
||||
[Desc("After how many ticks the actor will turn forward during backoff.",
|
||||
"If set to -1 the unit will be allowed to move backwards without time limit.")]
|
||||
public readonly int BackwardDuration = 40;
|
||||
|
||||
[Desc("Actor will try to move backward if the number of the cells in path lower than this")]
|
||||
[Desc("Actor will only try to move backwards when the path (in cells) is shorter than this value.",
|
||||
"If set to -1 the unit will be allowed to move backwards without range limit.")]
|
||||
public readonly int MaxBackwardCells = 15;
|
||||
|
||||
[ConsumedConditionReference]
|
||||
|
||||
Reference in New Issue
Block a user