Files
tbd-station-14/Content.Server/GameTicking/GameTicker.CVars.cs
metalgearsloth ff965b971e Remove dummy gameticker cvars (#23596)
At some point they got moved to stationsystem it seems
2024-01-06 16:21:32 +11:00

78 lines
2.8 KiB
C#

using Content.Server.Discord;
using Content.Shared.CCVar;
using Content.Shared.GameTicking;
namespace Content.Server.GameTicking
{
public sealed partial class GameTicker
{
[ViewVariables]
public bool LobbyEnabled { get; private set; }
[ViewVariables]
public bool DummyTicker { get; private set; } = false;
[ViewVariables]
public TimeSpan LobbyDuration { get; private set; } = TimeSpan.Zero;
[ViewVariables]
public bool DisallowLateJoin { get; private set; } = false;
[ViewVariables]
public string? ServerName { get; private set; }
[ViewVariables]
private string? DiscordRoundEndRole { get; set; }
private WebhookIdentifier? _webhookIdentifier;
#if EXCEPTION_TOLERANCE
[ViewVariables]
public int RoundStartFailShutdownCount { get; private set; } = 0;
#endif
private void InitializeCVars()
{
_configurationManager.OnValueChanged(CCVars.GameLobbyEnabled, value =>
{
LobbyEnabled = value;
foreach (var (userId, status) in _playerGameStatuses)
{
if (status == PlayerGameStatus.JoinedGame)
continue;
_playerGameStatuses[userId] =
LobbyEnabled ? PlayerGameStatus.NotReadyToPlay : PlayerGameStatus.ReadyToPlay;
}
}, true);
_configurationManager.OnValueChanged(CCVars.GameDummyTicker, value => DummyTicker = value, true);
_configurationManager.OnValueChanged(CCVars.GameLobbyDuration, value => LobbyDuration = TimeSpan.FromSeconds(value), true);
_configurationManager.OnValueChanged(CCVars.GameDisallowLateJoins,
value => { DisallowLateJoin = value; UpdateLateJoinStatus(); }, true);
_configurationManager.OnValueChanged(CCVars.AdminLogsServerName, value =>
{
// TODO why tf is the server name on admin logs
ServerName = value;
}, true);
_configurationManager.OnValueChanged(CCVars.DiscordRoundUpdateWebhook, value =>
{
if (!string.IsNullOrWhiteSpace(value))
{
_discord.GetWebhook(value, data => _webhookIdentifier = data.ToIdentifier());
}
}, true);
_configurationManager.OnValueChanged(CCVars.DiscordRoundEndRoleWebhook, value =>
{
DiscordRoundEndRole = value;
if (value == string.Empty)
{
DiscordRoundEndRole = null;
}
}, true);
#if EXCEPTION_TOLERANCE
_configurationManager.OnValueChanged(CCVars.RoundStartFailShutdownCount, value => RoundStartFailShutdownCount = value, true);
#endif
}
}
}