CatStation/Content.Shared/Speech/EntitySystems/SpeakOnActionSystem.cs
Pok b38e363d41
Muted StatusEffects (#43668)
* MutedStatusEffects

* Update species_base.yml

* System

* refactor

* yml fix

* fix component

* review

* fix yml

* Update disabilities.yml

* StatusEffectMuted -> TraitStatusEffectMuted

* Update misc.yml

* merge

* RemoveStatusEffect

* more review

* cleanup

* merge

* oops

* Send it

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
Co-authored-by: AJCM-git <ajcm_mail@disroot.org>
2026-07-30 03:52:56 +00:00

27 lines
899 B
C#

using Content.Shared.Speech.Components;
using Content.Shared.Actions.Events;
using Content.Shared.ActionBlocker;
using Content.Shared.Chat;
namespace Content.Shared.Speech.EntitySystems;
public sealed partial class SpeakOnActionSystem : EntitySystem
{
[Dependency] private ActionBlockerSystem _actionBlocker = default!;
[Dependency] private SharedChatSystem _chat = default!;
[SubscribeLocalEvent]
private void OnActionPerformed(Entity<SpeakOnActionComponent> ent, ref ActionPerformedEvent args)
{
var user = args.Performer;
// If we can't speak, we can't speak.
if (!HasComp<SpeechComponent>(user) || !_actionBlocker.CanSpeak(user))
return;
if (string.IsNullOrWhiteSpace(ent.Comp.Sentence))
return;
_chat.TrySendInGameICMessage(user, Loc.GetString(ent.Comp.Sentence), InGameICChatType.Speak, false);
}
}