Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Spatison committed Dec 6, 2024
1 parent 3b0dadc commit e3e9232
Showing 1 changed file with 25 additions and 0 deletions.
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

0 comments on commit e3e9232

Please sign in to comment.