]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Borgs can now speak while in Crit (#21802)
authorSkye <57879983+Rainbeon@users.noreply.github.com>
Sat, 2 Dec 2023 00:25:20 +0000 (19:25 -0500)
committerGitHub <noreply@github.com>
Sat, 2 Dec 2023 00:25:20 +0000 (19:25 -0500)
* Borgs can speak while crit, also radio bug fix

* Revert "Borgs can speak while crit, also radio bug fix"

This reverts commit e1136ad781229cf5fc3cadcf70742168fc73d961.

* Borgs can speak in crit + radio bug fix

* Tied to a new generic component on SpeechComponent

* Ignoring Speech Block via Component uses an event!

* Remove debug logs and bypass if already true

Content.Server/Chat/Systems/ChatSystem.cs
Content.Server/Speech/Components/UnblockableSpeechComponent.cs [new file with mode: 0644]
Content.Server/Speech/EntitySystems/UnblockableSpeechSystem.cs [new file with mode: 0644]
Resources/Prototypes/Entities/Mobs/Cyborgs/base_borg_chassis.yml

index 5fcbf6a051148e08fbd136864fd432f405cd3053..390faab756b780ba82a6ba3cde688f5496afff6b 100644 (file)
@@ -196,6 +196,8 @@ public sealed partial class ChatSystem : SharedChatSystem
         if (!CanSendInGame(message, shell, player))
             return;
 
+        ignoreActionBlocker = CheckIgnoreSpeechBlocker(source, ignoreActionBlocker);
+
         // this method is a disaster
         // every second i have to spend working with this code is fucking agony
         // scientists have to wonder how any of this was merged
@@ -239,7 +241,7 @@ public sealed partial class ChatSystem : SharedChatSystem
         {
             if (TryProccessRadioMessage(source, message, out var modMessage, out var channel))
             {
-                SendEntityWhisper(source, modMessage, range, channel, nameOverride, ignoreActionBlocker);
+                SendEntityWhisper(source, modMessage, range, channel, nameOverride, hideLog, ignoreActionBlocker);
                 return;
             }
         }
@@ -734,6 +736,17 @@ public sealed partial class ChatSystem : SharedChatSystem
 
         return ev.Message;
     }
+    public bool CheckIgnoreSpeechBlocker(EntityUid sender, bool ignoreBlocker)
+    {
+        if (ignoreBlocker)
+            return ignoreBlocker;
+
+        var ev = new CheckIgnoreSpeechBlockerEvent(sender, ignoreBlocker);
+        RaiseLocalEvent(sender, ev, true);
+
+        return ev.IgnoreBlocker;
+    }
 
     private IEnumerable<INetChannel> GetDeadChatClients()
     {
@@ -872,6 +885,18 @@ public sealed class TransformSpeechEvent : EntityEventArgs
     }
 }
 
+public sealed class CheckIgnoreSpeechBlockerEvent : EntityEventArgs
+{
+    public EntityUid Sender;
+    public bool IgnoreBlocker;
+
+    public CheckIgnoreSpeechBlockerEvent(EntityUid sender, bool ignoreBlocker)
+    {
+        Sender = sender;
+        IgnoreBlocker = ignoreBlocker;
+    }
+}
+
 /// <summary>
 ///     Raised on an entity when it speaks, either through 'say' or 'whisper'.
 /// </summary>
diff --git a/Content.Server/Speech/Components/UnblockableSpeechComponent.cs b/Content.Server/Speech/Components/UnblockableSpeechComponent.cs
new file mode 100644 (file)
index 0000000..48e2b98
--- /dev/null
@@ -0,0 +1,7 @@
+namespace Content.Server.Speech.Components
+{
+    [RegisterComponent]
+    public sealed partial class UnblockableSpeechComponent : Component
+    {
+    }
+}
diff --git a/Content.Server/Speech/EntitySystems/UnblockableSpeechSystem.cs b/Content.Server/Speech/EntitySystems/UnblockableSpeechSystem.cs
new file mode 100644 (file)
index 0000000..35a77c3
--- /dev/null
@@ -0,0 +1,18 @@
+using Content.Server.Chat.Systems;
+using Content.Server.Speech.Components;
+
+namespace Content.Server.Speech.EntitySystems
+{
+    public sealed class UnblockableSpeechSystem : EntitySystem
+    {
+        public override void Initialize()
+        {
+            SubscribeLocalEvent<UnblockableSpeechComponent, CheckIgnoreSpeechBlockerEvent>(OnCheck);
+        }
+
+        private void OnCheck(EntityUid uid, UnblockableSpeechComponent component, CheckIgnoreSpeechBlockerEvent args)
+        {
+            args.IgnoreBlocker = true;
+        }
+    }
+}
index fe8e0b53458524fff6f3aaa655c4536cc0875c64..fc2a75780aff988b7f7a227add45e2690c3770e9 100644 (file)
   - type: Speech
     speechVerb: Robotic
     speechSounds: Pai
+  - type: UnblockableSpeech
   - type: Construction
     graph: Cyborg
     containers: