From 9378688ffc15fc5ffbbf6d1a4b9ce61a2a813c20 Mon Sep 17 00:00:00 2001 From: SkaldetSkaeg Date: Fri, 26 Apr 2024 14:34:20 +0700 Subject: [PATCH] No echo from handheld radio (#27046) I found the echo from my own radio very annoying. --- Content.Server/Radio/EntitySystems/RadioDeviceSystem.cs | 3 +++ Content.Server/Radio/EntitySystems/RadioSystem.cs | 2 +- Content.Server/Radio/RadioEvent.cs | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Content.Server/Radio/EntitySystems/RadioDeviceSystem.cs b/Content.Server/Radio/EntitySystems/RadioDeviceSystem.cs index ace7d8ae31..d115ec991a 100644 --- a/Content.Server/Radio/EntitySystems/RadioDeviceSystem.cs +++ b/Content.Server/Radio/EntitySystems/RadioDeviceSystem.cs @@ -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); diff --git a/Content.Server/Radio/EntitySystems/RadioSystem.cs b/Content.Server/Radio/EntitySystems/RadioSystem.cs index 5d3074b06b..4341746aaf 100644 --- a/Content.Server/Radio/EntitySystems/RadioSystem.cs +++ b/Content.Server/Radio/EntitySystems/RadioSystem.cs @@ -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); diff --git a/Content.Server/Radio/RadioEvent.cs b/Content.Server/Radio/RadioEvent.cs index 69d764ffe6..fafa66674e 100644 --- a/Content.Server/Radio/RadioEvent.cs +++ b/Content.Server/Radio/RadioEvent.cs @@ -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); /// /// Use this event to cancel sending message per receiver