Make chat & examine systems use FormattedMessage.EscapeText() (#28431)
This commit is contained in:
@@ -239,9 +239,7 @@ namespace Content.Client.Examine
|
|||||||
|
|
||||||
if (knowTarget)
|
if (knowTarget)
|
||||||
{
|
{
|
||||||
// TODO: FormattedMessage.RemoveMarkupPermissive
|
var itemName = FormattedMessage.EscapeText(Identity.Name(target, EntityManager, player));
|
||||||
// var itemName = FormattedMessage.RemoveMarkupPermissive(Identity.Name(target, EntityManager, player));
|
|
||||||
var itemName = FormattedMessage.FromMarkupPermissive(Identity.Name(target, EntityManager, player)).ToString();
|
|
||||||
var labelMessage = FormattedMessage.FromMarkupPermissive($"[bold]{itemName}[/bold]");
|
var labelMessage = FormattedMessage.FromMarkupPermissive($"[bold]{itemName}[/bold]");
|
||||||
var label = new RichTextLabel();
|
var label = new RichTextLabel();
|
||||||
label.SetMessage(labelMessage);
|
label.SetMessage(labelMessage);
|
||||||
@@ -250,7 +248,7 @@ namespace Content.Client.Examine
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
var label = new RichTextLabel();
|
var label = new RichTextLabel();
|
||||||
label.SetMessage(FormattedMessage.FromMarkup("[bold]???[/bold]"));
|
label.SetMessage(FormattedMessage.FromMarkupOrThrow("[bold]???[/bold]"));
|
||||||
hBox.AddChild(label);
|
hBox.AddChild(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -378,7 +378,7 @@ public sealed partial class ChatSystem : SharedChatSystem
|
|||||||
if (!_actionBlocker.CanSpeak(source) && !ignoreActionBlocker)
|
if (!_actionBlocker.CanSpeak(source) && !ignoreActionBlocker)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var message = TransformSpeech(source, FormattedMessage.RemoveMarkup(originalMessage));
|
var message = TransformSpeech(source, originalMessage);
|
||||||
|
|
||||||
if (message.Length == 0)
|
if (message.Length == 0)
|
||||||
return;
|
return;
|
||||||
@@ -417,7 +417,7 @@ public sealed partial class ChatSystem : SharedChatSystem
|
|||||||
|
|
||||||
// To avoid logging any messages sent by entities that are not players, like vendors, cloning, etc.
|
// 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)
|
if (!HasComp<ActorComponent>(source) || hideLog)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (originalMessage == message)
|
if (originalMessage == message)
|
||||||
|
|||||||
@@ -11,8 +11,19 @@ namespace Content.Shared.Chat
|
|||||||
public sealed class ChatMessage
|
public sealed class ChatMessage
|
||||||
{
|
{
|
||||||
public ChatChannel Channel;
|
public ChatChannel Channel;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This is the text spoken by the entity, after accents and such were applied.
|
||||||
|
/// This should have <see cref="FormattedMessage.EscapeText"/> applied before using it in any rich text box.
|
||||||
|
/// </summary>
|
||||||
public string Message;
|
public string Message;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This is the <see cref="Message"/> but with special characters escaped and wrapped in some rich text
|
||||||
|
/// formatting tags.
|
||||||
|
/// </summary>
|
||||||
public string WrappedMessage;
|
public string WrappedMessage;
|
||||||
|
|
||||||
public NetEntity SenderEntity;
|
public NetEntity SenderEntity;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user