using Content.Server.Speech.Components;
using Content.Shared.Chat.Prototypes;
using Content.Server.Speech.EntitySystems;
+using Content.Server.Speech.Muting;
namespace Content.Server.Abilities.Mime
{
{
base.Initialize();
SubscribeLocalEvent<MimePowersComponent, ComponentInit>(OnComponentInit);
- SubscribeLocalEvent<MimePowersComponent, SpeakAttemptEvent>(OnSpeakAttempt);
SubscribeLocalEvent<MimePowersComponent, InvisibleWallActionEvent>(OnInvisibleWall);
- SubscribeLocalEvent<MimePowersComponent, EmoteEvent>(OnEmote, before: new[] { typeof(VocalSystem) });
- SubscribeLocalEvent<MimePowersComponent, ScreamActionEvent>(OnScreamAction, before: new[] { typeof(VocalSystem) });
}
public override void Update(float frameTime)
{
private void OnComponentInit(EntityUid uid, MimePowersComponent component, ComponentInit args)
{
+ EnsureComp<MutedComponent>(uid);
_actionsSystem.AddAction(uid, component.InvisibleWallAction, uid);
_alertsSystem.ShowAlert(uid, AlertType.VowOfSilence);
}
- private void OnSpeakAttempt(EntityUid uid, MimePowersComponent component, SpeakAttemptEvent args)
- {
- if (!component.Enabled)
- return;
-
- _popupSystem.PopupEntity(Loc.GetString("mime-cant-speak"), uid, uid);
- args.Cancel();
- }
-
- private void OnEmote(EntityUid uid, MimePowersComponent component, ref EmoteEvent args)
- {
- if (!component.Enabled || args.Handled)
- return;
-
- //still leaves the text so it looks like they are pantomiming a laugh
- if (args.Emote.Category.HasFlag(EmoteCategory.Vocal))
- args.Handled = true;
- }
-
- private void OnScreamAction(EntityUid uid, MimePowersComponent component, ScreamActionEvent args)
- {
- if (!component.Enabled || args.Handled)
- return;
-
- _popupSystem.PopupEntity(Loc.GetString("mime-cant-speak"), uid, uid);
- args.Handled = true;
- }
/// <summary>
/// Creates an invisible wall in a free space after some checks.
mimePowers.Enabled = false;
mimePowers.VowBroken = true;
mimePowers.VowRepentTime = _timing.CurTime + mimePowers.VowCooldown;
+ RemComp<MutedComponent>(uid);
_alertsSystem.ClearAlert(uid, AlertType.VowOfSilence);
_alertsSystem.ShowAlert(uid, AlertType.VowBroken);
_actionsSystem.RemoveAction(uid, mimePowers.InvisibleWallAction);
mimePowers.Enabled = true;
mimePowers.ReadyToRepent = false;
mimePowers.VowBroken = false;
+ AddComp<MutedComponent>(uid);
_alertsSystem.ClearAlert(uid, AlertType.VowBroken);
_alertsSystem.ShowAlert(uid, AlertType.VowOfSilence);
_actionsSystem.AddAction(uid, mimePowers.InvisibleWallAction, uid);
-namespace Content.Shared.Speech.Muting
+namespace Content.Server.Speech.Muting
{
[RegisterComponent]
public sealed class MutedComponent : Component
--- /dev/null
+using Content.Server.Abilities.Mime;
+using Content.Server.Chat.Systems;
+using Content.Server.Popups;
+using Content.Server.Speech.Components;
+using Content.Server.Speech.EntitySystems;
+using Content.Shared.Chat.Prototypes;
+using Content.Shared.Speech;
+
+namespace Content.Server.Speech.Muting
+{
+ public sealed class MutingSystem : EntitySystem
+ {
+ [Dependency] private readonly PopupSystem _popupSystem = default!;
+ public override void Initialize()
+ {
+ base.Initialize();
+ SubscribeLocalEvent<MutedComponent, SpeakAttemptEvent>(OnSpeakAttempt);
+ SubscribeLocalEvent<MutedComponent, EmoteEvent>(OnEmote, before: new[] { typeof(VocalSystem) });
+ SubscribeLocalEvent<MutedComponent, ScreamActionEvent>(OnScreamAction, before: new[] { typeof(VocalSystem) });
+ }
+
+ private void OnEmote(EntityUid uid, MutedComponent component, ref EmoteEvent args)
+ {
+ if (args.Handled)
+ return;
+
+ //still leaves the text so it looks like they are pantomiming a laugh
+ if (args.Emote.Category.HasFlag(EmoteCategory.Vocal))
+ args.Handled = true;
+ }
+
+ private void OnScreamAction(EntityUid uid, MutedComponent component, ScreamActionEvent args)
+ {
+ if (args.Handled)
+ return;
+
+ if (HasComp<MimePowersComponent>(uid))
+ _popupSystem.PopupEntity(Loc.GetString("mime-cant-speak"), uid, uid);
+ else
+ _popupSystem.PopupEntity(Loc.GetString("speech-muted"), uid, uid);
+ args.Handled = true;
+ }
+
+
+ private void OnSpeakAttempt(EntityUid uid, MutedComponent component, SpeakAttemptEvent args)
+ {
+ if (HasComp<MimePowersComponent>(uid))
+ _popupSystem.PopupEntity(Loc.GetString("mime-cant-speak"), uid, uid);
+ else
+ _popupSystem.PopupEntity(Loc.GetString("speech-muted"), uid, uid);
+ args.Cancel();
+ }
+ }
+}
if (!Resolve(uid, ref status, false))
return;
+ if (TryComp<LightweightDrunkComponent>(uid, out var trait))
+ boozePower *= trait.BoozeStrengthMultiplier;
+
if (applySlur)
{
_slurredSystem.DoSlur(uid, TimeSpan.FromSeconds(boozePower), status);
}
- if (TryComp<LightweightDrunkComponent>(uid, out var trait))
- boozePower *= trait.BoozeStrengthMultiplier;
-
if (!_statusEffectsSystem.HasStatusEffect(uid, DrunkKey, status))
{
_statusEffectsSystem.TryAddStatusEffect<DrunkComponent>(uid, DrunkKey, TimeSpan.FromSeconds(boozePower), true, status);
+++ /dev/null
-using Content.Shared.Popups;
-using Robust.Shared.Player;
-
-namespace Content.Shared.Speech.Muting
-{
- public sealed class MutingSystem : EntitySystem
- {
- [Dependency] private readonly SharedPopupSystem _popupSystem = default!;
- public override void Initialize()
- {
- base.Initialize();
- SubscribeLocalEvent<MutedComponent, SpeakAttemptEvent>(OnSpeakAttempt);
- }
-
- private void OnSpeakAttempt(EntityUid uid, MutedComponent component, SpeakAttemptEvent args)
- {
- _popupSystem.PopupEntity(Loc.GetString("speech-muted"), uid, uid);
- args.Cancel();
- }
- }
-}