Skip to content
This repository was archived by the owner on Dec 23, 2025. It is now read-only.

Commit c1b9b7e

Browse files
authored
Fix walking in place animations when holding walk button (space-wizards#37887)
Fix SpriteMovement playing when holding walk button
1 parent 241e583 commit c1b9b7e

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

Content.Shared/Movement/Components/InputMoverComponent.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ public sealed partial class InputMoverComponent : Component
3737

3838
public MoveButtons HeldMoveButtons = MoveButtons.None;
3939

40+
/// <summary>
41+
/// Does our input indicate actual movement, and not just modifiers?
42+
/// </summary>
43+
/// <remarks>
44+
/// This can be useful to filter out input from just pressing the walk button with no directions, for example.
45+
/// </remarks>
46+
public bool HasDirectionalMovement => (HeldMoveButtons & MoveButtons.AnyDirection) != MoveButtons.None;
47+
4048
// I don't know if we even need this networked? It's mostly so conveyors can calculate properly.
4149
/// <summary>
4250
/// Direction to move this tick.

Content.Shared/Movement/Systems/SharedMoverController.Input.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ protected void SetMoveInput(Entity<InputMoverComponent> entity, MoveButtons butt
9898
RaiseLocalEvent(entity, ref moveEvent);
9999
Dirty(entity, entity.Comp);
100100

101-
var ev = new SpriteMoveEvent(entity.Comp.HeldMoveButtons != MoveButtons.None);
101+
var ev = new SpriteMoveEvent(entity.Comp.HasDirectionalMovement);
102102
RaiseLocalEvent(entity, ref ev);
103103
}
104104

@@ -124,7 +124,7 @@ private void OnMoverHandleState(Entity<InputMoverComponent> entity, ref Componen
124124
entity.Comp.HeldMoveButtons = state.HeldMoveButtons;
125125
RaiseLocalEvent(entity.Owner, ref moveEvent);
126126

127-
var ev = new SpriteMoveEvent(entity.Comp.HeldMoveButtons != MoveButtons.None);
127+
var ev = new SpriteMoveEvent(entity.Comp.HasDirectionalMovement);
128128
RaiseLocalEvent(entity, ref ev);
129129
}
130130
}

0 commit comments

Comments
 (0)