Skip to content

Commit

Permalink
feat(traits): reduce audio distance for Light Step
Browse files Browse the repository at this point in the history
  • Loading branch information
angelofallars committed Aug 3, 2024
1 parent 6110b0b commit 3bae080
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Content.Shared/Movement/Systems/SharedMoverController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,13 @@ private bool TryGetSound(
var coordinates = xform.Coordinates;
var distanceNeeded = mover.Sprinting ? StepSoundMoveDistanceRunning : StepSoundMoveDistanceWalking;

if (_entities.TryGetComponent(uid, out FootstepVolumeModifierComponent? volumeModifier))
{
distanceNeeded *= mover.Sprinting
? volumeModifier.SprintDistanceMultiplier
: volumeModifier.WalkDistanceMultiplier;
}

// Handle footsteps.
if (!weightless)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,16 @@ public sealed partial class FootstepVolumeModifierComponent : Component
/// </summary>
[DataField, AutoNetworkedField]
public float WalkingModifier { get; set; } = 0f;

/// <summary>
/// What to multiply the distance needed to hear sprinting by.
/// </summary>
[DataField, AutoNetworkedField]
public float SprintDistanceMultiplier { get; set; } = 1f;

/// <summary>
/// What to multiply the distance needed to hear walking by.
/// </summary>
[DataField, AutoNetworkedField]
public float WalkDistanceMultiplier { get; set; } = 1f;
}
2 changes: 2 additions & 0 deletions Resources/Prototypes/Traits/skills.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,5 @@
- type: FootstepVolumeModifier
sprintingModifier: -10
walkingModifier: -10
sprintDistanceMultiplier: 0.85
walkDistanceMultiplier: 0.85

0 comments on commit 3bae080

Please sign in to comment.