Fix walking in place animations when holding walk button (#37887)

Fix SpriteMovement playing when holding walk button
This commit is contained in:
Tayrtahn 2025-05-27 20:14:49 -04:00 committed by Quanteey
parent f17d19a1a9
commit 7dfc1a7ac4
2 changed files with 10 additions and 2 deletions

View File

@ -37,6 +37,14 @@ namespace Content.Shared.Movement.Components
public MoveButtons HeldMoveButtons = MoveButtons.None;
/// <summary>
/// Does our input indicate actual movement, and not just modifiers?
/// </summary>
/// <remarks>
/// This can be useful to filter out input from just pressing the walk button with no directions, for example.
/// </remarks>
public bool HasDirectionalMovement => (HeldMoveButtons & MoveButtons.AnyDirection) != MoveButtons.None;
// I don't know if we even need this networked? It's mostly so conveyors can calculate properly.
/// <summary>
/// Direction to move this tick.

View File

@ -98,7 +98,7 @@ namespace Content.Shared.Movement.Systems
RaiseLocalEvent(entity, ref moveEvent);
Dirty(entity, entity.Comp);
var ev = new SpriteMoveEvent(entity.Comp.HeldMoveButtons != MoveButtons.None);
var ev = new SpriteMoveEvent(entity.Comp.HasDirectionalMovement);
RaiseLocalEvent(entity, ref ev);
}
@ -124,7 +124,7 @@ namespace Content.Shared.Movement.Systems
entity.Comp.HeldMoveButtons = state.HeldMoveButtons;
RaiseLocalEvent(entity.Owner, ref moveEvent);
var ev = new SpriteMoveEvent(entity.Comp.HeldMoveButtons != MoveButtons.None);
var ev = new SpriteMoveEvent(entity.Comp.HasDirectionalMovement);
RaiseLocalEvent(entity, ref ev);
}
}