Files
tbd-station-14/Content.Server/Audio/AmbientSoundSystem.cs
GreaseMonk da618d791a Add Ability to stop sound when MobState is Dead (#26905)
* Add stopsWhenEntityDead to sound components

* Convert component

* Review

* Fix dupe sub

---------

Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
2024-04-14 13:12:38 +10:00

27 lines
858 B
C#

using Content.Server.Power.Components;
using Content.Server.Power.EntitySystems;
using Content.Shared.Audio;
using Content.Shared.Mobs;
namespace Content.Server.Audio;
public sealed class AmbientSoundSystem : SharedAmbientSoundSystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<AmbientOnPoweredComponent, PowerChangedEvent>(HandlePowerChange);
SubscribeLocalEvent<AmbientOnPoweredComponent, PowerNetBatterySupplyEvent>(HandlePowerSupply);
}
private void HandlePowerSupply(EntityUid uid, AmbientOnPoweredComponent component, ref PowerNetBatterySupplyEvent args)
{
SetAmbience(uid, args.Supply);
}
private void HandlePowerChange(EntityUid uid, AmbientOnPoweredComponent component, ref PowerChangedEvent args)
{
SetAmbience(uid, args.Powered);
}
}