From 533c7dae64642e196298f15db8ef7881997ec6fa Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Fri, 7 Jan 2022 15:38:22 -0800 Subject: [PATCH] remove Player == null checks --- QSB/Syncs/Sectored/BaseSectoredSync.cs | 6 ------ QSB/Syncs/SyncBase.cs | 7 +------ QSB/Utility/DebugGUI.cs | 12 ------------ 3 files changed, 1 insertion(+), 24 deletions(-) diff --git a/QSB/Syncs/Sectored/BaseSectoredSync.cs b/QSB/Syncs/Sectored/BaseSectoredSync.cs index 8c3b7a8c..1b8e4e06 100644 --- a/QSB/Syncs/Sectored/BaseSectoredSync.cs +++ b/QSB/Syncs/Sectored/BaseSectoredSync.cs @@ -127,12 +127,6 @@ namespace QSB.Syncs.Sectored { if (IsPlayerObject) { - if (Player == null) - { - writer.Write(-1); - return; - } - if (!Player.IsReady) { writer.Write(-1); diff --git a/QSB/Syncs/SyncBase.cs b/QSB/Syncs/SyncBase.cs index 96ebc309..f64cdc21 100644 --- a/QSB/Syncs/SyncBase.cs +++ b/QSB/Syncs/SyncBase.cs @@ -17,7 +17,7 @@ namespace QSB.Syncs public abstract class SyncBase : QNetworkTransform where T : Component { /// - /// only valid for player objects + /// valid if IsPlayerObject, otherwise null /// public PlayerInfo Player { get; private set; } @@ -37,11 +37,6 @@ namespace QSB.Syncs if (IsPlayerObject) { - if (Player == null) - { - return false; - } - if (!Player.IsReady && !IsLocalPlayer) { return false; diff --git a/QSB/Utility/DebugGUI.cs b/QSB/Utility/DebugGUI.cs index 60e34f24..9dae58b5 100644 --- a/QSB/Utility/DebugGUI.cs +++ b/QSB/Utility/DebugGUI.cs @@ -137,12 +137,6 @@ namespace QSB.Utility WriteLine(2, $"Player data :"); foreach (var player in QSBPlayerManager.PlayerList) { - if (player == null) - { - WriteLine(2, $"NULL PLAYER", Color.red); - continue; - } - WriteLine(2, $"{player.PlayerId}.{player.Name}"); WriteLine(2, $"State : {player.State}"); WriteLine(2, $"Eye State : {player.EyeState}"); @@ -227,12 +221,6 @@ namespace QSB.Utility foreach (var player in QSBPlayerManager.PlayerList) { - if (player == null) - { - WriteLine(4, $"- NULL PLAYER", Color.red); - continue; - } - WriteLine(4, $"- {player.PlayerId}.{player.Name}"); var allQuantumObjects = QSBWorldSync.GetWorldObjects(); var ownedQuantumObjects = allQuantumObjects.Where(x => x.ControllingPlayer == player.PlayerId);