]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix walking in place animations when holding walk button (#37887)
authorTayrtahn <tayrtahn@gmail.com>
Wed, 28 May 2025 00:14:49 +0000 (20:14 -0400)
committerGitHub <noreply@github.com>
Wed, 28 May 2025 00:14:49 +0000 (20:14 -0400)
Fix SpriteMovement playing when holding walk button

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

index f03619ccc675bc23c4b31673ed1dd642f1b867d4..87da601f76f705abd33f025f804ca6fe3165f5f7 100644 (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.
index cf7aedd95fbf4531d5aa6968d243554800cb9920..2560f33e9c8d39d44c618bd1e7ed30dc06f5c11c 100644 (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);
             }
         }