mirror of
https://github.com/corvax-team/ss14-wl.git
synced 2026-02-15 03:31:38 +01:00
Replace direct uses of GameTicker dictionary with TryGetValue (#33222)
Fix station events schedulers, antag selection and possibly other systems acting weird in a rare scenario
This commit is contained in:
@@ -184,7 +184,7 @@ public sealed partial class AntagSelectionSystem : GameRuleSystem<AntagSelection
|
||||
return;
|
||||
|
||||
var players = _playerManager.Sessions
|
||||
.Where(x => GameTicker.PlayerGameStatuses[x.UserId] == PlayerGameStatus.JoinedGame)
|
||||
.Where(x => GameTicker.PlayerGameStatuses.TryGetValue(x.UserId, out var status) && status == PlayerGameStatus.JoinedGame)
|
||||
.ToList();
|
||||
|
||||
ChooseAntags((uid, component), players, midround: true);
|
||||
|
||||
@@ -184,6 +184,6 @@ namespace Content.Server.GameTicking
|
||||
=> UserHasJoinedGame(session.UserId);
|
||||
|
||||
public bool UserHasJoinedGame(NetUserId userId)
|
||||
=> PlayerGameStatuses[userId] == PlayerGameStatus.JoinedGame;
|
||||
=> PlayerGameStatuses.TryGetValue(userId, out var status) && status == PlayerGameStatus.JoinedGame;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user