diff --git a/Content.Server/Radio/EntitySystems/RadioDeviceSystem.cs b/Content.Server/Radio/EntitySystems/RadioDeviceSystem.cs index 1ad5d40d65e..4109ae386b6 100644 --- a/Content.Server/Radio/EntitySystems/RadioDeviceSystem.cs +++ b/Content.Server/Radio/EntitySystems/RadioDeviceSystem.cs @@ -223,7 +223,7 @@ private void OnListen(EntityUid uid, RadioMicrophoneComponent component, ListenE private void OnAttemptListen(EntityUid uid, RadioMicrophoneComponent component, ListenAttemptEvent args) { if (component.PowerRequired && !this.IsPowered(uid, EntityManager) - || component.UnobstructedRequired && !_interaction.InRangeUnobstructed(args.Source, uid, 0)) + || component.UnobstructedRequired && !_interaction.InRangeUnobstructed(ResolveListenSource(args.Source), uid, 0)) // Forge-Change { args.Cancel(); } diff --git a/Content.Server/Speech/EntitySystems/ListeningSystem.cs b/Content.Server/Speech/EntitySystems/ListeningSystem.cs index f4a4d0cdd50..048f50bc500 100644 --- a/Content.Server/Speech/EntitySystems/ListeningSystem.cs +++ b/Content.Server/Speech/EntitySystems/ListeningSystem.cs @@ -28,7 +28,8 @@ public void PingListeners(EntityUid source, string message, bool isWhisper) // E // for now, whispering just arbitrarily reduces the listener's max range. var xformQuery = GetEntityQuery(); - var sourceXform = xformQuery.GetComponent(source); + var audioSource = ResolveAudioSource(source); // Forge-Change: station AI speech should be heard from its relayed entity. + var sourceXform = xformQuery.GetComponent(audioSource); var sourcePos = _xforms.GetWorldPosition(sourceXform, xformQuery); var attemptEv = new ListenAttemptEvent(source); diff --git a/Content.Server/_Forge/Radio/EntitySystems/RadioDeviceSystem.Forge.cs b/Content.Server/_Forge/Radio/EntitySystems/RadioDeviceSystem.Forge.cs new file mode 100644 index 00000000000..361f15a2090 --- /dev/null +++ b/Content.Server/_Forge/Radio/EntitySystems/RadioDeviceSystem.Forge.cs @@ -0,0 +1,20 @@ +using Content.Shared.Silicons.StationAi; + +namespace Content.Server.Radio.EntitySystems; + +public sealed partial class RadioDeviceSystem +{ + [Dependency] private SharedStationAiSystem _stationAi = default!; + + private EntityUid ResolveListenSource(EntityUid source) + { + if (HasComp(source) && + _stationAi.TryGetCore(source, out var core) && + core.Comp?.RemoteEntity is { } remoteEntity) + { + return remoteEntity; + } + + return source; + } +} diff --git a/Content.Server/_Forge/Speech/EntitySystems/ListeningSystem.Forge.cs b/Content.Server/_Forge/Speech/EntitySystems/ListeningSystem.Forge.cs new file mode 100644 index 00000000000..e89031e4660 --- /dev/null +++ b/Content.Server/_Forge/Speech/EntitySystems/ListeningSystem.Forge.cs @@ -0,0 +1,20 @@ +using Content.Shared.Silicons.StationAi; + +namespace Content.Server.Speech.EntitySystems; + +public sealed partial class ListeningSystem +{ + [Dependency] private SharedStationAiSystem _stationAi = default!; + + private EntityUid ResolveAudioSource(EntityUid source) + { + if (HasComp(source) && + _stationAi.TryGetCore(source, out var core) && + core.Comp?.RemoteEntity is { } remoteEntity) + { + return remoteEntity; + } + + return source; + } +}