Enable nullability in Content.Server (#3685)
This commit is contained in:
@@ -29,7 +29,7 @@ namespace Content.Server.GameTicking.GameRules
|
||||
[Dependency] private readonly IGameTicker _gameTicker = default!;
|
||||
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
||||
|
||||
private CancellationTokenSource _checkTimerCancel;
|
||||
private CancellationTokenSource? _checkTimerCancel;
|
||||
|
||||
public override void Added()
|
||||
{
|
||||
@@ -59,12 +59,12 @@ namespace Content.Server.GameTicking.GameRules
|
||||
if (!_cfg.GetCVar(CCVars.GameLobbyEnableWin))
|
||||
return;
|
||||
|
||||
IPlayerSession winner = null;
|
||||
IPlayerSession? winner = null;
|
||||
foreach (var playerSession in _playerManager.GetAllPlayers())
|
||||
{
|
||||
var playerEntity = playerSession.AttachedEntity;
|
||||
if (playerEntity == null
|
||||
|| !playerEntity.TryGetComponent(out IMobStateComponent state))
|
||||
|| !playerEntity.TryGetComponent(out IMobStateComponent? state))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -94,7 +94,7 @@ namespace Content.Server.GameTicking.GameRules
|
||||
Timer.Spawn(TimeSpan.FromSeconds(restartDelay), () => _gameTicker.RestartRound());
|
||||
}
|
||||
|
||||
private void PlayerManagerOnPlayerStatusChanged(object sender, SessionStatusEventArgs e)
|
||||
private void PlayerManagerOnPlayerStatusChanged(object? sender, SessionStatusEventArgs e)
|
||||
{
|
||||
if (e.NewStatus == SessionStatus.Disconnected)
|
||||
{
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace Content.Server.GameTicking.GameRules
|
||||
foreach (var playerSession in _playerManager.GetAllPlayers())
|
||||
{
|
||||
if (playerSession.AttachedEntity == null
|
||||
|| !playerSession.AttachedEntity.TryGetComponent(out IMobStateComponent mobState)
|
||||
|| !playerSession.AttachedEntity.TryGetComponent(out IMobStateComponent? mobState)
|
||||
|| !playerSession.AttachedEntity.HasComponent<SuspicionRoleComponent>())
|
||||
{
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user