2021-06-20 10:09:24 +02:00
|
|
|
using Content.Shared.CCVar;
|
2022-08-14 12:54:49 -07:00
|
|
|
using Content.Shared.GameTicking;
|
2021-06-20 10:09:24 +02:00
|
|
|
|
|
|
|
|
namespace Content.Server.GameTicking
|
|
|
|
|
{
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed partial class GameTicker
|
2021-06-20 10:09:24 +02:00
|
|
|
{
|
|
|
|
|
[ViewVariables]
|
2022-08-14 12:54:49 -07:00
|
|
|
public bool LobbyEnabled { get; private set; }
|
2021-06-20 10:09:24 +02:00
|
|
|
|
|
|
|
|
[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;
|
|
|
|
|
|
2021-08-04 09:25:30 +02:00
|
|
|
[ViewVariables]
|
|
|
|
|
public bool StationOffset { get; private set; } = false;
|
|
|
|
|
|
2021-10-25 15:22:57 +11:00
|
|
|
[ViewVariables]
|
|
|
|
|
public bool StationRotation { get; private set; } = false;
|
|
|
|
|
|
2021-08-04 09:25:30 +02:00
|
|
|
[ViewVariables]
|
|
|
|
|
public float MaxStationOffset { get; private set; } = 0f;
|
|
|
|
|
|
2022-03-04 23:25:41 +01:00
|
|
|
#if EXCEPTION_TOLERANCE
|
|
|
|
|
[ViewVariables]
|
|
|
|
|
public int RoundStartFailShutdownCount { get; private set; } = 0;
|
|
|
|
|
#endif
|
|
|
|
|
|
2021-06-20 10:09:24 +02:00
|
|
|
private void InitializeCVars()
|
|
|
|
|
{
|
2022-08-14 12:54:49 -07:00
|
|
|
_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);
|
2021-06-20 10:09:24 +02:00
|
|
|
_configurationManager.OnValueChanged(CCVars.GameDummyTicker, value => DummyTicker = value, true);
|
|
|
|
|
_configurationManager.OnValueChanged(CCVars.GameLobbyDuration, value => LobbyDuration = TimeSpan.FromSeconds(value), true);
|
2021-08-04 09:25:30 +02:00
|
|
|
_configurationManager.OnValueChanged(CCVars.GameDisallowLateJoins,
|
2022-05-10 13:43:30 -05:00
|
|
|
value => { DisallowLateJoin = value; UpdateLateJoinStatus(); }, true);
|
2021-08-04 09:25:30 +02:00
|
|
|
_configurationManager.OnValueChanged(CCVars.StationOffset, value => StationOffset = value, true);
|
2021-10-25 15:22:57 +11:00
|
|
|
_configurationManager.OnValueChanged(CCVars.StationRotation, value => StationRotation = value, true);
|
2021-08-04 09:25:30 +02:00
|
|
|
_configurationManager.OnValueChanged(CCVars.MaxStationOffset, value => MaxStationOffset = value, true);
|
2022-03-04 23:25:41 +01:00
|
|
|
#if EXCEPTION_TOLERANCE
|
|
|
|
|
_configurationManager.OnValueChanged(CCVars.RoundStartFailShutdownCount, value => RoundStartFailShutdownCount = value, true);
|
|
|
|
|
#endif
|
2021-06-20 10:09:24 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|