Make mover controller respect footsteps volume sound param (#16018)

This commit is contained in:
AJCM-git
2023-05-02 19:33:53 -04:00
committed by GitHub
parent 18bcb118e9
commit c882a07cd1
5 changed files with 14 additions and 11 deletions

View File

@@ -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<SharedPullableComponent> pullableQuery,
EntityQuery<MovementSpeedModifierComponent> 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 ||