2021-09-07 18:47:23 +10:00
|
|
|
using Content.Server.Power.Components;
|
2021-09-30 10:09:16 +10:00
|
|
|
using Content.Server.Power.EntitySystems;
|
2021-09-07 18:47:23 +10:00
|
|
|
using Content.Shared.Audio;
|
|
|
|
|
|
2023-06-27 21:28:51 +10:00
|
|
|
namespace Content.Server.Audio;
|
|
|
|
|
|
|
|
|
|
public sealed class AmbientSoundSystem : SharedAmbientSoundSystem
|
2021-09-07 18:47:23 +10:00
|
|
|
{
|
2023-06-27 21:28:51 +10:00
|
|
|
public override void Initialize()
|
2021-09-07 18:47:23 +10:00
|
|
|
{
|
2023-06-27 21:28:51 +10:00
|
|
|
base.Initialize();
|
|
|
|
|
SubscribeLocalEvent<AmbientOnPoweredComponent, PowerChangedEvent>(HandlePowerChange);
|
|
|
|
|
SubscribeLocalEvent<AmbientOnPoweredComponent, PowerNetBatterySupplyEvent>(HandlePowerSupply);
|
|
|
|
|
}
|
2021-09-30 10:09:16 +10:00
|
|
|
|
2023-06-27 21:28:51 +10:00
|
|
|
private void HandlePowerSupply(EntityUid uid, AmbientOnPoweredComponent component, ref PowerNetBatterySupplyEvent args)
|
|
|
|
|
{
|
|
|
|
|
SetAmbience(uid, args.Supply);
|
|
|
|
|
}
|
2021-09-07 18:47:23 +10:00
|
|
|
|
2023-06-27 21:28:51 +10:00
|
|
|
private void HandlePowerChange(EntityUid uid, AmbientOnPoweredComponent component, ref PowerChangedEvent args)
|
|
|
|
|
{
|
|
|
|
|
SetAmbience(uid, args.Powered);
|
2021-09-07 18:47:23 +10:00
|
|
|
}
|
|
|
|
|
}
|