LOOC will appear on top of your head (#21514)

* Oh well

* Minor fixing up

* HOLY BINGLE I DID IT

* TOGGLE!
This commit is contained in:
Vasilis
2023-11-09 10:18:58 +01:00
committed by GitHub
parent e355541c04
commit 2f2d237f86
6 changed files with 48 additions and 10 deletions

View File

@@ -369,7 +369,7 @@ public sealed class ChatUIController : UIController
UpdateChannelPermissions();
}
private void AddSpeechBubble(ChatMessage msg, SpeechBubble.SpeechType speechType)
private void AddSpeechBubble(ChatMessage msg, SpeechBubble.SpeechType speechType, string? prefixText = null, string? prefixEndText = null)
{
var ent = EntityManager.GetEntity(msg.SenderEntity);
@@ -379,8 +379,11 @@ public sealed class ChatUIController : UIController
return;
}
// Kind of shitty way to add prefixes but hey it works!
string Message = prefixText + msg.Message + prefixEndText;
// msg.Message should be the string that a user sent over text, without any added markup.
var messages = SplitMessage(msg.Message);
var messages = SplitMessage(Message);
foreach (var message in messages)
{
@@ -843,6 +846,15 @@ public sealed class ChatUIController : UIController
case ChatChannel.Emotes:
AddSpeechBubble(msg, SpeechBubble.SpeechType.Emote);
break;
case ChatChannel.LOOC:
if (_cfg.GetCVar(CCVars.LoocAboveHeadShow))
{
const string prefixText = "(LOOC: ";
const string prefixEndText = ")";
AddSpeechBubble(msg, SpeechBubble.SpeechType.Looc, prefixText, prefixEndText);
}
break;
}
}