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 all 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;
}
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
Loading