mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-17 14:21:13 +03:00
* 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>
27 lines
899 B
C#
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);
|
|
}
|
|
}
|