From f6f8fbda2a44238f50b65a9d40a7c77cc9a0effd Mon Sep 17 00:00:00 2001
From: Spatison <137375981+Spatison@users.noreply.github.com>
Date: Sat, 14 Sep 2024 14:44:42 +0300
Subject: [PATCH 1/4] add: log chat action
---
Content.Client/Options/UI/Tabs/MiscTab.xaml | 1 +
.../Options/UI/Tabs/MiscTab.xaml.cs | 7 +++-
Content.Client/Popups/PopupSystem.cs | 38 +++++++++++++++++++
Content.Shared/_White/CVars.cs | 9 ++++-
4 files changed, 53 insertions(+), 2 deletions(-)
diff --git a/Content.Client/Options/UI/Tabs/MiscTab.xaml b/Content.Client/Options/UI/Tabs/MiscTab.xaml
index 96df9f2357..e898e83e5e 100644
--- a/Content.Client/Options/UI/Tabs/MiscTab.xaml
+++ b/Content.Client/Options/UI/Tabs/MiscTab.xaml
@@ -53,6 +53,7 @@
+
diff --git a/Content.Client/Options/UI/Tabs/MiscTab.xaml.cs b/Content.Client/Options/UI/Tabs/MiscTab.xaml.cs
index 70c4f48932..3a63143836 100644
--- a/Content.Client/Options/UI/Tabs/MiscTab.xaml.cs
+++ b/Content.Client/Options/UI/Tabs/MiscTab.xaml.cs
@@ -1,5 +1,6 @@
using System.Linq;
using Content.Client.UserInterface.Screens;
+using Content.Shared._White;
using Content.Shared.CCVar;
using Content.Shared.HUD;
using Robust.Client.AutoGenerated;
@@ -80,6 +81,7 @@ public MiscTab()
ScreenShakeIntensitySlider.OnValueChanged += OnScreenShakeIntensitySliderChanged;
// ToggleWalk.OnToggled += OnCheckBoxToggled;
StaticStorageUI.OnToggled += OnCheckBoxToggled;
+ LogInChatCheckBox.OnToggled += OnCheckBoxToggled; // WD EDIT
HudThemeOption.SelectId(_hudThemeIdToIndex.GetValueOrDefault(_cfg.GetCVar(CVars.InterfaceTheme), 0));
DiscordRich.Pressed = _cfg.GetCVar(CVars.DiscordEnabled);
@@ -98,6 +100,7 @@ public MiscTab()
ScreenShakeIntensitySlider.Value = _cfg.GetCVar(CCVars.ScreenShakeIntensity) * 100f;
// ToggleWalk.Pressed = _cfg.GetCVar(CCVars.ToggleWalk);
StaticStorageUI.Pressed = _cfg.GetCVar(CCVars.StaticStorageUI);
+ LogInChatCheckBox.Pressed = _cfg.GetCVar(WhiteCVars.LogInChat); // WD EDIT
ApplyButton.OnPressed += OnApplyButtonPressed;
@@ -184,6 +187,7 @@ private void UpdateApplyButton()
var isScreenShakeIntensitySame = Math.Abs(ScreenShakeIntensitySlider.Value / 100f - _cfg.GetCVar(CCVars.ScreenShakeIntensity)) < 0.01f;
// var isToggleWalkSame = ToggleWalk.Pressed == _cfg.GetCVar(CCVars.ToggleWalk);
var isStaticStorageUISame = StaticStorageUI.Pressed == _cfg.GetCVar(CCVars.StaticStorageUI);
+ var isLogInChatCheckBoxSame = StaticStorageUI.Pressed == _cfg.GetCVar(WhiteCVars.LogInChat); // WD EDIT
ApplyButton.Disabled = isHudThemeSame &&
isLayoutSame &&
@@ -202,7 +206,8 @@ private void UpdateApplyButton()
isChatWindowOpacitySame &&
isScreenShakeIntensitySame &&
// isToggleWalkSame &&
- isStaticStorageUISame;
+ isStaticStorageUISame &&
+ isLogInChatCheckBoxSame; // WD EDIT
}
}
diff --git a/Content.Client/Popups/PopupSystem.cs b/Content.Client/Popups/PopupSystem.cs
index 3faa392e58..f5182994f5 100644
--- a/Content.Client/Popups/PopupSystem.cs
+++ b/Content.Client/Popups/PopupSystem.cs
@@ -1,4 +1,7 @@
using System.Linq;
+using Content.Client.UserInterface.Systems.Chat;
+using Content.Shared._White;
+using Content.Shared.Chat;
using Content.Shared.Examine;
using Content.Shared.GameTicking;
using Content.Shared.Popups;
@@ -40,6 +43,8 @@ public sealed class PopupSystem : SharedPopupSystem
public const float MaximumPopupLifetime = 5f;
public const float PopupLifetimePerCharacter = 0.04f;
+ private bool _isLogging; // WD EDIT
+
public override void Initialize()
{
SubscribeNetworkEvent(OnPopupCursorEvent);
@@ -57,6 +62,11 @@ public override void Initialize()
_examine,
_transform,
this));
+
+ // WD EDIT START
+ _isLogging = _configManager.GetCVar(WhiteCVars.LogInChat);
+ _configManager.OnValueChanged(WhiteCVars.LogInChat, log => { _isLogging = log; });
+ // WD EDIT END
}
public override void Shutdown()
@@ -86,6 +96,34 @@ private void PopupMessage(string? message, PopupType type, EntityCoordinates coo
};
_aliveWorldLabels.Add(label);
+
+ // WD EDIT START
+ if (!_isLogging)
+ return;
+
+ if (_playerManager.LocalEntity == null)
+ return;
+
+ if (!_examine.InRangeUnOccluded(_playerManager.LocalEntity.Value, coordinates, 10))
+ return;
+
+ var fontSizeDict = new Dictionary
+ {
+ { PopupType.Medium, "12" },
+ { PopupType.MediumCaution, "12" },
+ { PopupType.Large, "15" },
+ { PopupType.LargeCaution, "15" }
+ };
+
+ var fontsize = fontSizeDict.GetValueOrDefault(type, "10");
+ var fontcolor = type is PopupType.LargeCaution or PopupType.MediumCaution or PopupType.SmallCaution
+ ? "#C62828"
+ : "#AEABC4";
+
+ var wrappedMessage = $"[font size={fontsize}][color={fontcolor}]{message}[/color][/font]";
+ var chatMsg = new ChatMessage(ChatChannel.Emotes, message, wrappedMessage, GetNetEntity(EntityUid.Invalid), null);
+ _uiManager.GetUIController().ProcessChatMessage(chatMsg);
+ // WD EDIT END
}
#region Abstract Method Implementations
diff --git a/Content.Shared/_White/CVars.cs b/Content.Shared/_White/CVars.cs
index 0b527efe1c..1bc90e4935 100644
--- a/Content.Shared/_White/CVars.cs
+++ b/Content.Shared/_White/CVars.cs
@@ -12,7 +12,7 @@ public sealed class WhiteCVars
public static readonly CVarDef AspectChance =
CVarDef.Create("aspects.chance", 0.1d, CVar.SERVERONLY);
-
+
#endregion
#region Keybind
@@ -31,4 +31,11 @@ public static readonly CVarDef
ServerCulture = CVarDef.Create("white.culture", "ru-RU", CVar.REPLICATED | CVar.SERVER);
#endregion
+
+ #region OptionsMisc
+
+ public static readonly CVarDef LogInChat =
+ CVarDef.Create("white.log_in_chat", true, CVar.CLIENT | CVar.ARCHIVE | CVar.REPLICATED);
+
+ #endregion
}
From a13bfc6942693236326c2d6e261cc6119db2040f Mon Sep 17 00:00:00 2001
From: Spatison <137375981+Spatison@users.noreply.github.com>
Date: Sat, 14 Sep 2024 15:01:52 +0300
Subject: [PATCH 2/4] add: Loc
---
Resources/Locale/en-US/_white/escape-menu/options-menu.ftl | 3 ++-
Resources/Locale/ru-RU/_white/escape-menu/options-menu.ftl | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/Resources/Locale/en-US/_white/escape-menu/options-menu.ftl b/Resources/Locale/en-US/_white/escape-menu/options-menu.ftl
index 1b60c06214..b1b8726d49 100644
--- a/Resources/Locale/en-US/_white/escape-menu/options-menu.ftl
+++ b/Resources/Locale/en-US/_white/escape-menu/options-menu.ftl
@@ -1,5 +1,6 @@
-ui-options-function-open-emotions-menu = Open emotions menu
+ui-options-log-in-chat = Log actions in the chat
+ui-options-function-open-emotions-menu = Open emotions menu
ui-options-function-look-up = Look up/Take aim
ui-options-function-auto-get-up = Automatically get up after falling
ui-options-function-hold-look-up = Hold down the key to aim
\ No newline at end of file
diff --git a/Resources/Locale/ru-RU/_white/escape-menu/options-menu.ftl b/Resources/Locale/ru-RU/_white/escape-menu/options-menu.ftl
index dfd2392b3a..a6e97e34f2 100644
--- a/Resources/Locale/ru-RU/_white/escape-menu/options-menu.ftl
+++ b/Resources/Locale/ru-RU/_white/escape-menu/options-menu.ftl
@@ -1,5 +1,6 @@
-ui-options-function-open-emotions-menu = Открыть меню эмоций
+ui-options-log-in-chat = Логировать действия в чат
+ui-options-function-open-emotions-menu = Открыть меню эмоций
ui-options-function-look-up = Присмотреться/Прицелиться
ui-options-function-auto-get-up = Автоматически вставать при падении
ui-options-function-hold-look-up = Удерживать клавишу для прицеливания
\ No newline at end of file
From a1dab8d432ba216855fa19ccfb44b70dbe84d3df Mon Sep 17 00:00:00 2001
From: Spatison <137375981+Spatison@users.noreply.github.com>
Date: Sat, 14 Sep 2024 17:26:26 +0300
Subject: [PATCH 3/4] =?UTF-8?q?=D0=B0=D1=88=D1=87?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Content.Client/Options/UI/Tabs/MiscTab.xaml.cs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/Content.Client/Options/UI/Tabs/MiscTab.xaml.cs b/Content.Client/Options/UI/Tabs/MiscTab.xaml.cs
index 3a63143836..174852657d 100644
--- a/Content.Client/Options/UI/Tabs/MiscTab.xaml.cs
+++ b/Content.Client/Options/UI/Tabs/MiscTab.xaml.cs
@@ -157,6 +157,7 @@ private void OnApplyButtonPressed(BaseButton.ButtonEventArgs args)
_cfg.SetCVar(CCVars.ScreenShakeIntensity, ScreenShakeIntensitySlider.Value / 100f);
// _cfg.SetCVar(CCVars.ToggleWalk, ToggleWalk.Pressed);
_cfg.SetCVar(CCVars.StaticStorageUI, StaticStorageUI.Pressed);
+ _cfg.SetCVar(WhiteCVars.LogInChat, LogInChatCheckBox.Pressed); // WD EDIT
if (HudLayoutOption.SelectedMetadata is string opt)
{
@@ -187,7 +188,7 @@ private void UpdateApplyButton()
var isScreenShakeIntensitySame = Math.Abs(ScreenShakeIntensitySlider.Value / 100f - _cfg.GetCVar(CCVars.ScreenShakeIntensity)) < 0.01f;
// var isToggleWalkSame = ToggleWalk.Pressed == _cfg.GetCVar(CCVars.ToggleWalk);
var isStaticStorageUISame = StaticStorageUI.Pressed == _cfg.GetCVar(CCVars.StaticStorageUI);
- var isLogInChatCheckBoxSame = StaticStorageUI.Pressed == _cfg.GetCVar(WhiteCVars.LogInChat); // WD EDIT
+ var isLogInChatCheckBoxSame = LogInChatCheckBox.Pressed == _cfg.GetCVar(WhiteCVars.LogInChat); // WD EDIT
ApplyButton.Disabled = isHudThemeSame &&
isLayoutSame &&
From 199e48664b80dc9b02cdde4cc682ea2407fb5d25 Mon Sep 17 00:00:00 2001
From: Spatison <137375981+Spatison@users.noreply.github.com>
Date: Sun, 15 Sep 2024 18:12:07 +0300
Subject: [PATCH 4/4] fix
---
Content.Client/Popups/PopupSystem.cs | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/Content.Client/Popups/PopupSystem.cs b/Content.Client/Popups/PopupSystem.cs
index f5182994f5..c99e7823eb 100644
--- a/Content.Client/Popups/PopupSystem.cs
+++ b/Content.Client/Popups/PopupSystem.cs
@@ -43,7 +43,17 @@ public sealed class PopupSystem : SharedPopupSystem
public const float MaximumPopupLifetime = 5f;
public const float PopupLifetimePerCharacter = 0.04f;
- private bool _isLogging; // WD EDIT
+ // WD EDIT START
+ private static readonly Dictionary FontSizeDict = new()
+ {
+ { PopupType.Medium, "12" },
+ { PopupType.MediumCaution, "12" },
+ { PopupType.Large, "15" },
+ { PopupType.LargeCaution, "15" }
+ };
+
+ private bool _shouldLogInChat;
+ // WD EDIT END
public override void Initialize()
{
@@ -64,8 +74,8 @@ public override void Initialize()
this));
// WD EDIT START
- _isLogging = _configManager.GetCVar(WhiteCVars.LogInChat);
- _configManager.OnValueChanged(WhiteCVars.LogInChat, log => { _isLogging = log; });
+ _shouldLogInChat = _configManager.GetCVar(WhiteCVars.LogInChat);
+ _configManager.OnValueChanged(WhiteCVars.LogInChat, log => { _shouldLogInChat = log; });
// WD EDIT END
}
@@ -98,7 +108,7 @@ private void PopupMessage(string? message, PopupType type, EntityCoordinates coo
_aliveWorldLabels.Add(label);
// WD EDIT START
- if (!_isLogging)
+ if (!_shouldLogInChat)
return;
if (_playerManager.LocalEntity == null)
@@ -107,15 +117,7 @@ private void PopupMessage(string? message, PopupType type, EntityCoordinates coo
if (!_examine.InRangeUnOccluded(_playerManager.LocalEntity.Value, coordinates, 10))
return;
- var fontSizeDict = new Dictionary
- {
- { PopupType.Medium, "12" },
- { PopupType.MediumCaution, "12" },
- { PopupType.Large, "15" },
- { PopupType.LargeCaution, "15" }
- };
-
- var fontsize = fontSizeDict.GetValueOrDefault(type, "10");
+ var fontsize = FontSizeDict.GetValueOrDefault(type, "10");
var fontcolor = type is PopupType.LargeCaution or PopupType.MediumCaution or PopupType.SmallCaution
? "#C62828"
: "#AEABC4";