]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Move step sound distance and footstep variation to MobMoverComponent (#27799)
authorDrSmugleaf <10968691+DrSmugleaf@users.noreply.github.com>
Wed, 8 May 2024 10:22:09 +0000 (03:22 -0700)
committerGitHub <noreply@github.com>
Wed, 8 May 2024 10:22:09 +0000 (20:22 +1000)
Content.Shared/Movement/Components/MobMoverComponent.cs
Content.Shared/Movement/Systems/SharedMoverController.cs

index a77f415b9384cb782c69c8e319089f3968ec5500..7ad7961ed7e548e3336fd4f81dbc0d2c0b8b8e28 100644 (file)
@@ -14,6 +14,15 @@ namespace Content.Shared.Movement.Components
 
         [DataField] public float PushStrength = 600f;
 
+        [DataField, AutoNetworkedField]
+        public float StepSoundMoveDistanceRunning = 2;
+
+        [DataField, AutoNetworkedField]
+        public float StepSoundMoveDistanceWalking = 1.5f;
+
+        [DataField, AutoNetworkedField]
+        public float FootstepVariation;
+
         [ViewVariables(VVAccess.ReadWrite)]
         public EntityCoordinates LastPosition { get; set; }
 
index 92b953aca984df5cae604b594b32ea643a7d94ad..68e384a1b420692e3de2844abbfb252d882132e2 100644 (file)
@@ -58,11 +58,6 @@ namespace Content.Shared.Movement.Systems
         protected EntityQuery<CanMoveInAirComponent> CanMoveInAirQuery;
         protected EntityQuery<NoRotateOnMoveComponent> NoRotateQuery;
 
-        private const float StepSoundMoveDistanceRunning = 2;
-        private const float StepSoundMoveDistanceWalking = 1.5f;
-
-        private const float FootstepVariation = 0f;
-
         /// <summary>
         /// <see cref="CCVars.StopSpeed"/>
         /// </summary>
@@ -258,7 +253,7 @@ namespace Content.Shared.Movement.Systems
 
                     var audioParams = sound.Params
                         .WithVolume(sound.Params.Volume + soundModifier)
-                        .WithVariation(sound.Params.Variation ?? FootstepVariation);
+                        .WithVariation(sound.Params.Variation ?? mobMover.FootstepVariation);
 
                     // If we're a relay target then predict the sound for all relays.
                     if (relayTarget != null)
@@ -404,7 +399,9 @@ namespace Content.Shared.Movement.Systems
                 return false;
 
             var coordinates = xform.Coordinates;
-            var distanceNeeded = mover.Sprinting ? StepSoundMoveDistanceRunning : StepSoundMoveDistanceWalking;
+            var distanceNeeded = mover.Sprinting
+                ? mobMover.StepSoundMoveDistanceRunning
+                : mobMover.StepSoundMoveDistanceWalking;
 
             // Handle footsteps.
             if (!weightless)