]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
global radio toggle for observers (#22137)
authorNemanja <98561806+EmoGarbage404@users.noreply.github.com>
Mon, 4 Dec 2023 23:13:45 +0000 (18:13 -0500)
committerGitHub <noreply@github.com>
Mon, 4 Dec 2023 23:13:45 +0000 (16:13 -0700)
Content.Server/Radio/Components/ActiveRadioComponent.cs
Content.Server/Radio/EntitySystems/RadioSystem.cs
Resources/Prototypes/Entities/Mobs/Player/observer.yml

index 6428c0946e53e6d2cd444e998fd0cc4c9946f668..b0a2adbf9179fef9622fb280bc8b17c9021be1cd 100644 (file)
@@ -15,6 +15,13 @@ public sealed partial class ActiveRadioComponent : Component
     [DataField("channels", customTypeSerializer: typeof(PrototypeIdHashSetSerializer<RadioChannelPrototype>))]
     public HashSet<string> Channels = new();
 
+    /// <summary>
+    /// A toggle for globally receiving all radio channels.
+    /// Overrides <see cref="Channels"/>
+    /// </summary>
+    [DataField, ViewVariables(VVAccess.ReadWrite)]
+    public bool ReceiveAllChannels;
+
     /// <summary>
     ///     If this radio can hear all messages on all maps
     /// </summary>
index fa00514e610c0a15dfbdd1153a9aa9c14ba760c6..92e8139c75c90116e1a720b92bc77a4a405882cb 100644 (file)
@@ -103,8 +103,12 @@ public sealed class RadioSystem : EntitySystem
         var radioQuery = EntityQueryEnumerator<ActiveRadioComponent, TransformComponent>();
         while (canSend && radioQuery.MoveNext(out var receiver, out var radio, out var transform))
         {
-            if (!radio.Channels.Contains(channel.ID) || (TryComp<IntercomComponent>(receiver, out var intercom) && !intercom.SupportedChannels.Contains(channel.ID)))
-                continue;
+            if (!radio.ReceiveAllChannels)
+            {
+                if (!radio.Channels.Contains(channel.ID) || (TryComp<IntercomComponent>(receiver, out var intercom) &&
+                                                             !intercom.SupportedChannels.Contains(channel.ID)))
+                    continue;
+            }
 
             if (!channel.LongRange && transform.MapID != sourceMapId && !radio.GlobalReceive)
                 continue;
index d03281a212f0044825175010490ee07ae1f2b2ce..114c3fa747986b3e5e5d8234c68b8df6dbd7b24e 100644 (file)
   - type: MovementIgnoreGravity
   - type: IntrinsicRadioReceiver
   - type: ActiveRadio
-    channels:
-    - Binary
-    - Common
-    - Command
-    - CentCom
-    - Engineering
-    - Medical
-    - Science
-    - Security
-    - Service
-    - Supply
-    - Syndicate
-    - Freelance
+    receiveAllChannels: true
     globalReceive: true
   - type: Physics
     bodyType: KinematicController