From c882a07cd1d5dc9c8091df2001b2a0a99f79b875 Mon Sep 17 00:00:00 2001 From: AJCM-git <60196617+AJCM-git@users.noreply.github.com> Date: Tue, 2 May 2023 19:33:53 -0400 Subject: [PATCH] Make mover controller respect footsteps volume sound param (#16018) --- .../Movement/Systems/SharedMoverController.cs | 17 ++++++----------- .../Prototypes/Entities/Effects/puddle.yml | 2 ++ .../Prototypes/Entities/Mobs/NPCs/slimes.yml | 2 ++ .../Prototypes/Entities/Structures/catwalk.yml | 2 ++ Resources/Prototypes/Entities/Tiles/water.yml | 2 ++ 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/Content.Shared/Movement/Systems/SharedMoverController.cs b/Content.Shared/Movement/Systems/SharedMoverController.cs index 42e9b6f49a..57ee41b718 100644 --- a/Content.Shared/Movement/Systems/SharedMoverController.cs +++ b/Content.Shared/Movement/Systems/SharedMoverController.cs @@ -17,10 +17,6 @@ using Robust.Shared.Timing; using Robust.Shared.Utility; using System.Diagnostics.CodeAnalysis; using Content.Shared.Mobs.Systems; -using Content.Shared.Mech.Components; -using Content.Shared.Parallax.Biomes; -using Robust.Shared.Map.Components; -using Robust.Shared.Noise; using Robust.Shared.Physics.Components; using Robust.Shared.Physics.Systems; @@ -49,8 +45,6 @@ namespace Content.Shared.Movement.Systems private const float StepSoundMoveDistanceWalking = 1.5f; private const float FootstepVariation = 0f; - private const float FootstepVolume = 3f; - private const float FootstepWalkingAddedVolumeMultiplier = 0f; protected ISawmill Sawmill = default!; @@ -113,12 +107,12 @@ namespace Content.Shared.Movement.Systems EntityQuery pullableQuery, EntityQuery modifierQuery) { - bool canMove = mover.CanMove; + var canMove = mover.CanMove; if (relayTargetQuery.TryGetComponent(uid, out var relayTarget) && relayTarget.Entities.Count > 0) { DebugTools.Assert(relayTarget.Entities.Count <= 1, "Multiple relayed movers are not supported at the moment"); - bool found = false; + var found = false; foreach (var ent in relayTarget.Entities) { if (_mobState.IsIncapacitated(ent) || !moverQuery.TryGetComponent(ent, out var relayedMover)) @@ -264,10 +258,10 @@ namespace Content.Shared.Movement.Systems if (!weightless && mobMoverQuery.TryGetComponent(uid, out var mobMover) && TryGetSound(weightless, uid, mover, mobMover, xform, out var sound)) { - var soundModifier = mover.Sprinting ? 1.0f : FootstepWalkingAddedVolumeMultiplier; + var soundModifier = mover.Sprinting ? 1.5f : 1f; var audioParams = sound.Params - .WithVolume(FootstepVolume * soundModifier) + .WithVolume(sound.Params.Volume * soundModifier) .WithVariation(sound.Params.Variation ?? FootstepVariation); // If we're a relay target then predict the sound for all relays. @@ -348,7 +342,8 @@ namespace Content.Shared.Movement.Systems foreach (var otherCollider in broadPhaseSystem.GetCollidingEntities(transform.MapID, enlargedAABB)) { - if (otherCollider == collider) continue; // Don't try to push off of yourself! + if (otherCollider == collider) + continue; // Don't try to push off of yourself! // Only allow pushing off of anchored things that have collision. if (otherCollider.BodyType != BodyType.Static || diff --git a/Resources/Prototypes/Entities/Effects/puddle.yml b/Resources/Prototypes/Entities/Effects/puddle.yml index f48ee736ea..2f65069b2a 100644 --- a/Resources/Prototypes/Entities/Effects/puddle.yml +++ b/Resources/Prototypes/Entities/Effects/puddle.yml @@ -74,6 +74,8 @@ - type: FootstepModifier footstepSoundCollection: collection: FootstepWater + params: + volume: 6 - type: Slippery launchForwardsMultiplier: 2.0 - type: Transform diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/slimes.yml b/Resources/Prototypes/Entities/Mobs/NPCs/slimes.yml index aa4c637469..b52777be0f 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/slimes.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/slimes.yml @@ -38,6 +38,8 @@ - type: FootstepModifier footstepSoundCollection: path: /Audio/Effects/Footsteps/slime1.ogg + params: + volume: 3 - type: Tag tags: - FootstepSound diff --git a/Resources/Prototypes/Entities/Structures/catwalk.yml b/Resources/Prototypes/Entities/Structures/catwalk.yml index 3fbe08dd64..7f5c6a60a8 100644 --- a/Resources/Prototypes/Entities/Structures/catwalk.yml +++ b/Resources/Prototypes/Entities/Structures/catwalk.yml @@ -22,6 +22,8 @@ - type: FootstepModifier footstepSoundCollection: collection: FootstepCatwalk + params: + volume: 8 - type: Tag tags: - Catwalk diff --git a/Resources/Prototypes/Entities/Tiles/water.yml b/Resources/Prototypes/Entities/Tiles/water.yml index aa5b644b98..64d35f53b3 100644 --- a/Resources/Prototypes/Entities/Tiles/water.yml +++ b/Resources/Prototypes/Entities/Tiles/water.yml @@ -38,3 +38,5 @@ - type: FootstepModifier footstepSoundCollection: collection: FootstepWater + params: + volume: 8