Make department radio messages work in default radio (#12834)
This commit is contained in:
@@ -151,11 +151,22 @@ public sealed partial class ChatSystem : SharedChatSystem
|
||||
if (string.IsNullOrEmpty(message))
|
||||
return;
|
||||
|
||||
// This message may have a radio prefix, and should then be whispered to the resolved radio channel
|
||||
if (checkRadioPrefix)
|
||||
{
|
||||
var (radioMessage, channel) = GetRadioPrefix(source, message);
|
||||
if (channel != null)
|
||||
{
|
||||
SendEntityWhisper(source, radioMessage, hideChat, hideGlobalGhostChat, channel, nameOverride);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Otherwise, send whatever type.
|
||||
switch (desiredType)
|
||||
{
|
||||
case InGameICChatType.Speak:
|
||||
SendEntitySpeak(source, message, hideChat, hideGlobalGhostChat, nameOverride, checkRadioPrefix);
|
||||
SendEntitySpeak(source, message, hideChat, hideGlobalGhostChat, nameOverride);
|
||||
break;
|
||||
case InGameICChatType.Whisper:
|
||||
SendEntityWhisper(source, message, hideChat, hideGlobalGhostChat, null, nameOverride);
|
||||
@@ -255,26 +266,12 @@ public sealed partial class ChatSystem : SharedChatSystem
|
||||
|
||||
#region Private API
|
||||
|
||||
private void SendEntitySpeak(EntityUid source, string originalMessage, bool hideChat, bool hideGlobalGhostChat, string? nameOverride, bool checkRadioPrefix)
|
||||
private void SendEntitySpeak(EntityUid source, string originalMessage, bool hideChat, bool hideGlobalGhostChat, string? nameOverride)
|
||||
{
|
||||
if (!_actionBlocker.CanSpeak(source))
|
||||
return;
|
||||
|
||||
RadioChannelPrototype? channel = null;
|
||||
string message;
|
||||
|
||||
if (checkRadioPrefix)
|
||||
(message, channel) = GetRadioPrefix(source, originalMessage);
|
||||
else
|
||||
message = originalMessage;
|
||||
|
||||
if (channel != null)
|
||||
{
|
||||
SendEntityWhisper(source, message, hideChat, hideGlobalGhostChat, channel, nameOverride);
|
||||
return;
|
||||
}
|
||||
|
||||
message = TransformSpeech(source, message);
|
||||
var message = TransformSpeech(source, originalMessage);
|
||||
if (message.Length == 0)
|
||||
return;
|
||||
|
||||
@@ -297,7 +294,7 @@ public sealed partial class ChatSystem : SharedChatSystem
|
||||
|
||||
SendInVoiceRange(ChatChannel.Local, message, wrappedMessage, source, hideChat, hideGlobalGhostChat);
|
||||
|
||||
var ev = new EntitySpokeEvent(source, message, channel, null);
|
||||
var ev = new EntitySpokeEvent(source, message, null, null);
|
||||
RaiseLocalEvent(source, ev, true);
|
||||
|
||||
// To avoid logging any messages sent by entities that are not players, like vendors, cloning, etc.
|
||||
|
||||
Reference in New Issue
Block a user