Files
tbd-station-14/Content.Server/Movement/Components/FootstepModifierComponent.cs
2022-03-11 14:56:43 +11:00

29 lines
914 B
C#

using Content.Shared.Audio;
using Content.Shared.Sound;
using Robust.Shared.Audio;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Player;
using Robust.Shared.Serialization.Manager.Attributes;
namespace Content.Server.Movement.Components
{
/// <summary>
/// Changes footstep sound
/// </summary>
[RegisterComponent]
public sealed class FootstepModifierComponent : Component
{
[DataField("footstepSoundCollection", required: true)]
public SoundSpecifier SoundCollection = default!;
[DataField("variation")]
public float Variation = default;
public void PlayFootstep()
{
SoundSystem.Play(Filter.Pvs(Owner), SoundCollection.GetSound(), IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates, AudioHelpers.WithVariation(Variation).WithVolume(-2f));
}
}
}