From 01082c6c27cb30875e6c9a78a4d46d371b9bfa8e Mon Sep 17 00:00:00 2001 From: LankLTE <135308300+LankLTE@users.noreply.github.com> Date: Wed, 3 Jan 2024 20:45:23 -0800 Subject: [PATCH] Add cvar to show new players in ahelp (#23265) * Implement cvar * Enable cvar on Wizden --- .../Administration/UI/Bwoink/BwoinkControl.xaml.cs | 10 ++++++++++ Content.Shared/CCVar/CCVars.cs | 8 ++++++++ Resources/ConfigPresets/WizardsDen/wizardsDen.toml | 1 + 3 files changed, 19 insertions(+) diff --git a/Content.Client/Administration/UI/Bwoink/BwoinkControl.xaml.cs b/Content.Client/Administration/UI/Bwoink/BwoinkControl.xaml.cs index 5d760d9ab8..90dc88e5b1 100644 --- a/Content.Client/Administration/UI/Bwoink/BwoinkControl.xaml.cs +++ b/Content.Client/Administration/UI/Bwoink/BwoinkControl.xaml.cs @@ -4,6 +4,7 @@ using Content.Client.Administration.Managers; using Content.Client.Administration.UI.CustomControls; using Content.Client.UserInterface.Systems.Bwoink; using Content.Shared.Administration; +using Content.Shared.CCVar; using Robust.Client.AutoGenerated; using Robust.Client.Console; using Robust.Client.UserInterface; @@ -11,6 +12,8 @@ using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.XAML; using Robust.Shared.Network; using Robust.Shared.Utility; +using Robust.Shared.Timing; +using Robust.Shared.Configuration; namespace Content.Client.Administration.UI.Bwoink { @@ -23,6 +26,7 @@ namespace Content.Client.Administration.UI.Bwoink [Dependency] private readonly IClientAdminManager _adminManager = default!; [Dependency] private readonly IClientConsoleHost _console = default!; [Dependency] private readonly IUserInterfaceManager _ui = default!; + [Dependency] private readonly IConfigurationManager _cfg = default!; public AdminAHelpUIHandler AHelpHelper = default!; private PlayerInfo? _currentPlayer; @@ -71,6 +75,9 @@ namespace Content.Client.Administration.UI.Bwoink if (info.Antag && info.ActiveThisRound) sb.Append(new Rune(0x1F5E1)); // 🗡 + if (info.OverallPlaytime <= TimeSpan.FromSeconds(_cfg.GetCVar(CCVars.NewPlayerThreshold))) + sb.Append(new Rune(0x23F2)); // ⏲ + sb.AppendFormat("\"{0}\"", text); return sb.ToString(); @@ -219,6 +226,9 @@ namespace Content.Client.Administration.UI.Bwoink if (pl.Antag) sb.Append(new Rune(0x1F5E1)); // 🗡 + if (pl.OverallPlaytime <= TimeSpan.FromSeconds(_cfg.GetCVar(CCVars.NewPlayerThreshold))) + sb.Append(new Rune(0x23F2)); // ⏲ + sb.AppendFormat("\"{0}\"", pl.CharacterName); if (pl.IdentityName != pl.CharacterName && pl.IdentityName != string.Empty) diff --git a/Content.Shared/CCVar/CCVars.cs b/Content.Shared/CCVar/CCVars.cs index eefce86dfb..ca8ed54f32 100644 --- a/Content.Shared/CCVar/CCVars.cs +++ b/Content.Shared/CCVar/CCVars.cs @@ -804,6 +804,14 @@ namespace Content.Shared.CCVar /// public static readonly CVarDef AdminAhelpOverrideClientName = CVarDef.Create("admin.override_adminname_in_client_ahelp", string.Empty, CVar.SERVERONLY); + + /// + /// The threshold of minutes to appear as a "new player" in the ahelp menu + /// If 0, appearing as a new player is disabled. + /// + public static readonly CVarDef NewPlayerThreshold = + CVarDef.Create("admin.new_player_threshold", 0, CVar.ARCHIVE | CVar.REPLICATED | CVar.SERVER); + /* * Explosions */ diff --git a/Resources/ConfigPresets/WizardsDen/wizardsDen.toml b/Resources/ConfigPresets/WizardsDen/wizardsDen.toml index e3826b4678..a271e36cf1 100644 --- a/Resources/ConfigPresets/WizardsDen/wizardsDen.toml +++ b/Resources/ConfigPresets/WizardsDen/wizardsDen.toml @@ -33,3 +33,4 @@ limit = 10.0 [admin] see_own_notes = true deadmin_on_join = true +new_player_threshold = 600 \ No newline at end of file -- 2.51.2