diff --git a/Content.Server/Abilities/Mime/MimePowersSystem.cs b/Content.Server/Abilities/Mime/MimePowersSystem.cs index 9adc91610d..02dab8baf0 100644 --- a/Content.Server/Abilities/Mime/MimePowersSystem.cs +++ b/Content.Server/Abilities/Mime/MimePowersSystem.cs @@ -15,6 +15,7 @@ using Content.Server.Chat.Systems; 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 { @@ -30,10 +31,7 @@ namespace Content.Server.Abilities.Mime { base.Initialize(); SubscribeLocalEvent(OnComponentInit); - SubscribeLocalEvent(OnSpeakAttempt); SubscribeLocalEvent(OnInvisibleWall); - SubscribeLocalEvent(OnEmote, before: new[] { typeof(VocalSystem) }); - SubscribeLocalEvent(OnScreamAction, before: new[] { typeof(VocalSystem) }); } public override void Update(float frameTime) { @@ -54,36 +52,10 @@ namespace Content.Server.Abilities.Mime private void OnComponentInit(EntityUid uid, MimePowersComponent component, ComponentInit args) { + EnsureComp(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; - } /// /// Creates an invisible wall in a free space after some checks. @@ -130,6 +102,7 @@ namespace Content.Server.Abilities.Mime mimePowers.Enabled = false; mimePowers.VowBroken = true; mimePowers.VowRepentTime = _timing.CurTime + mimePowers.VowCooldown; + RemComp(uid); _alertsSystem.ClearAlert(uid, AlertType.VowOfSilence); _alertsSystem.ShowAlert(uid, AlertType.VowBroken); _actionsSystem.RemoveAction(uid, mimePowers.InvisibleWallAction); @@ -152,6 +125,7 @@ namespace Content.Server.Abilities.Mime mimePowers.Enabled = true; mimePowers.ReadyToRepent = false; mimePowers.VowBroken = false; + AddComp(uid); _alertsSystem.ClearAlert(uid, AlertType.VowBroken); _alertsSystem.ShowAlert(uid, AlertType.VowOfSilence); _actionsSystem.AddAction(uid, mimePowers.InvisibleWallAction, uid); diff --git a/Content.Shared/Speech/Muting/MutedComponent.cs b/Content.Server/Speech/Muting/MutedComponent.cs similarity index 68% rename from Content.Shared/Speech/Muting/MutedComponent.cs rename to Content.Server/Speech/Muting/MutedComponent.cs index ff03be18a8..1ee39d0289 100644 --- a/Content.Shared/Speech/Muting/MutedComponent.cs +++ b/Content.Server/Speech/Muting/MutedComponent.cs @@ -1,4 +1,4 @@ -namespace Content.Shared.Speech.Muting +namespace Content.Server.Speech.Muting { [RegisterComponent] public sealed class MutedComponent : Component diff --git a/Content.Server/Speech/Muting/MutingSystem.cs b/Content.Server/Speech/Muting/MutingSystem.cs new file mode 100644 index 0000000000..bad6312445 --- /dev/null +++ b/Content.Server/Speech/Muting/MutingSystem.cs @@ -0,0 +1,54 @@ +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(OnSpeakAttempt); + SubscribeLocalEvent(OnEmote, before: new[] { typeof(VocalSystem) }); + SubscribeLocalEvent(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(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(uid)) + _popupSystem.PopupEntity(Loc.GetString("mime-cant-speak"), uid, uid); + else + _popupSystem.PopupEntity(Loc.GetString("speech-muted"), uid, uid); + args.Cancel(); + } + } +} diff --git a/Content.Shared/Drunk/DrunkSystem.cs b/Content.Shared/Drunk/DrunkSystem.cs index 3085e78485..6123c07177 100644 --- a/Content.Shared/Drunk/DrunkSystem.cs +++ b/Content.Shared/Drunk/DrunkSystem.cs @@ -17,14 +17,14 @@ public abstract class SharedDrunkSystem : EntitySystem if (!Resolve(uid, ref status, false)) return; + if (TryComp(uid, out var trait)) + boozePower *= trait.BoozeStrengthMultiplier; + if (applySlur) { _slurredSystem.DoSlur(uid, TimeSpan.FromSeconds(boozePower), status); } - if (TryComp(uid, out var trait)) - boozePower *= trait.BoozeStrengthMultiplier; - if (!_statusEffectsSystem.HasStatusEffect(uid, DrunkKey, status)) { _statusEffectsSystem.TryAddStatusEffect(uid, DrunkKey, TimeSpan.FromSeconds(boozePower), true, status); diff --git a/Content.Shared/Speech/Muting/MutingSystem.cs b/Content.Shared/Speech/Muting/MutingSystem.cs deleted file mode 100644 index 3dfc14e521..0000000000 --- a/Content.Shared/Speech/Muting/MutingSystem.cs +++ /dev/null @@ -1,21 +0,0 @@ -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(OnSpeakAttempt); - } - - private void OnSpeakAttempt(EntityUid uid, MutedComponent component, SpeakAttemptEvent args) - { - _popupSystem.PopupEntity(Loc.GetString("speech-muted"), uid, uid); - args.Cancel(); - } - } -}