From b165df8b90753c2bd21a5619bd294cbec8199ae7 Mon Sep 17 00:00:00 2001 From: lzk <124214523+lzk228@users.noreply.github.com> Date: Fri, 3 Jan 2025 16:37:03 +0100 Subject: [PATCH] Add telephone tts (#2888) --- Content.Server/Telephone/TelephoneSystem.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Content.Server/Telephone/TelephoneSystem.cs b/Content.Server/Telephone/TelephoneSystem.cs index d4398c76d3f..a340fff3689 100644 --- a/Content.Server/Telephone/TelephoneSystem.cs +++ b/Content.Server/Telephone/TelephoneSystem.cs @@ -6,6 +6,7 @@ using Content.Server.Speech; using Content.Server.Speech.Components; using Content.Shared.Chat; +using Content.Shared.Corvax.TTS; using Content.Shared.Database; using Content.Shared.Mind.Components; using Content.Shared.Power; @@ -109,6 +110,18 @@ private void OnTelephoneMessageReceived(Entity entity, ref T ("originalName", nameEv.VoiceName)); var volume = entity.Comp.SpeakerVolume == TelephoneVolume.Speak ? InGameICChatType.Speak : InGameICChatType.Whisper; + // Corvax-TTS-Start + // If speaker entity has TTS, the telephone will speak with the same voice + if(TryComp(args.MessageSource, out var ttsSpeaker)) + { + EntityManager.EnsureComponent(entity, out var ttsTelephone); + ttsTelephone.VoicePrototypeId = ttsSpeaker.VoicePrototypeId; + } + else // Remove TTS if the speaker has no TTS + { + EntityManager.RemoveComponent(entity); + } + // Corvax-TTS-End _chat.TrySendInGameICMessage(entity, args.Message, volume, ChatTransmitRange.GhostRangeLimit, nameOverride: name, checkRadioPrefix: false); }