CatStation/Content.Shared/Speech/EntitySystems/EmoteBlockerSystem.cs
Pok 7a8fab78e3
Move Accents to Shared v2 (#44772)
* move-accents-to-shared

* Update AccentSystem.cs

* Update ListeningSystem.cs

* aaaaaa

* Update AccentSystem.cs

* oh god

* aaooao

* //

* review

* fix

* Update VocalSystem.cs
2026-07-25 22:29:39 +00:00

41 lines
1.2 KiB
C#

using Content.Shared.Chat;
using Content.Shared.Inventory;
using Content.Shared.Speech.Components;
namespace Content.Shared.Speech.EntitySystems;
public sealed class EmoteBlockerSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<EmoteBlockerComponent, BeforeEmoteEvent>(OnEmoteEvent);
SubscribeLocalEvent<EmoteBlockerComponent, InventoryRelayedEvent<BeforeEmoteEvent>>(OnRelayedEmoteEvent);
}
private static void OnRelayedEmoteEvent(Entity<EmoteBlockerComponent> ent, ref InventoryRelayedEvent<BeforeEmoteEvent> args)
{
OnEmoteEvent(ent, ref args.Args);
}
private static void OnEmoteEvent(Entity<EmoteBlockerComponent> ent, ref BeforeEmoteEvent args)
{
if (ent.Comp.BlocksEmotes.Contains(args.Emote))
{
args.Cancel();
args.Blocker = ent;
return;
}
foreach (var blockedCat in ent.Comp.BlocksCategories)
{
if (blockedCat == args.Emote.Category)
{
args.Cancel();
args.Blocker = ent;
return;
}
}
}
}