mirror of
https://github.com/corvax-team/ss14-wl.git
synced 2026-09-15 23:02:22 +02:00
* IoC source gen compatibility Can be merged before or after https://github.com/space-wizards/RobustToolbox/pull/6549 doesn't really matter. * Missed a spot
29 lines
1.0 KiB
C#
29 lines
1.0 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)
|
|
{
|
|
|
|
_audioSystem.PlayPvs(component.OverloadSound, uid, AudioParams.Default.WithVolume(component.VolumeModifier));
|
|
}
|
|
|
|
|
|
private void OnOverloadSpawn(EntityUid uid, SpawnOnOverloadComponent component, ref DeviceLinkOverloadedEvent args)
|
|
{
|
|
Spawn(component.Prototype, Transform(uid).Coordinates);
|
|
}
|
|
}
|