using Content.Shared.Chat; using Content.Shared.Chat.Prototypes; using Content.Shared.Popups; using Content.Shared.StatusEffectNew; namespace Content.Shared.Speech.Muting; /// /// Handles the speech restrictions imposed by . /// public sealed partial class MutedStatusEffectSystem : EntitySystem { [Dependency] private SharedPopupSystem _popup = default!; /// public override void Initialize() { SubscribeLocalEvent>(OnSpeakAttempt); SubscribeLocalEvent>(OnEmote); SubscribeLocalEvent>(OnEmoteAction); } private void OnEmote(Entity ent, ref StatusEffectRelayedEvent args) { if (args.Args.Handled) return; // Still leaves the text so it looks like they are pantomiming a laugh. if (args.Args.Emote.Category.HasFlag(EmoteCategory.Vocal)) { args.Args = args.Args with { Handled = true }; } } private void OnEmoteAction(Entity ent, ref StatusEffectRelayedEvent args) { if (args.Args.Handled) return; _popup.PopupEntity(Loc.GetString(ent.Comp.ActionPopup), args.AppliedTo, args.AppliedTo); args.Args.Handled = true; } private void OnSpeakAttempt(Entity ent, ref StatusEffectRelayedEvent args) { if (args.Args.Cancelled) return; var target = args.Args.Uid; _popup.PopupEntity(Loc.GetString(ent.Comp.SpeakPopup), target, target); args.Args.Cancel(); } }