Fix backwards movement not canceling when BackwardDuration times out
This commit is contained in:
committed by
Matthias Mailänder
parent
a4e80e1153
commit
1a2aafa17c
@@ -484,12 +484,16 @@ namespace OpenRA.Mods.Common.Activities
|
||||
WRot? fromTerrainOrientation, WRot? toTerrainOrientation, int terrainOrientationMargin, int carryoverProgress, bool movingOnGroundLayer)
|
||||
: base(move, from, to, fromFacing, toFacing, fromTerrainOrientation, toTerrainOrientation, terrainOrientationMargin, carryoverProgress, movingOnGroundLayer) { }
|
||||
|
||||
static bool IsTurn(Mobile mobile, CPos nextCell, Map map)
|
||||
bool IsTurn(Actor self, Mobile mobile, CPos nextCell, Map map)
|
||||
{
|
||||
// Some actors with a limited number of sprite facings should never move along curved trajectories.
|
||||
if (mobile.Info.AlwaysTurnInPlace)
|
||||
return false;
|
||||
|
||||
// When Backwards duration runs out, let the Move activity do the turn.
|
||||
if (Move.actorFacingModifier != WAngle.Zero && self.World.WorldTick - Move.startTicks >= mobile.Info.BackwardDuration)
|
||||
return false;
|
||||
|
||||
// Tight U-turns should be done in place instead of making silly looking loops.
|
||||
var nextFacing = map.FacingBetween(nextCell, mobile.ToCell, mobile.Facing);
|
||||
var currentFacing = map.FacingBetween(mobile.ToCell, mobile.FromCell, mobile.Facing);
|
||||
@@ -506,7 +510,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
var nextCell = parent.PopPath(self);
|
||||
if (nextCell != null)
|
||||
{
|
||||
if (!mobile.IsTraitPaused && !mobile.IsTraitDisabled && IsTurn(mobile, nextCell.Value.Cell, map))
|
||||
if (!mobile.IsTraitPaused && !mobile.IsTraitDisabled && IsTurn(self, mobile, nextCell.Value.Cell, map))
|
||||
{
|
||||
var nextSubcellOffset = map.Grid.OffsetOfSubCell(nextCell.Value.SubCell);
|
||||
WRot? nextToTerrainOrientation = null;
|
||||
|
||||
Reference in New Issue
Block a user