Change cvar usages to use CVarDef and define them in CCVars (#2250)

* Change cvar usages to use CVarDef and define them in CCVars

* Merge fixes

* Remove duplicate cvar registration
This commit is contained in:
DrSmugleaf
2020-11-07 01:15:56 +01:00
committed by GitHub
parent a7e7f20417
commit bf5b9ad03b
19 changed files with 136 additions and 72 deletions

View File

@@ -88,7 +88,7 @@ namespace Content.Server.GameTicking
[ViewVariables] private bool DisallowLateJoin { get; set; } = false;
[ViewVariables] private bool LobbyEnabled => _configurationManager.GetCVar<bool>("game.lobbyenabled");
[ViewVariables] private bool LobbyEnabled => _configurationManager.GetCVar(CCVars.GameLobbyEnabled);
[ViewVariables] private bool _updateOnRoundEnd;
private CancellationTokenSource _updateShutdownCts;
@@ -119,7 +119,7 @@ namespace Content.Server.GameTicking
public event Action<GameRuleAddedEventArgs> OnRuleAdded;
private TimeSpan LobbyDuration =>
TimeSpan.FromSeconds(_configurationManager.GetCVar<int>("game.lobbyduration"));
TimeSpan.FromSeconds(_configurationManager.GetCVar(CCVars.GameLobbyDuration));
public override void Initialize()
{
@@ -127,8 +127,6 @@ namespace Content.Server.GameTicking
DebugTools.Assert(!_initialized);
PresetSuspicion.RegisterCVars(_configurationManager);
_netManager.RegisterNetMessage<MsgTickerJoinLobby>(nameof(MsgTickerJoinLobby));
_netManager.RegisterNetMessage<MsgTickerJoinGame>(nameof(MsgTickerJoinGame));
_netManager.RegisterNetMessage<MsgTickerLobbyStatus>(nameof(MsgTickerLobbyStatus));
@@ -286,9 +284,9 @@ namespace Content.Server.GameTicking
if (!preset.Start(assignedJobs.Keys.ToList(), force))
{
if (_configurationManager.GetCVar<bool>("game.fallbackenabled"))
if (_configurationManager.GetCVar(CCVars.GameLobbyFallbackEnabled))
{
SetStartPreset(_configurationManager.GetCVar<string>("game.fallbackpreset"));
SetStartPreset(_configurationManager.GetCVar(CCVars.GameLobbyFallbackPreset));
var newPreset = MakeGamePreset(profiles);
_chatManager.DispatchServerAnnouncement(
$"Failed to start {preset.ModeTitle} mode! Defaulting to {newPreset.ModeTitle}...");