From 80473b232b9b5e4a41b430fe6b66611b85c15d6a Mon Sep 17 00:00:00 2001 From: Mister_Nebula <41904486+misternebula@users.noreply.github.com> Date: Thu, 20 Aug 2020 13:43:16 +0100 Subject: [PATCH] fixes --- QSB/QSBNetworkManager.cs | 12 +++++++----- QSB/TransformSync/SectorSync.cs | 1 - 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/QSB/QSBNetworkManager.cs b/QSB/QSBNetworkManager.cs index a362bea6..5019c90a 100644 --- a/QSB/QSBNetworkManager.cs +++ b/QSB/QSBNetworkManager.cs @@ -112,7 +112,7 @@ namespace QSB Destroy(GetComponent()); EventList.Reset(); PlayerRegistry.PlayerList.ForEach(player => player.HudMarker?.Remove()); - NetworkServer.connections.ToList()Where(x => x.playerControllers[0].gameObject.GetComponent().netId.Value != PlayerRegistry.LocalPlayerId).ForEach(CleanupConnection); + NetworkServer.connections.ToList().ForEach(CleanupConnection); _lobby.CanEditName = true; } @@ -139,12 +139,16 @@ namespace QSB DebugLog.ToConsole($"{playerName} disconnected.", OWML.Common.MessageType.Info); PlayerRegistry.RemovePlayer(playerId); - var netIds = connection.clientOwnedObjects.Select(x => x.Value).ToList(); - netIds.ForEach(CleanupNetworkBehaviour); + if (playerId != PlayerRegistry.LocalPlayerId) + { + var netIds = connection.clientOwnedObjects.Select(x => x.Value).ToList(); + netIds.ForEach(CleanupNetworkBehaviour); + } } public void CleanupNetworkBehaviour(uint netId) { + DebugLog.ToConsole($"Cleaning up object {netId}"); var networkBehaviours = FindObjectsOfType() .Where(x => x != null && x.netId.Value == netId); foreach (var networkBehaviour in networkBehaviours) @@ -153,11 +157,9 @@ namespace QSB if (transformSync != null) { - DebugLog.ToConsole(" * TS is not null - removing from list"); PlayerRegistry.TransformSyncs.Remove(transformSync); if (transformSync.SyncedTransform != null) { - DebugLog.ToConsole(" * TS's ST is not null - destroying"); Destroy(transformSync.SyncedTransform.gameObject); } } diff --git a/QSB/TransformSync/SectorSync.cs b/QSB/TransformSync/SectorSync.cs index 7d5b9a8d..46a48ca8 100644 --- a/QSB/TransformSync/SectorSync.cs +++ b/QSB/TransformSync/SectorSync.cs @@ -42,7 +42,6 @@ namespace QSB.TransformSync private void SendSector(uint id, QSBSector sector) { - DebugLog.ToConsole($"Sending sector event for {id}"); GlobalMessenger.FireEvent(EventNames.QSBSectorChange, id, sector); } }