Refactor lobby status (#10550)
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.GameTicking;
|
||||
|
||||
namespace Content.Server.GameTicking
|
||||
{
|
||||
public sealed partial class GameTicker
|
||||
{
|
||||
[ViewVariables]
|
||||
public bool LobbyEnabled { get; private set; } = false;
|
||||
public bool LobbyEnabled { get; private set; }
|
||||
|
||||
[ViewVariables]
|
||||
public bool DummyTicker { get; private set; } = false;
|
||||
@@ -32,7 +33,17 @@ namespace Content.Server.GameTicking
|
||||
|
||||
private void InitializeCVars()
|
||||
{
|
||||
_configurationManager.OnValueChanged(CCVars.GameLobbyEnabled, value => LobbyEnabled = value, true);
|
||||
_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,
|
||||
|
||||
Reference in New Issue
Block a user