Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Trait: Light Step #658

Merged
merged 15 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion Content.Shared/Movement/Systems/SharedMoverController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using Content.Shared.Movement.Events;
using Content.Shared.StepTrigger.Components;
using Content.Shared.Tag;
using Content.Shared.Traits.Assorted.Components;
using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Configuration;
Expand Down Expand Up @@ -261,9 +262,17 @@ protected void HandleMobMovement(
TryGetSound(weightless, uid, mover, mobMover, xform, out var sound, tileDef: tileDef))
{
var soundModifier = mover.Sprinting ? 3.5f : 1.5f;
var volume = sound.Params.Volume + soundModifier;

if (_entities.TryGetComponent(uid, out FootstepVolumeModifierComponent? volumeModifier))
{
volume += mover.Sprinting
? volumeModifier.SprintVolumeModifier
: volumeModifier.WalkVolumeModifier;
}

var audioParams = sound.Params
.WithVolume(sound.Params.Volume + soundModifier)
.WithVolume(volume)
.WithVariation(sound.Params.Variation ?? FootstepVariation);

// If we're a relay target then predict the sound for all relays.
Expand Down
VMSolidus marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using Robust.Shared.GameStates;

namespace Content.Shared.Traits.Assorted.Components;

/// <summary>
/// This is used for any trait that modifies footstep volumes.
/// </summary>
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class FootstepVolumeModifierComponent : Component
{
/// <summary>
/// What to add to the volume of sprinting, in terms of decibels.
/// </summary>
[DataField, AutoNetworkedField]
public float SprintVolumeModifier;

/// <summary>
/// What to add to the volume of walking, in terms of decibels.
/// </summary>
[DataField, AutoNetworkedField]
public float WalkVolumeModifier;
}
5 changes: 5 additions & 0 deletions Resources/Locale/en-US/traits/traits.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,8 @@ trait-name-Foreigner = Foreigner
trait-description-Foreigner =
For one reason or another you do not speak this station's primary language.
Instead, you have a translator issued to you that only you can use.

trait-name-LightStep = Light Step
trait-description-LightStep =
You move with a quiet step, making it easier for you to elude detection.
Your footsteps are roughly 50% quieter.
angelofallars marked this conversation as resolved.
Show resolved Hide resolved
9 changes: 9 additions & 0 deletions Resources/Prototypes/Traits/skills.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,12 @@
inverted: true
species:
- Felinid

- type: trait
id: LightStep
category: Auditory
points: -1
components:
- type: FootstepVolumeModifier
sprintVolumeModifier: -10
walkVolumeModifier: -10
Loading