mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 18:31:17 +03:00
* Replace WithVolume() with AddVolume(), Remove AudioHelpers.WithVariation(), Use specifier options for audio params * Undo switching to AudioParams.AddVariation() * Replace AudioHelpers.WithVariation with AudioParams.AddVariation() * Test AudioParams.AddVariation() and change input parameters to sound like previous AudioHelpers.WithVariation() * Fix build error * Fix build error v2 * Remove DoAfter * fixes --------- Co-authored-by: AJCM-git <ajcm_mail@disroot.org>
29 lines
1.1 KiB
C#
29 lines
1.1 KiB
C#
using Content.Server.DeviceLinking.Components.Overload;
|
|
using Robust.Server.Audio;
|
|
using Robust.Shared.Audio;
|
|
using Content.Shared.DeviceLinking.Events;
|
|
|
|
namespace Content.Server.DeviceLinking.Systems;
|
|
|
|
public sealed partial class DeviceLinkOverloadSystem : EntitySystem
|
|
{
|
|
[Dependency] private AudioSystem _audioSystem = default!;
|
|
public override void Initialize()
|
|
{
|
|
SubscribeLocalEvent<SoundOnOverloadComponent, DeviceLinkOverloadedEvent>(OnOverloadSound);
|
|
SubscribeLocalEvent<SpawnOnOverloadComponent, DeviceLinkOverloadedEvent>(OnOverloadSpawn);
|
|
}
|
|
|
|
private void OnOverloadSound(EntityUid uid, SoundOnOverloadComponent component, ref DeviceLinkOverloadedEvent args)
|
|
{
|
|
var audioParams = component.OverloadSound?.Params ?? AudioParams.Default;
|
|
audioParams = audioParams.AddVolume(component.VolumeModifier);
|
|
_audioSystem.PlayPvs(component.OverloadSound, uid, audioParams);
|
|
}
|
|
|
|
|
|
private void OnOverloadSpawn(EntityUid uid, SpawnOnOverloadComponent component, ref DeviceLinkOverloadedEvent args)
|
|
{
|
|
Spawn(component.Prototype, Transform(uid).Coordinates);
|
|
}
|
|
}
|