Speech verbs & conditional markup modification (#18980)
This commit is contained in:
@@ -14,6 +14,7 @@ using Content.Shared.Popups;
|
||||
using Robust.Shared.Map;
|
||||
using Content.Shared.Radio.Components;
|
||||
using Content.Server.Power.Components;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
namespace Content.Server.Radio.EntitySystems;
|
||||
|
||||
@@ -25,7 +26,9 @@ public sealed class RadioSystem : EntitySystem
|
||||
[Dependency] private readonly INetManager _netMan = default!;
|
||||
[Dependency] private readonly IReplayRecordingManager _replay = default!;
|
||||
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly PopupSystem _popup = default!;
|
||||
[Dependency] private readonly ChatSystem _chat = default!;
|
||||
|
||||
// set used to prevent radio feedback loops.
|
||||
private readonly HashSet<string> _messages = new();
|
||||
@@ -69,11 +72,22 @@ public sealed class RadioSystem : EntitySystem
|
||||
|
||||
name = FormattedMessage.EscapeText(name);
|
||||
|
||||
var speech = _chat.GetSpeechVerb(messageSource, message);
|
||||
|
||||
var wrappedMessage = Loc.GetString(speech.Bold ? "chat-radio-message-wrap-bold" : "chat-radio-message-wrap",
|
||||
("color", channel.Color),
|
||||
("fontType", speech.FontId),
|
||||
("fontSize", speech.FontSize),
|
||||
("verb", Loc.GetString(_random.Pick(speech.SpeechVerbStrings))),
|
||||
("channel", $"\\[{channel.LocalizedName}\\]"),
|
||||
("name", name),
|
||||
("message", FormattedMessage.EscapeText(message)));
|
||||
|
||||
// most radios are relayed to chat, so lets parse the chat message beforehand
|
||||
var chat = new ChatMessage(
|
||||
ChatChannel.Radio,
|
||||
message,
|
||||
Loc.GetString("chat-radio-message-wrap", ("color", channel.Color), ("channel", $"\\[{channel.LocalizedName}\\]"), ("name", name), ("message", FormattedMessage.EscapeText(message))),
|
||||
wrappedMessage,
|
||||
EntityUid.Invalid);
|
||||
var chatMsg = new MsgChatMessage { Message = chat };
|
||||
var ev = new RadioReceiveEvent(message, messageSource, channel, chatMsg);
|
||||
|
||||
Reference in New Issue
Block a user