+using Content.Shared.Whitelist;
using Robust.Shared.GameStates;
namespace Content.Shared.Sound.Components;
[RegisterComponent, NetworkedComponent]
public sealed partial class EmitSoundOnUIOpenComponent : BaseEmitSoundComponent
{
+ /// <summary>
+ /// Blacklist for making the sound not play if certain entities open the UI
+ /// </summary>
+ [DataField]
+ public EntityWhitelist Blacklist = new();
}
private void HandleEmitSoundOnUIOpen(EntityUid uid, EmitSoundOnUIOpenComponent component, AfterActivatableUIOpenEvent args)
{
- TryEmitSound(uid, component, args.User);
+ if (_whitelistSystem.IsBlacklistFail(component.Blacklist, args.User))
+ {
+ TryEmitSound(uid, component, args.User);
+ }
}
private void OnMobState(Entity<SoundWhileAliveComponent> entity, ref MobStateChangedEvent args)