From c709d4d55c3cc024fdd6585c7d6483e3e2c9330e Mon Sep 17 00:00:00 2001 From: Centronias Date: Wed, 3 Sep 2025 04:04:44 -0700 Subject: [PATCH] Add CVar for disabling loadout item role timers (#36775) --- Content.Client/Lobby/LobbyUIController.cs | 1 + Content.IntegrationTests/PoolManager.Cvars.cs | 1 + Content.Shared/CCVar/CCVars.Game.cs | 6 ++++++ .../Loadouts/Effects/JobRequirementLoadoutEffect.cs | 7 ++++++- Resources/ConfigPresets/Build/development.toml | 1 + 5 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Content.Client/Lobby/LobbyUIController.cs b/Content.Client/Lobby/LobbyUIController.cs index 121e8dbe71..ec052adea5 100644 --- a/Content.Client/Lobby/LobbyUIController.cs +++ b/Content.Client/Lobby/LobbyUIController.cs @@ -72,6 +72,7 @@ public sealed class LobbyUIController : UIController, IOnStateEntered RefreshProfileEditor()); + _configurationManager.OnValueChanged(CCVars.GameRoleLoadoutTimers, _ => RefreshProfileEditor()); _configurationManager.OnValueChanged(CCVars.GameRoleWhitelist, _ => RefreshProfileEditor()); } diff --git a/Content.IntegrationTests/PoolManager.Cvars.cs b/Content.IntegrationTests/PoolManager.Cvars.cs index 2c51bdbc3a..8cf2b626dc 100644 --- a/Content.IntegrationTests/PoolManager.Cvars.cs +++ b/Content.IntegrationTests/PoolManager.Cvars.cs @@ -21,6 +21,7 @@ public static partial class PoolManager (CCVars.NPCMaxUpdates.Name, "999999"), (CVars.ThreadParallelCount.Name, "1"), (CCVars.GameRoleTimers.Name, "false"), + (CCVars.GameRoleLoadoutTimers.Name, "false"), (CCVars.GameRoleWhitelist.Name, "false"), (CCVars.GridFill.Name, "false"), (CCVars.PreloadGrids.Name, "false"), diff --git a/Content.Shared/CCVar/CCVars.Game.cs b/Content.Shared/CCVar/CCVars.Game.cs index 00e6ff93ae..7fad7b480d 100644 --- a/Content.Shared/CCVar/CCVars.Game.cs +++ b/Content.Shared/CCVar/CCVars.Game.cs @@ -109,6 +109,12 @@ public sealed partial class CCVars public static readonly CVarDef GameRoleTimers = CVarDef.Create("game.role_timers", true, CVar.SERVER | CVar.REPLICATED); + /// + /// If role loadout items should be restricted based on time. + /// + public static readonly CVarDef + GameRoleLoadoutTimers = CVarDef.Create("game.role_loadout_timers", true, CVar.SERVER | CVar.REPLICATED); + /// /// Override default role requirements using a /// diff --git a/Content.Shared/Preferences/Loadouts/Effects/JobRequirementLoadoutEffect.cs b/Content.Shared/Preferences/Loadouts/Effects/JobRequirementLoadoutEffect.cs index 2f7e7b7c48..b9bf4b38bc 100644 --- a/Content.Shared/Preferences/Loadouts/Effects/JobRequirementLoadoutEffect.cs +++ b/Content.Shared/Preferences/Loadouts/Effects/JobRequirementLoadoutEffect.cs @@ -1,6 +1,8 @@ using System.Diagnostics.CodeAnalysis; +using Content.Shared.CCVar; using Content.Shared.Players.PlayTimeTracking; using Content.Shared.Roles; +using Robust.Shared.Configuration; using Robust.Shared.Player; using Robust.Shared.Prototypes; using Robust.Shared.Utility; @@ -17,7 +19,10 @@ public sealed partial class JobRequirementLoadoutEffect : LoadoutEffect public override bool Validate(HumanoidCharacterProfile profile, RoleLoadout loadout, ICommonSession? session, IDependencyCollection collection, [NotNullWhen(false)] out FormattedMessage? reason) { - if (session == null) + var configurationManager = collection.Resolve(); + var timersDisabled = !configurationManager.GetCVar(CCVars.GameRoleLoadoutTimers); + + if (session == null || timersDisabled) { reason = FormattedMessage.Empty; return true; diff --git a/Resources/ConfigPresets/Build/development.toml b/Resources/ConfigPresets/Build/development.toml index cad04c66c2..7849124a18 100644 --- a/Resources/ConfigPresets/Build/development.toml +++ b/Resources/ConfigPresets/Build/development.toml @@ -4,6 +4,7 @@ lobbyenabled = false # Dev map for faster loading & convenience map = "Dev" role_timers = false +role_loadout_timers = false [events] enabled = false