]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
A few trait fixes (#16062)
authorScribbles0 <91828755+Scribbles0@users.noreply.github.com>
Thu, 4 May 2023 19:02:30 +0000 (12:02 -0700)
committerGitHub <noreply@github.com>
Thu, 4 May 2023 19:02:30 +0000 (12:02 -0700)
Content.Server/Abilities/Mime/MimePowersSystem.cs
Content.Server/Speech/Muting/MutedComponent.cs [moved from Content.Shared/Speech/Muting/MutedComponent.cs with 68% similarity]
Content.Server/Speech/Muting/MutingSystem.cs [new file with mode: 0644]
Content.Shared/Drunk/DrunkSystem.cs
Content.Shared/Speech/Muting/MutingSystem.cs [deleted file]

index 9adc91610d99837e857020a77417986d6d59dd60..02dab8baf0209daf51632be97fc8e610c0c704e9 100644 (file)
@@ -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<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)
         {
@@ -54,36 +52,10 @@ namespace Content.Server.Abilities.Mime
 
         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.
@@ -130,6 +102,7 @@ namespace Content.Server.Abilities.Mime
             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);
@@ -152,6 +125,7 @@ namespace Content.Server.Abilities.Mime
             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);
similarity index 68%
rename from Content.Shared/Speech/Muting/MutedComponent.cs
rename to Content.Server/Speech/Muting/MutedComponent.cs
index ff03be18a8ec3207ed916830ca5adf8e7324705e..1ee39d0289da532e7822a2748818edee23c50501 100644 (file)
@@ -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 (file)
index 0000000..bad6312
--- /dev/null
@@ -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<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();
+        }
+    }
+}
index 3085e78485947d117ffb81158c14f41c6edeb069..6123c071771f4f3afe536d6e557093bc928eac41 100644 (file)
@@ -17,14 +17,14 @@ public abstract class SharedDrunkSystem : EntitySystem
         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);
diff --git a/Content.Shared/Speech/Muting/MutingSystem.cs b/Content.Shared/Speech/Muting/MutingSystem.cs
deleted file mode 100644 (file)
index 3dfc14e..0000000
+++ /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<MutedComponent, SpeakAttemptEvent>(OnSpeakAttempt);
-        }
-
-        private void OnSpeakAttempt(EntityUid uid, MutedComponent component, SpeakAttemptEvent args)
-        {
-            _popupSystem.PopupEntity(Loc.GetString("speech-muted"), uid, uid);
-            args.Cancel();
-        }
-    }
-}