Clean out tags when attempting to speak/whisper/emote (#23055)
A few bugs have popped up where (legal) string formatting tags have been duplicated out into whisper and local. Using the RemoveMarkup static we can sanitize attempted speech to remove markup.
This commit is contained in:
committed by
GitHub
parent
530e3c4add
commit
84f544ff10
@@ -384,7 +384,8 @@ public sealed partial class ChatSystem : SharedChatSystem
|
||||
if (!_actionBlocker.CanSpeak(source) && !ignoreActionBlocker)
|
||||
return;
|
||||
|
||||
var message = TransformSpeech(source, originalMessage);
|
||||
var message = TransformSpeech(source, FormattedMessage.RemoveMarkup(originalMessage));
|
||||
|
||||
if (message.Length == 0)
|
||||
return;
|
||||
|
||||
@@ -416,7 +417,7 @@ public sealed partial class ChatSystem : SharedChatSystem
|
||||
RaiseLocalEvent(source, ev, true);
|
||||
|
||||
// To avoid logging any messages sent by entities that are not players, like vendors, cloning, etc.
|
||||
// Also doesn't log if hideLog is true.
|
||||
// Also doesn't log if hideLog is true.
|
||||
if (!HasComp<ActorComponent>(source) || hideLog == true)
|
||||
return;
|
||||
|
||||
@@ -451,7 +452,7 @@ public sealed partial class ChatSystem : SharedChatSystem
|
||||
if (!_actionBlocker.CanSpeak(source) && !ignoreActionBlocker)
|
||||
return;
|
||||
|
||||
var message = TransformSpeech(source, originalMessage);
|
||||
var message = TransformSpeech(source, FormattedMessage.RemoveMarkup(originalMessage));
|
||||
if (message.Length == 0)
|
||||
return;
|
||||
|
||||
@@ -473,7 +474,6 @@ public sealed partial class ChatSystem : SharedChatSystem
|
||||
}
|
||||
name = FormattedMessage.EscapeText(name);
|
||||
|
||||
|
||||
var wrappedMessage = Loc.GetString("chat-manager-entity-whisper-wrap-message",
|
||||
("entityName", name), ("message", FormattedMessage.EscapeText(message)));
|
||||
|
||||
@@ -551,7 +551,7 @@ public sealed partial class ChatSystem : SharedChatSystem
|
||||
var wrappedMessage = Loc.GetString("chat-manager-entity-me-wrap-message",
|
||||
("entityName", name),
|
||||
("entity", ent),
|
||||
("message", FormattedMessage.EscapeText(action)));
|
||||
("message", FormattedMessage.RemoveMarkup(action)));
|
||||
|
||||
if (checkEmote)
|
||||
TryEmoteChatInput(source, action);
|
||||
@@ -614,7 +614,8 @@ public sealed partial class ChatSystem : SharedChatSystem
|
||||
|
||||
#region Utility
|
||||
|
||||
private enum MessageRangeCheckResult {
|
||||
private enum MessageRangeCheckResult
|
||||
{
|
||||
Disallowed,
|
||||
HideChat,
|
||||
Full
|
||||
@@ -797,7 +798,7 @@ public sealed partial class ChatSystem : SharedChatSystem
|
||||
|
||||
foreach (var player in _playerManager.Sessions)
|
||||
{
|
||||
if (player.AttachedEntity is not {Valid: true} playerEntity)
|
||||
if (player.AttachedEntity is not { Valid: true } playerEntity)
|
||||
continue;
|
||||
|
||||
var transformEntity = xforms.GetComponent(playerEntity);
|
||||
|
||||
Reference in New Issue
Block a user