2021-08-19 16:23:49 -07:00
|
|
|
using Content.Shared.Audio;
|
2021-07-10 17:35:33 +02:00
|
|
|
using Content.Shared.Sound;
|
2019-07-31 15:02:36 +02:00
|
|
|
using Robust.Shared.Audio;
|
|
|
|
|
using Robust.Shared.GameObjects;
|
2021-03-21 09:12:03 -07:00
|
|
|
using Robust.Shared.Player;
|
2021-03-05 01:08:38 +01:00
|
|
|
using Robust.Shared.Serialization.Manager.Attributes;
|
2019-06-03 23:16:47 +05:00
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Server.Movement.Components
|
2019-06-03 23:16:47 +05:00
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Changes footstep sound
|
|
|
|
|
/// </summary>
|
2019-07-31 15:02:36 +02:00
|
|
|
[RegisterComponent]
|
2019-06-03 23:16:47 +05:00
|
|
|
public class FootstepModifierComponent : Component
|
|
|
|
|
{
|
2020-08-24 14:10:28 +02:00
|
|
|
/// <inheritdoc />
|
2019-06-03 23:16:47 +05:00
|
|
|
public override string Name => "FootstepModifier";
|
|
|
|
|
|
2021-07-31 19:52:33 +02:00
|
|
|
[DataField("footstepSoundCollection", required: true)]
|
|
|
|
|
public SoundSpecifier SoundCollection = default!;
|
2019-06-03 23:16:47 +05:00
|
|
|
|
2021-08-19 16:23:49 -07:00
|
|
|
[DataField("variation")]
|
|
|
|
|
public float Variation = default;
|
|
|
|
|
|
2019-06-03 23:16:47 +05:00
|
|
|
public void PlayFootstep()
|
|
|
|
|
{
|
2021-08-19 16:23:49 -07:00
|
|
|
SoundSystem.Play(Filter.Pvs(Owner), SoundCollection.GetSound(), Owner.Transform.Coordinates, AudioHelpers.WithVariation(Variation).WithVolume(-2f));
|
2019-06-03 23:16:47 +05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|