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 Robust.Shared.Utility;
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using Content.Shared.Mobs.Systems; 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.Components;
using Robust.Shared.Physics.Systems; using Robust.Shared.Physics.Systems;
@@ -49,8 +45,6 @@ namespace Content.Shared.Movement.Systems
private const float StepSoundMoveDistanceWalking = 1.5f; private const float StepSoundMoveDistanceWalking = 1.5f;
private const float FootstepVariation = 0f; private const float FootstepVariation = 0f;
private const float FootstepVolume = 3f;
private const float FootstepWalkingAddedVolumeMultiplier = 0f;
protected ISawmill Sawmill = default!; protected ISawmill Sawmill = default!;
@@ -113,12 +107,12 @@ namespace Content.Shared.Movement.Systems
EntityQuery<SharedPullableComponent> pullableQuery, EntityQuery<SharedPullableComponent> pullableQuery,
EntityQuery<MovementSpeedModifierComponent> modifierQuery) EntityQuery<MovementSpeedModifierComponent> modifierQuery)
{ {
bool canMove = mover.CanMove; var canMove = mover.CanMove;
if (relayTargetQuery.TryGetComponent(uid, out var relayTarget) && relayTarget.Entities.Count > 0) 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"); 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) foreach (var ent in relayTarget.Entities)
{ {
if (_mobState.IsIncapacitated(ent) || !moverQuery.TryGetComponent(ent, out var relayedMover)) 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) && if (!weightless && mobMoverQuery.TryGetComponent(uid, out var mobMover) &&
TryGetSound(weightless, uid, mover, mobMover, xform, out var sound)) 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 var audioParams = sound.Params
.WithVolume(FootstepVolume * soundModifier) .WithVolume(sound.Params.Volume * soundModifier)
.WithVariation(sound.Params.Variation ?? FootstepVariation); .WithVariation(sound.Params.Variation ?? FootstepVariation);
// If we're a relay target then predict the sound for all relays. // 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)) 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. // Only allow pushing off of anchored things that have collision.
if (otherCollider.BodyType != BodyType.Static || if (otherCollider.BodyType != BodyType.Static ||

View File

@@ -74,6 +74,8 @@
- type: FootstepModifier - type: FootstepModifier
footstepSoundCollection: footstepSoundCollection:
collection: FootstepWater collection: FootstepWater
params:
volume: 6
- type: Slippery - type: Slippery
launchForwardsMultiplier: 2.0 launchForwardsMultiplier: 2.0
- type: Transform - type: Transform

View File

@@ -38,6 +38,8 @@
- type: FootstepModifier - type: FootstepModifier
footstepSoundCollection: footstepSoundCollection:
path: /Audio/Effects/Footsteps/slime1.ogg path: /Audio/Effects/Footsteps/slime1.ogg
params:
volume: 3
- type: Tag - type: Tag
tags: tags:
- FootstepSound - FootstepSound

View File

@@ -22,6 +22,8 @@
- type: FootstepModifier - type: FootstepModifier
footstepSoundCollection: footstepSoundCollection:
collection: FootstepCatwalk collection: FootstepCatwalk
params:
volume: 8
- type: Tag - type: Tag
tags: tags:
- Catwalk - Catwalk

View File

@@ -38,3 +38,5 @@
- type: FootstepModifier - type: FootstepModifier
footstepSoundCollection: footstepSoundCollection:
collection: FootstepWater collection: FootstepWater
params:
volume: 8