]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
No echo from handheld radio (#27046)
authorSkaldetSkaeg <impotekh@gmail.com>
Fri, 26 Apr 2024 07:34:20 +0000 (14:34 +0700)
committerGitHub <noreply@github.com>
Fri, 26 Apr 2024 07:34:20 +0000 (17:34 +1000)
I found the echo from my own radio very annoying.

Content.Server/Radio/EntitySystems/RadioDeviceSystem.cs
Content.Server/Radio/EntitySystems/RadioSystem.cs
Content.Server/Radio/RadioEvent.cs

index ace7d8ae31ade069cadf08dad9770eceab162d34..d115ec991a7c97d030689cb896855a9a7501ccad 100644 (file)
@@ -201,6 +201,9 @@ public sealed class RadioDeviceSystem : EntitySystem
 
     private void OnReceiveRadio(EntityUid uid, RadioSpeakerComponent component, ref RadioReceiveEvent args)
     {
+        if (uid == args.RadioSource)
+            return;
+
         var nameEv = new TransformSpeakerNameEvent(args.MessageSource, Name(args.MessageSource));
         RaiseLocalEvent(args.MessageSource, nameEv);
 
index 5d3074b06b61dbe522b5835c5d40dd37554ac8e0..4341746aafe3493016290fc33bea93c8a7a62a2f 100644 (file)
@@ -112,7 +112,7 @@ public sealed class RadioSystem : EntitySystem
             NetEntity.Invalid,
             null);
         var chatMsg = new MsgChatMessage { Message = chat };
-        var ev = new RadioReceiveEvent(message, messageSource, channel, chatMsg);
+        var ev = new RadioReceiveEvent(message, messageSource, channel, radioSource, chatMsg);
 
         var sendAttemptEv = new RadioSendAttemptEvent(channel, radioSource);
         RaiseLocalEvent(ref sendAttemptEv);
index 69d764ffe67d9985d90b26437d7d58dec4ef9795..fafa66674e3d5e2d73a3eaec9604e8d28fb809eb 100644 (file)
@@ -4,7 +4,7 @@ using Content.Shared.Radio;
 namespace Content.Server.Radio;
 
 [ByRefEvent]
-public readonly record struct RadioReceiveEvent(string Message, EntityUid MessageSource, RadioChannelPrototype Channel, MsgChatMessage ChatMsg);
+public readonly record struct RadioReceiveEvent(string Message, EntityUid MessageSource, RadioChannelPrototype Channel, EntityUid RadioSource, MsgChatMessage ChatMsg);
 
 /// <summary>
 /// Use this event to cancel sending message per receiver