diff --git a/Content.Client/Chat/UI/SpeechBubble.cs b/Content.Client/Chat/UI/SpeechBubble.cs index b6b336f1dc..46a9f05392 100644 --- a/Content.Client/Chat/UI/SpeechBubble.cs +++ b/Content.Client/Chat/UI/SpeechBubble.cs @@ -4,6 +4,7 @@ using Robust.Client.Graphics; using Robust.Client.UserInterface; using Robust.Client.UserInterface.Controls; using Robust.Shared.Timing; +using Robust.Shared.Utility; namespace Content.Client.Chat.UI { @@ -13,7 +14,8 @@ namespace Content.Client.Chat.UI { Emote, Say, - Whisper + Whisper, + Looc } /// @@ -60,12 +62,15 @@ namespace Content.Client.Chat.UI case SpeechType.Whisper: return new TextSpeechBubble(text, senderEntity, eyeManager, chatManager, entityManager, "whisperBox"); + case SpeechType.Looc: + return new TextSpeechBubble(text, senderEntity, eyeManager, chatManager, entityManager, "emoteBox", Color.FromHex("#48d1cc")); + default: throw new ArgumentOutOfRangeException(); } } - public SpeechBubble(string text, EntityUid senderEntity, IEyeManager eyeManager, IChatManager chatManager, IEntityManager entityManager, string speechStyleClass) + public SpeechBubble(string text, EntityUid senderEntity, IEyeManager eyeManager, IChatManager chatManager, IEntityManager entityManager, string speechStyleClass, Color? fontColor = null) { _chatManager = chatManager; _senderEntity = senderEntity; @@ -75,7 +80,7 @@ namespace Content.Client.Chat.UI // Use text clipping so new messages don't overlap old ones being pushed up. RectClipContent = true; - var bubble = BuildBubble(text, speechStyleClass); + var bubble = BuildBubble(text, speechStyleClass, fontColor); AddChild(bubble); @@ -86,7 +91,7 @@ namespace Content.Client.Chat.UI _verticalOffsetAchieved = -ContentSize.Y; } - protected abstract Control BuildBubble(string text, string speechStyleClass); + protected abstract Control BuildBubble(string text, string speechStyleClass, Color? fontColor = null); protected override void FrameUpdate(FrameEventArgs args) { @@ -164,18 +169,29 @@ namespace Content.Client.Chat.UI public sealed class TextSpeechBubble : SpeechBubble { - public TextSpeechBubble(string text, EntityUid senderEntity, IEyeManager eyeManager, IChatManager chatManager, IEntityManager entityManager, string speechStyleClass) - : base(text, senderEntity, eyeManager, chatManager, entityManager, speechStyleClass) + public TextSpeechBubble(string text, EntityUid senderEntity, IEyeManager eyeManager, IChatManager chatManager, IEntityManager entityManager, string speechStyleClass, Color? fontColor = null) + : base(text, senderEntity, eyeManager, chatManager, entityManager, speechStyleClass, fontColor) { } - protected override Control BuildBubble(string text, string speechStyleClass) + protected override Control BuildBubble(string text, string speechStyleClass, Color? fontColor = null) { var label = new RichTextLabel { MaxWidth = 256, }; - label.SetMessage(text); + + if (fontColor != null) + { + var msg = new FormattedMessage(); + msg.PushColor(fontColor.Value); + msg.AddMarkup(text); + label.SetMessage(msg); + } + else + { + label.SetMessage(text); + } var panel = new PanelContainer { diff --git a/Content.Client/Options/UI/Tabs/GraphicsTab.xaml b/Content.Client/Options/UI/Tabs/GraphicsTab.xaml index 41b304417a..f759c78eca 100644 --- a/Content.Client/Options/UI/Tabs/GraphicsTab.xaml +++ b/Content.Client/Options/UI/Tabs/GraphicsTab.xaml @@ -22,6 +22,7 @@ + diff --git a/Content.Client/Options/UI/Tabs/GraphicsTab.xaml.cs b/Content.Client/Options/UI/Tabs/GraphicsTab.xaml.cs index 852a3c2866..e64838ba75 100644 --- a/Content.Client/Options/UI/Tabs/GraphicsTab.xaml.cs +++ b/Content.Client/Options/UI/Tabs/GraphicsTab.xaml.cs @@ -103,6 +103,7 @@ namespace Content.Client.Options.UI.Tabs ShowHeldItemCheckBox.OnToggled += OnCheckBoxToggled; ShowCombatModeIndicatorsCheckBox.OnToggled += OnCheckBoxToggled; + ShowLoocAboveHeadCheckBox.OnToggled += OnCheckBoxToggled; IntegerScalingCheckBox.OnToggled += OnCheckBoxToggled; ViewportLowResCheckBox.OnToggled += OnCheckBoxToggled; ParallaxLowQualityCheckBox.OnToggled += OnCheckBoxToggled; @@ -121,6 +122,7 @@ namespace Content.Client.Options.UI.Tabs FpsCounterCheckBox.Pressed = _cfg.GetCVar(CCVars.HudFpsCounterVisible); ShowHeldItemCheckBox.Pressed = _cfg.GetCVar(CCVars.HudHeldItemShow); ShowCombatModeIndicatorsCheckBox.Pressed = _cfg.GetCVar(CCVars.CombatModeIndicatorsPointShow); + ShowLoocAboveHeadCheckBox.Pressed = _cfg.GetCVar(CCVars.LoocAboveHeadShow); ViewportWidthSlider.Value = _cfg.GetCVar(CCVars.ViewportWidth); _cfg.OnValueChanged(CCVars.ViewportMinimumWidth, _ => UpdateViewportWidthRange()); @@ -168,6 +170,7 @@ namespace Content.Client.Options.UI.Tabs _cfg.SetCVar(CCVars.ParallaxLowQuality, ParallaxLowQualityCheckBox.Pressed); _cfg.SetCVar(CCVars.HudHeldItemShow, ShowHeldItemCheckBox.Pressed); _cfg.SetCVar(CCVars.CombatModeIndicatorsPointShow, ShowCombatModeIndicatorsCheckBox.Pressed); + _cfg.SetCVar(CCVars.LoocAboveHeadShow, ShowLoocAboveHeadCheckBox.Pressed); _cfg.SetCVar(CCVars.HudFpsCounterVisible, FpsCounterCheckBox.Pressed); _cfg.SetCVar(CCVars.ViewportWidth, (int) ViewportWidthSlider.Value); @@ -205,6 +208,7 @@ namespace Content.Client.Options.UI.Tabs var isPLQSame = ParallaxLowQualityCheckBox.Pressed == _cfg.GetCVar(CCVars.ParallaxLowQuality); var isShowHeldItemSame = ShowHeldItemCheckBox.Pressed == _cfg.GetCVar(CCVars.HudHeldItemShow); var isCombatModeIndicatorsSame = ShowCombatModeIndicatorsCheckBox.Pressed == _cfg.GetCVar(CCVars.CombatModeIndicatorsPointShow); + var isLoocShowSame = ShowLoocAboveHeadCheckBox.Pressed == _cfg.GetCVar(CCVars.LoocAboveHeadShow); var isFpsCounterVisibleSame = FpsCounterCheckBox.Pressed == _cfg.GetCVar(CCVars.HudFpsCounterVisible); var isWidthSame = (int) ViewportWidthSlider.Value == _cfg.GetCVar(CCVars.ViewportWidth); var isLayoutSame = HudLayoutOption.SelectedMetadata is string opt && opt == _cfg.GetCVar(CCVars.UILayout); @@ -221,6 +225,7 @@ namespace Content.Client.Options.UI.Tabs isHudThemeSame && isShowHeldItemSame && isCombatModeIndicatorsSame && + isLoocShowSame && isFpsCounterVisibleSame && isWidthSame && isLayoutSame; diff --git a/Content.Client/UserInterface/Systems/Chat/ChatUIController.cs b/Content.Client/UserInterface/Systems/Chat/ChatUIController.cs index 9334f85c00..2d90b371c3 100644 --- a/Content.Client/UserInterface/Systems/Chat/ChatUIController.cs +++ b/Content.Client/UserInterface/Systems/Chat/ChatUIController.cs @@ -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; } } diff --git a/Content.Shared/CCVar/CCVars.cs b/Content.Shared/CCVar/CCVars.cs index eb74a4994f..82430ea781 100644 --- a/Content.Shared/CCVar/CCVars.cs +++ b/Content.Shared/CCVar/CCVars.cs @@ -645,6 +645,9 @@ namespace Content.Shared.CCVar public static readonly CVarDef CombatModeIndicatorsPointShow = CVarDef.Create("hud.combat_mode_indicators_point_show", true, CVar.ARCHIVE | CVar.CLIENTONLY); + public static readonly CVarDef LoocAboveHeadShow = + CVarDef.Create("hud.show_looc_above_head", true, CVar.ARCHIVE | CVar.CLIENTONLY); + public static readonly CVarDef HudHeldItemOffset = CVarDef.Create("hud.held_item_offset", 28f, CVar.ARCHIVE | CVar.CLIENTONLY); diff --git a/Resources/Locale/en-US/escape-menu/ui/options-menu.ftl b/Resources/Locale/en-US/escape-menu/ui/options-menu.ftl index 5540b6609b..ddf76ebb1a 100644 --- a/Resources/Locale/en-US/escape-menu/ui/options-menu.ftl +++ b/Resources/Locale/en-US/escape-menu/ui/options-menu.ftl @@ -29,6 +29,7 @@ ui-options-volume-percent = { TOSTRING($volume, "P0") } ui-options-show-held-item = Show held item next to cursor? ui-options-show-combat-mode-indicators = Show combat mode indicators with cursor? +ui-options-show-looc-on-head = Show LOOC chat above characters head? ui-options-vsync = VSync ui-options-fullscreen = Fullscreen ui-options-lighting-label = Lighting Quality: