Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] TTS #140

Merged
merged 1 commit into from
Dec 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions Content.Server/Chat/Systems/ChatSystem.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Globalization;
using System.Linq;
using System.Text;
using Content.Server._White.TTS;
using Content.Server.Administration.Logs;
using Content.Server.Administration.Managers;
using Content.Server.Chat.Managers;
Expand Down Expand Up @@ -709,6 +710,11 @@ private MessageRangeCheckResult MessageRangeCheck(ICommonSession session, ICChat
private void SendInVoiceRange(ChatChannel channel, string name, string message, string wrappedMessage, string obfuscated, string obfuscatedWrappedMessage, EntityUid source, ChatTransmitRange range, NetUserId? author = null, LanguagePrototype? languageOverride = null)
{
var language = languageOverride ?? _language.GetLanguage(source);

// WD EDIT START
var orgMsg = new HashSet<ICommonSession>();
var obsMsg = new HashSet<ICommonSession>();
// WD EDIT END
foreach (var (session, data) in GetRecipients(source, Transform(source).GridUid == null ? 0.3f : VoiceRange))
{
if (session.AttachedEntity != null
Expand All @@ -728,15 +734,34 @@ private void SendInVoiceRange(ChatChannel channel, string name, string message,
// If the channel does not support languages, or the entity can understand the message, send the original message, otherwise send the obfuscated version
if (channel == ChatChannel.LOOC || channel == ChatChannel.Emotes || _language.CanUnderstand(listener, language.ID))
{
orgMsg.Add(session); // WD EDIT
_chatManager.ChatMessageToOne(channel, message, wrappedMessage, source, entHideChat, session.Channel, author: author);
}
else
{
obsMsg.Add(session); // WD EDIT
_chatManager.ChatMessageToOne(channel, obfuscated, obfuscatedWrappedMessage, source, entHideChat, session.Channel, author: author);
}
}

_replay.RecordServerMessage(new ChatMessage(channel, message, wrappedMessage, GetNetEntity(source), null, MessageRangeHideChatForReplay(range)));

// WD EDIT START
if ((orgMsg.Count > 0 || obsMsg.Count > 0) && (channel & ChatChannel.Local) != 0)
{
RaiseLocalEvent(source,
new EntitySpokeLanguageEvent(
Filter.Empty().AddPlayers(orgMsg),
Filter.Empty().AddPlayers(obsMsg),
source,
message,
wrappedMessage,
null,
false,
obfuscated)
);
}
// WD EDIT END
}

/// <summary>
Expand Down
Loading