Add an exception to the soft max player cap for players who joined the game at some point during the current round. (#6245)

This commit is contained in:
Moony
2022-01-19 17:01:21 -06:00
committed by GitHub
parent 044635c10b
commit 1a62cefdf9
5 changed files with 14 additions and 5 deletions

View File

@@ -16,6 +16,8 @@ namespace Content.Server.GameTicking
[ViewVariables]
private readonly Dictionary<IPlayerSession, LobbyPlayerStatus> _playersInLobby = new();
[ViewVariables] private readonly HashSet<NetUserId> _playersInGame = new();
[ViewVariables]
private TimeSpan _roundStartTime;
@@ -29,6 +31,7 @@ namespace Content.Server.GameTicking
private bool _roundStartCountdownHasNotStartedYetDueToNoPlayers;
public IReadOnlyDictionary<IPlayerSession, LobbyPlayerStatus> PlayersInLobby => _playersInLobby;
public IReadOnlySet<NetUserId> PlayersInGame => _playersInGame;
private void UpdateInfoText()
{

View File

@@ -134,12 +134,15 @@ namespace Content.Server.GameTicking
if (_playersInLobby.ContainsKey(session))
_playersInLobby.Remove(session);
_playersInGame.Add(session.UserId);
RaiseNetworkEvent(new TickerJoinGameEvent(), session.ConnectedClient);
}
private void PlayerJoinLobby(IPlayerSession session)
{
_playersInLobby[session] = LobbyPlayerStatus.NotReady;
_playersInGame.Remove(session.UserId);
var client = session.ConnectedClient;
RaiseNetworkEvent(new TickerJoinLobbyEvent(), client);

View File

@@ -429,7 +429,7 @@ namespace Content.Server.GameTicking
}
// This ordering mechanism isn't great (no ordering of minds) but functions
var listOfPlayerInfoFinal = listOfPlayerInfo.OrderBy(pi => pi.PlayerOOCName).ToArray();
_playersInGame.Clear();
RaiseNetworkEvent(new RoundEndMessageEvent(gamemodeTitle, roundEndText, roundDuration, listOfPlayerInfoFinal.Length, listOfPlayerInfoFinal));
}