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 GitHub
parent 241e5836d1
commit c1b9b7e6d7
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; 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. // I don't know if we even need this networked? It's mostly so conveyors can calculate properly.
/// <summary> /// <summary>
/// Direction to move this tick. /// Direction to move this tick.

View File

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