Skip to content

Commit

Permalink
Add telephone tts (#2888)
Browse files Browse the repository at this point in the history
  • Loading branch information
lzk228 authored Jan 3, 2025
1 parent 26f63c0 commit b165df8
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Content.Server/Telephone/TelephoneSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -109,6 +110,18 @@ private void OnTelephoneMessageReceived(Entity<TelephoneComponent> 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<TTSComponent>(args.MessageSource, out var ttsSpeaker))
{
EntityManager.EnsureComponent<TTSComponent>(entity, out var ttsTelephone);
ttsTelephone.VoicePrototypeId = ttsSpeaker.VoicePrototypeId;
}
else // Remove TTS if the speaker has no TTS
{
EntityManager.RemoveComponent<TTSComponent>(entity);
}
// Corvax-TTS-End
_chat.TrySendInGameICMessage(entity, args.Message, volume, ChatTransmitRange.GhostRangeLimit, nameOverride: name, checkRadioPrefix: false);
}

Expand Down

0 comments on commit b165df8

Please sign in to comment.