Skip to content

Commit

Permalink
New Trait: Light Step (#658)
Browse files Browse the repository at this point in the history
# Description

**Light Step** is a 1-point Auditory trait that reduces the volume of
your footsteps by roughly 50%, enabling you to be quieter and
stealthier. Inspired by the SS13 trait of the same name.

## TODO

- [x] Locale strings
- [x] ~~Reduce the distance in which Light Step footsteps can be heard~~
- It turns out that whatever I did reduced the delay between footstep
sounds.
- [x] Discuss the balancing values for the trait

## Technical details

In the current implementation, Light Step reduces the volume of
footsteps by 10 dB, resulting in roughly halving the volume.

The fields in `FootstepVolumeModifierComponent` change the volume in
terms of decibels.

## Media


![image](https://github.com/user-attachments/assets/d1e3efee-6f81-4212-a745-ae08687afcc0)

# Changelog

:cl: Skubman
- add: Add the Light Step trait, a 1-point trait that makes your
footsteps quieter.

---------

Signed-off-by: Angelo Fallaria <[email protected]>
  • Loading branch information
angelofallars authored Aug 5, 2024
1 parent 812a303 commit 0acb879
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 1 deletion.
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
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;
}
4 changes: 4 additions & 0 deletions Resources/Locale/en-US/traits/traits.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,7 @@ trait-name-Voracious = Voracious
trait-description-Voracious =
Nothing gets between you and your food.
Your endless consumption of food and drinks is twice as fast.
trait-name-LightStep = Light Step
trait-description-LightStep =
You move with a gentle step, making your footsteps quieter.
14 changes: 14 additions & 0 deletions Resources/Prototypes/Traits/skills.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,17 @@
- type: ConsumeDelayModifier
foodDelayMultiplier: 0.5
drinkDelayMultiplier: 0.5

- type: trait
id: LightStep
category: Auditory
points: -1
components:
- type: FootstepVolumeModifier
sprintVolumeModifier: -10
walkVolumeModifier: -10
requirements:
- !type:CharacterSpeciesRequirement
inverted: true
species:
- Felinid

0 comments on commit 0acb879

Please sign in to comment.