Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Content.Client/_DEN/Denu/Modules/Chat/FormatterModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ private static MessageFormatter.FormatterConfig CreateFormatterConfig()
{
new("***", "[bolditalic]", "[/bolditalic]", false, false),
new("**", "[bold]", "[/bold]", false, false),
new("\"", "[color={DialogueColor}]\"", "\"[/color]", false, true),
new("\"", "\"[color={DialogueColor}]", "[/color]\"", false, true),
new("*", "[italic]", "[/italic]", true, false),
new("*", "[italic][color={EmoteColor}]*", "*[/color][/italic]", false, false),
},
Expand Down
2 changes: 2 additions & 0 deletions Content.Server/Radio/EntitySystems/RadioSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ public void SendRadioMessage(EntityUid messageSource,
channel.LocalizedName,
channel.Color);

Log.Debug("Radio: " + wrappedMessage);

if (name != Name(messageSource))
_adminLogger.Add(LogType.Chat, LogImpact.Low, $"Radio message from {ToPrettyString(messageSource):user} as {name} on {channel.LocalizedName}: {unwrappedMessage}");
else
Expand Down
19 changes: 9 additions & 10 deletions Content.Server/_DEN/Chat/Systems/ChatSystem.Language.cs
Original file line number Diff line number Diff line change
Expand Up @@ -393,19 +393,18 @@ public void SendComplexMessageToEntity(EntityUid source,
// Combine tags back into emotes and dialog so they can be formatted.
List<(ChatPart, string)> mergedParts = [];
var workingSet = message.Parts;
Log.Debug("====== BEFORE ======");
foreach (var (kind, part) in workingSet)
{
Log.Debug("Got " + kind + ": [" + part + "]");
}
var lastSeen = workingSet[0];
for (int i = 0; i < workingSet.Count; i++)
for (int i = 1; i < workingSet.Count; i++)
{
if (i == 0)
{
lastSeen = workingSet[0];
continue;
}

var current = workingSet[i];
// Matching Dialog or Emote.
if ((lastSeen.Item1 is ChatPart.Dialog or ChatPart.DialogTag
&& current.Item1 is ChatPart.Dialog or ChatPart.DialogTag)
&& current.Item1 is ChatPart.Dialog or ChatPart.DialogTag)
|| (lastSeen.Item1 is ChatPart.Emote or ChatPart.EmoteTag
&& current.Item1 is ChatPart.Emote or ChatPart.EmoteTag))
{
Expand All @@ -423,12 +422,12 @@ public void SendComplexMessageToEntity(EntityUid source,
}
}
mergedParts.Add(lastSeen);

// Loop over the parts of the complex speech.
// Dialog gets a lot of special formatting where as emotes just get default action formatting.
foreach (var (kind, part) in mergedParts)
{
if (kind == ChatPart.Dialog)
if (kind == ChatPart.Dialog || kind == ChatPart.DialogTag)
{
unwrappedBuilder.Append(message.Delimiter + part + message.Delimiter);
wrappedBuilder.Append(message.Delimiter);
Expand Down
15 changes: 8 additions & 7 deletions Content.Shared/_DEN/Chat/SharedChatSystem.Language.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System.Linq;
using Content.Shared._DEN.CCVar;
using Content.Shared._DEN.Language;
using Content.Shared._DEN.Utility;
using Content.Shared.Speech;
using Robust.Shared.Configuration;
using Robust.Shared.Prototypes;
Expand Down Expand Up @@ -53,7 +52,7 @@ public ComplexChatMessage ObfuscateComplexChatMessage(ComplexChatMessage message
/// <returns>The correct speech verb prototype to use.</returns>
public SpeechVerbPrototype GetComplexSpeechVerb(EntityUid source, ComplexChatMessage message, LanguagePrototype language, ChatChannel channel)
{
var lastDialog = message.Parts.LastOrDefault(p => p.Item1 == ChatPart.Dialog).Item2;
var lastDialog = message.Parts.LastOrDefault(p => p.Item1 == ChatPart.Dialog).Item2 ?? "";

SpeechVerbPrototype? current = null;
Dictionary<LocId, ProtoId<SpeechVerbPrototype>>? currentSuffixVerbs = null;
Expand Down Expand Up @@ -178,28 +177,30 @@ public ComplexChatMessage(string message, string delimiter, bool isDetailed, boo
return;
}

var outside = false;
var outside = true;
foreach (var hunk in parsedMsg.Nodes)
{
if (!hunk.IsPlainText)
{
parts.Add((outside ? ChatPart.DialogTag : ChatPart.EmoteTag, hunk.ToString()));
parts.Add((outside ? ChatPart.EmoteTag : ChatPart.DialogTag, hunk.ToString()));
continue;
}

// Don't swap output between tags.
var pieces = hunk.ToString().Split(Delimiter);
if (pieces.Length == 1 && !string.IsNullOrEmpty(pieces[0]))
{
parts.Add((outside ? ChatPart.Dialog : ChatPart.Emote, pieces[0]));
parts.Add((outside ? ChatPart.Emote : ChatPart.Dialog, pieces[0]));
continue;
}

foreach (var msgChunk in pieces)
{
if (!string.IsNullOrEmpty(msgChunk))
parts.Add((outside ? ChatPart.Dialog : ChatPart.Emote, msgChunk));
outside = !outside;
{
parts.Add((outside ? ChatPart.Emote : ChatPart.Dialog, msgChunk));
outside = !outside;
}
}
}

Expand Down
Loading