Add CVar for disabling loadout item role timers (#36775)

This commit is contained in:
Centronias
2025-09-03 04:04:44 -07:00
committed by GitHub
parent 0e884da5eb
commit c709d4d55c
5 changed files with 15 additions and 1 deletions

View File

@@ -72,6 +72,7 @@ public sealed class LobbyUIController : UIController, IOnStateEntered<LobbyState
}); });
_configurationManager.OnValueChanged(CCVars.GameRoleTimers, _ => RefreshProfileEditor()); _configurationManager.OnValueChanged(CCVars.GameRoleTimers, _ => RefreshProfileEditor());
_configurationManager.OnValueChanged(CCVars.GameRoleLoadoutTimers, _ => RefreshProfileEditor());
_configurationManager.OnValueChanged(CCVars.GameRoleWhitelist, _ => RefreshProfileEditor()); _configurationManager.OnValueChanged(CCVars.GameRoleWhitelist, _ => RefreshProfileEditor());
} }

View File

@@ -21,6 +21,7 @@ public static partial class PoolManager
(CCVars.NPCMaxUpdates.Name, "999999"), (CCVars.NPCMaxUpdates.Name, "999999"),
(CVars.ThreadParallelCount.Name, "1"), (CVars.ThreadParallelCount.Name, "1"),
(CCVars.GameRoleTimers.Name, "false"), (CCVars.GameRoleTimers.Name, "false"),
(CCVars.GameRoleLoadoutTimers.Name, "false"),
(CCVars.GameRoleWhitelist.Name, "false"), (CCVars.GameRoleWhitelist.Name, "false"),
(CCVars.GridFill.Name, "false"), (CCVars.GridFill.Name, "false"),
(CCVars.PreloadGrids.Name, "false"), (CCVars.PreloadGrids.Name, "false"),

View File

@@ -109,6 +109,12 @@ public sealed partial class CCVars
public static readonly CVarDef<bool> public static readonly CVarDef<bool>
GameRoleTimers = CVarDef.Create("game.role_timers", true, CVar.SERVER | CVar.REPLICATED); GameRoleTimers = CVarDef.Create("game.role_timers", true, CVar.SERVER | CVar.REPLICATED);
/// <summary>
/// If role loadout items should be restricted based on time.
/// </summary>
public static readonly CVarDef<bool>
GameRoleLoadoutTimers = CVarDef.Create("game.role_loadout_timers", true, CVar.SERVER | CVar.REPLICATED);
/// <summary> /// <summary>
/// Override default role requirements using a <see cref="JobRequirementOverridePrototype"/> /// Override default role requirements using a <see cref="JobRequirementOverridePrototype"/>
/// </summary> /// </summary>

View File

@@ -1,6 +1,8 @@
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using Content.Shared.CCVar;
using Content.Shared.Players.PlayTimeTracking; using Content.Shared.Players.PlayTimeTracking;
using Content.Shared.Roles; using Content.Shared.Roles;
using Robust.Shared.Configuration;
using Robust.Shared.Player; using Robust.Shared.Player;
using Robust.Shared.Prototypes; using Robust.Shared.Prototypes;
using Robust.Shared.Utility; 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) public override bool Validate(HumanoidCharacterProfile profile, RoleLoadout loadout, ICommonSession? session, IDependencyCollection collection, [NotNullWhen(false)] out FormattedMessage? reason)
{ {
if (session == null) var configurationManager = collection.Resolve<IConfigurationManager>();
var timersDisabled = !configurationManager.GetCVar(CCVars.GameRoleLoadoutTimers);
if (session == null || timersDisabled)
{ {
reason = FormattedMessage.Empty; reason = FormattedMessage.Empty;
return true; return true;

View File

@@ -4,6 +4,7 @@ lobbyenabled = false
# Dev map for faster loading & convenience # Dev map for faster loading & convenience
map = "Dev" map = "Dev"
role_timers = false role_timers = false
role_loadout_timers = false
[events] [events]
enabled = false enabled = false