From 43506c8e1325626d1bf84a3f1f5d9bac883c74fe Mon Sep 17 00:00:00 2001 From: Mister_Nebula <41904486+misternebula@users.noreply.github.com> Date: Sat, 4 Dec 2021 09:13:14 +0000 Subject: [PATCH 1/4] fix socket errors --- QSB/ItemSync/ItemManager.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/QSB/ItemSync/ItemManager.cs b/QSB/ItemSync/ItemManager.cs index 55f43a26..377ac1c7 100644 --- a/QSB/ItemSync/ItemManager.cs +++ b/QSB/ItemSync/ItemManager.cs @@ -12,14 +12,6 @@ namespace QSB.ItemSync { DebugLog.DebugWrite("Rebuilding OWItems...", MessageType.Info); - // Items - QSBWorldSync.Init(); - QSBWorldSync.Init(); - QSBWorldSync.Init(); - QSBWorldSync.Init(); - QSBWorldSync.Init(); - QSBWorldSync.Init(); - // Sockets QSBWorldSync.Init(); QSBWorldSync.Init(); @@ -27,6 +19,14 @@ namespace QSB.ItemSync QSBWorldSync.Init(); QSBWorldSync.Init(); QSBWorldSync.Init(); + + // Items + QSBWorldSync.Init(); + QSBWorldSync.Init(); + QSBWorldSync.Init(); + QSBWorldSync.Init(); + QSBWorldSync.Init(); + QSBWorldSync.Init(); } } } From c785d42f83eb1b36a719cb1477393c0d52c68aee Mon Sep 17 00:00:00 2001 From: Mister_Nebula <41904486+misternebula@users.noreply.github.com> Date: Sat, 4 Dec 2021 09:14:48 +0000 Subject: [PATCH 2/4] add stacktraces to all GetWorldFromUnity errors/warnings --- QSB/WorldSync/QSBWorldSync.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/QSB/WorldSync/QSBWorldSync.cs b/QSB/WorldSync/QSBWorldSync.cs index 3c9b0ff0..5342543f 100644 --- a/QSB/WorldSync/QSBWorldSync.cs +++ b/QSB/WorldSync/QSBWorldSync.cs @@ -38,25 +38,25 @@ namespace QSB.WorldSync { if (unityObject == null) { - DebugLog.ToConsole($"Error - Trying to run GetWorldFromUnity with a null unity object! TUnityObject:NULL", MessageType.Error); + DebugLog.ToConsole($"Error - Trying to run GetWorldFromUnity with a null unity object! TUnityObject:NULL, Stacktrace:\r\n{Environment.StackTrace}", MessageType.Error); return default; } if (!QSBCore.IsInMultiplayer) { - DebugLog.ToConsole($"Warning - Trying to run GetWorldFromUnity while not in multiplayer! TUnityObject:{unityObject.GetType().Name}", MessageType.Warning); + DebugLog.ToConsole($"Warning - Trying to run GetWorldFromUnity while not in multiplayer! TUnityObject:{unityObject.GetType().Name}, Stacktrace:\r\n{Environment.StackTrace}", MessageType.Warning); return default; } if (!WorldObjectsToUnityObjects.TryGetValue(unityObject, out var returnObject)) { - DebugLog.ToConsole($"Error - WorldObjectsToUnityObjects does not contain \"{unityObject.name}\"! TUnityObject:{unityObject.GetType().Name}", MessageType.Error); + DebugLog.ToConsole($"Error - WorldObjectsToUnityObjects does not contain \"{unityObject.name}\"! TUnityObject:{unityObject.GetType().Name}, Stacktrace:\r\n{Environment.StackTrace}", MessageType.Error); return default; } if (returnObject == null) { - DebugLog.ToConsole($"Error - World object for unity object {unityObject.name} is null! TUnityObject:{unityObject.GetType().Name}", MessageType.Error); + DebugLog.ToConsole($"Error - World object for unity object {unityObject.name} is null! TUnityObject:{unityObject.GetType().Name}, Stacktrace:\r\n{Environment.StackTrace}", MessageType.Error); return default; } @@ -68,25 +68,25 @@ namespace QSB.WorldSync { if (unityObject == null) { - DebugLog.ToConsole($"Error - Trying to run GetWorldFromUnity with a null unity object! TWorldObject:{typeof(TWorldObject).Name}, TUnityObject:NULL", MessageType.Error); + DebugLog.ToConsole($"Error - Trying to run GetWorldFromUnity with a null unity object! TWorldObject:{typeof(TWorldObject).Name}, TUnityObject:NULL, Stacktrace:\r\n{Environment.StackTrace}", MessageType.Error); return default; } if (!QSBCore.IsInMultiplayer) { - DebugLog.ToConsole($"Warning - Trying to run GetWorldFromUnity while not in multiplayer! TWorldObject:{typeof(TWorldObject).Name}, TUnityObject:{unityObject.GetType().Name}", MessageType.Warning); + DebugLog.ToConsole($"Warning - Trying to run GetWorldFromUnity while not in multiplayer! TWorldObject:{typeof(TWorldObject).Name}, TUnityObject:{unityObject.GetType().Name}, Stacktrace:\r\n{Environment.StackTrace}", MessageType.Warning); return default; } if (!WorldObjectsToUnityObjects.TryGetValue(unityObject, out var returnObject)) { - DebugLog.ToConsole($"Error - WorldObjectsToUnityObjects does not contain \"{unityObject.name}\"! TWorldObject:{typeof(TWorldObject).Name}, TUnityObject:{unityObject.GetType().Name}", MessageType.Error); + DebugLog.ToConsole($"Error - WorldObjectsToUnityObjects does not contain \"{unityObject.name}\"! TWorldObject:{typeof(TWorldObject).Name}, TUnityObject:{unityObject.GetType().Name}, Stacktrace:\r\n{Environment.StackTrace}", MessageType.Error); return default; } if (returnObject == null) { - DebugLog.ToConsole($"Error - World object for unity object {unityObject.name} is null! TWorldObject:{typeof(TWorldObject).Name}, TUnityObject:{unityObject.GetType().Name}", MessageType.Error); + DebugLog.ToConsole($"Error - World object for unity object {unityObject.name} is null! TWorldObject:{typeof(TWorldObject).Name}, TUnityObject:{unityObject.GetType().Name}, Stacktrace:\r\n{Environment.StackTrace}", MessageType.Error); return default; } From 0bd60ddb6853c26eea35961b68d1ca9198224daf Mon Sep 17 00:00:00 2001 From: Mister_Nebula <41904486+misternebula@users.noreply.github.com> Date: Sat, 4 Dec 2021 09:51:27 +0000 Subject: [PATCH 3/4] rename variables, fix QSBOWItem (again) --- .../Events/AnglerChangeStateEvent.cs | 2 +- QSB/Anglerfish/Patches/AnglerPatches.cs | 6 +-- .../TransformSync/AnglerTransformSync.cs | 6 +-- .../NPC/Patches/CharacterAnimationPatches.cs | 4 +- .../Player/Events/AnimationTriggerEvent.cs | 2 +- .../Player/Events/ChangeAnimTypeEvent.cs | 2 +- .../Player/Events/PlayerSuitEvent.cs | 2 +- .../RemoteThrusterFlameController.cs | 2 +- QSB/AuthoritySync/AuthorityQueueEvent.cs | 2 +- .../Events/ConversationEvent.cs | 2 +- .../Events/ConversationStartEndEvent.cs | 2 +- QSB/GeyserSync/Events/GeyserEvent.cs | 2 +- QSB/ItemSync/ItemManager.cs | 16 +++---- QSB/ItemSync/WorldObjects/Items/QSBOWItem.cs | 42 ++++++++++++------- .../Events/JellyfishRisingEvent.cs | 2 +- QSB/JellyfishSync/Patches/JellyfishPatches.cs | 4 +- .../TransformSync/JellyfishTransformSync.cs | 8 ++-- QSB/LogSync/Events/RevealFactEvent.cs | 2 +- QSB/MeteorSync/Events/FragmentDamageEvent.cs | 2 +- QSB/MeteorSync/Events/FragmentResyncEvent.cs | 2 +- QSB/MeteorSync/Events/MeteorLaunchEvent.cs | 2 +- QSB/MeteorSync/Events/MeteorPreLaunchEvent.cs | 2 +- .../Events/MeteorSpecialImpactEvent.cs | 2 +- QSB/MeteorSync/Patches/MeteorClientPatches.cs | 2 +- QSB/MeteorSync/Patches/MeteorServerPatches.cs | 4 +- .../TransformSync/NomaiOrbTransformSync.cs | 2 +- QSB/OrbSync/WorldObjects/QSBOrbSlot.cs | 2 +- .../TransformSync/PlayerTransformSync.cs | 4 +- .../Events/MoonStateChangeEvent.cs | 2 +- .../Events/MultiStateChangeEvent.cs | 2 +- .../Events/QuantumAuthorityEvent.cs | 2 +- QSB/QuantumSync/Events/QuantumShuffleEvent.cs | 2 +- .../Events/SocketStateChangeEvent.cs | 2 +- QSB/QuantumSync/Patches/QuantumPatches.cs | 14 +++---- QSB/QuantumSync/QuantumManager.cs | 6 +-- .../QSBMultiStateQuantumObject.cs | 2 +- .../WorldObjects/QSBQuantumObject.cs | 4 +- .../Events/EnterExitRoastingEvent.cs | 2 +- .../Events/MarshmallowEventEvent.cs | 2 +- QSB/SectorSync/QSBSectorManager.cs | 2 +- QSB/ShipSync/Patches/ShipPatches.cs | 2 +- .../TransformSync/ShipTransformSync.cs | 2 +- QSB/Syncs/Sectored/BaseSectoredSync.cs | 4 +- .../Rigidbodies/SectoredRigidbodySync.cs | 2 +- .../Transforms/SectoredTransformSync.cs | 2 +- QSB/Syncs/SyncBase.cs | 4 +- .../Rigidbodies/UnsectoredRigidbodySync.cs | 2 +- .../Transforms/UnsectoredTransformSync.cs | 2 +- .../TransformSync/PlayerProbeSync.cs | 2 +- .../TranslatorTool/QSBTranslatorScanBeam.cs | 2 +- .../Events/SetAsTranslatedEvent.cs | 2 +- .../CustomRelativisticParticleSystem.cs | 2 +- QSB/Utility/DebugGUI.cs | 4 +- QSB/WorldSync/WorldObjectManager.cs | 28 ++++++++----- 54 files changed, 128 insertions(+), 106 deletions(-) diff --git a/QSB/Anglerfish/Events/AnglerChangeStateEvent.cs b/QSB/Anglerfish/Events/AnglerChangeStateEvent.cs index e1982b0e..b9d8de96 100644 --- a/QSB/Anglerfish/Events/AnglerChangeStateEvent.cs +++ b/QSB/Anglerfish/Events/AnglerChangeStateEvent.cs @@ -26,7 +26,7 @@ namespace QSB.Anglerfish.Events public override void OnReceiveRemote(bool isHost, AnglerChangeStateMessage message) { - if (!WorldObjectManager.AllReady) + if (!WorldObjectManager.AllObjectsReady) { return; } diff --git a/QSB/Anglerfish/Patches/AnglerPatches.cs b/QSB/Anglerfish/Patches/AnglerPatches.cs index d668edfa..205acec2 100644 --- a/QSB/Anglerfish/Patches/AnglerPatches.cs +++ b/QSB/Anglerfish/Patches/AnglerPatches.cs @@ -32,7 +32,7 @@ namespace QSB.Anglerfish.Patches [HarmonyPatch(typeof(AnglerfishController), nameof(AnglerfishController.OnSectorOccupantsUpdated))] public static bool OnSectorOccupantsUpdated(AnglerfishController __instance) { - if (!WorldObjectManager.AllReady) + if (!WorldObjectManager.AllObjectsReady) { return true; } @@ -77,7 +77,7 @@ namespace QSB.Anglerfish.Patches [HarmonyPatch(typeof(AnglerfishController), nameof(AnglerfishController.UpdateState))] public static bool UpdateState(AnglerfishController __instance) { - if (!WorldObjectManager.AllReady) + if (!WorldObjectManager.AllObjectsReady) { return true; } @@ -172,7 +172,7 @@ namespace QSB.Anglerfish.Patches [HarmonyPatch(typeof(AnglerfishController), nameof(AnglerfishController.UpdateMovement))] public static bool UpdateMovement(AnglerfishController __instance) { - if (!WorldObjectManager.AllReady) + if (!WorldObjectManager.AllObjectsReady) { return true; } diff --git a/QSB/Anglerfish/TransformSync/AnglerTransformSync.cs b/QSB/Anglerfish/TransformSync/AnglerTransformSync.cs index abeda8c0..3df7db00 100644 --- a/QSB/Anglerfish/TransformSync/AnglerTransformSync.cs +++ b/QSB/Anglerfish/TransformSync/AnglerTransformSync.cs @@ -9,7 +9,7 @@ namespace QSB.Anglerfish.TransformSync { public class AnglerTransformSync : UnsectoredRigidbodySync { - public override bool IsReady => WorldObjectManager.AllAdded; + public override bool IsReady => WorldObjectManager.AllObjectsAdded; public override bool UseInterpolation => false; private QSBAngler _qsbAngler; @@ -47,7 +47,7 @@ namespace QSB.Anglerfish.TransformSync { base.DeserializeTransform(reader, initialState); - if (!WorldObjectManager.AllReady || HasAuthority) + if (!WorldObjectManager.AllObjectsReady || HasAuthority) { return; } @@ -73,7 +73,7 @@ namespace QSB.Anglerfish.TransformSync protected override void OnRenderObject() { - if (!WorldObjectManager.AllReady + if (!WorldObjectManager.AllObjectsReady || !QSBCore.ShowLinesInDebug || !IsReady || ReferenceTransform == null diff --git a/QSB/Animation/NPC/Patches/CharacterAnimationPatches.cs b/QSB/Animation/NPC/Patches/CharacterAnimationPatches.cs index 9d871e51..9ffeb4b3 100644 --- a/QSB/Animation/NPC/Patches/CharacterAnimationPatches.cs +++ b/QSB/Animation/NPC/Patches/CharacterAnimationPatches.cs @@ -30,7 +30,7 @@ namespace QSB.Animation.NPC.Patches Animator ____animator, CharacterDialogueTree ____dialogueTree) { - if (!WorldObjectManager.AllReady || ConversationManager.Instance == null) + if (!WorldObjectManager.AllObjectsReady || ConversationManager.Instance == null) { return false; } @@ -178,7 +178,7 @@ namespace QSB.Animation.NPC.Patches [HarmonyPatch(typeof(KidRockController), nameof(KidRockController.Update))] public static bool UpdateReplacement(KidRockController __instance) { - if (!WorldObjectManager.AllReady) + if (!WorldObjectManager.AllObjectsReady) { return true; } diff --git a/QSB/Animation/Player/Events/AnimationTriggerEvent.cs b/QSB/Animation/Player/Events/AnimationTriggerEvent.cs index a24f9e64..9b21c954 100644 --- a/QSB/Animation/Player/Events/AnimationTriggerEvent.cs +++ b/QSB/Animation/Player/Events/AnimationTriggerEvent.cs @@ -21,7 +21,7 @@ namespace QSB.Animation.Player.Events public override void OnReceiveRemote(bool server, AnimationTriggerMessage message) { var animationSync = QSBPlayerManager.GetSyncObject(message.AttachedNetId); - if (!WorldObjectManager.AllReady || animationSync == null) + if (!WorldObjectManager.AllObjectsReady || animationSync == null) { return; } diff --git a/QSB/Animation/Player/Events/ChangeAnimTypeEvent.cs b/QSB/Animation/Player/Events/ChangeAnimTypeEvent.cs index 1d984e96..e2babef5 100644 --- a/QSB/Animation/Player/Events/ChangeAnimTypeEvent.cs +++ b/QSB/Animation/Player/Events/ChangeAnimTypeEvent.cs @@ -21,7 +21,7 @@ namespace QSB.Animation.Player.Events public override void OnReceiveRemote(bool server, EnumMessage message) { - if (!WorldObjectManager.AllReady || !QSBPlayerManager.GetPlayer(message.AboutId).IsReady) + if (!WorldObjectManager.AllObjectsReady || !QSBPlayerManager.GetPlayer(message.AboutId).IsReady) { return; } diff --git a/QSB/Animation/Player/Events/PlayerSuitEvent.cs b/QSB/Animation/Player/Events/PlayerSuitEvent.cs index 7c5f920f..d3fae87c 100644 --- a/QSB/Animation/Player/Events/PlayerSuitEvent.cs +++ b/QSB/Animation/Player/Events/PlayerSuitEvent.cs @@ -33,7 +33,7 @@ namespace QSB.Animation.Player.Events var player = QSBPlayerManager.GetPlayer(message.AboutId); player.SuitedUp = message.ToggleValue; - if (!WorldObjectManager.AllReady || !player.IsReady) + if (!WorldObjectManager.AllObjectsReady || !player.IsReady) { return; } diff --git a/QSB/Animation/Player/Thrusters/RemoteThrusterFlameController.cs b/QSB/Animation/Player/Thrusters/RemoteThrusterFlameController.cs index 5b3298b6..161524cd 100644 --- a/QSB/Animation/Player/Thrusters/RemoteThrusterFlameController.cs +++ b/QSB/Animation/Player/Thrusters/RemoteThrusterFlameController.cs @@ -86,7 +86,7 @@ namespace QSB.Animation.Player.Thrusters private void OnRenderObject() { - if (!WorldObjectManager.AllReady || !QSBCore.ShowLinesInDebug) + if (!WorldObjectManager.AllObjectsReady || !QSBCore.ShowLinesInDebug) { return; } diff --git a/QSB/AuthoritySync/AuthorityQueueEvent.cs b/QSB/AuthoritySync/AuthorityQueueEvent.cs index 6705d094..bca0b813 100644 --- a/QSB/AuthoritySync/AuthorityQueueEvent.cs +++ b/QSB/AuthoritySync/AuthorityQueueEvent.cs @@ -27,7 +27,7 @@ namespace QSB.AuthoritySync private static void OnReceive(AuthorityQueueMessage message) { - if (!WorldObjectManager.AllReady) + if (!WorldObjectManager.AllObjectsReady) { return; } diff --git a/QSB/ConversationSync/Events/ConversationEvent.cs b/QSB/ConversationSync/Events/ConversationEvent.cs index b1448bf6..93e49f23 100644 --- a/QSB/ConversationSync/Events/ConversationEvent.cs +++ b/QSB/ConversationSync/Events/ConversationEvent.cs @@ -22,7 +22,7 @@ namespace QSB.ConversationSync.Events public override void OnReceiveRemote(bool server, ConversationMessage message) { - if (!WorldObjectManager.AllReady) + if (!WorldObjectManager.AllObjectsReady) { return; } diff --git a/QSB/ConversationSync/Events/ConversationStartEndEvent.cs b/QSB/ConversationSync/Events/ConversationStartEndEvent.cs index e62ded18..e0eaeb29 100644 --- a/QSB/ConversationSync/Events/ConversationStartEndEvent.cs +++ b/QSB/ConversationSync/Events/ConversationStartEndEvent.cs @@ -29,7 +29,7 @@ namespace QSB.ConversationSync.Events return; } - if (!WorldObjectManager.AllReady) + if (!WorldObjectManager.AllObjectsReady) { return; } diff --git a/QSB/GeyserSync/Events/GeyserEvent.cs b/QSB/GeyserSync/Events/GeyserEvent.cs index d111eb21..0f008cd0 100644 --- a/QSB/GeyserSync/Events/GeyserEvent.cs +++ b/QSB/GeyserSync/Events/GeyserEvent.cs @@ -21,7 +21,7 @@ namespace QSB.GeyserSync.Events public override void OnReceiveRemote(bool isHost, BoolWorldObjectMessage message) { - if (!WorldObjectManager.AllReady) + if (!WorldObjectManager.AllObjectsReady) { return; } diff --git a/QSB/ItemSync/ItemManager.cs b/QSB/ItemSync/ItemManager.cs index 377ac1c7..55f43a26 100644 --- a/QSB/ItemSync/ItemManager.cs +++ b/QSB/ItemSync/ItemManager.cs @@ -12,14 +12,6 @@ namespace QSB.ItemSync { DebugLog.DebugWrite("Rebuilding OWItems...", MessageType.Info); - // Sockets - QSBWorldSync.Init(); - QSBWorldSync.Init(); - QSBWorldSync.Init(); - QSBWorldSync.Init(); - QSBWorldSync.Init(); - QSBWorldSync.Init(); - // Items QSBWorldSync.Init(); QSBWorldSync.Init(); @@ -27,6 +19,14 @@ namespace QSB.ItemSync QSBWorldSync.Init(); QSBWorldSync.Init(); QSBWorldSync.Init(); + + // Sockets + QSBWorldSync.Init(); + QSBWorldSync.Init(); + QSBWorldSync.Init(); + QSBWorldSync.Init(); + QSBWorldSync.Init(); + QSBWorldSync.Init(); } } } diff --git a/QSB/ItemSync/WorldObjects/Items/QSBOWItem.cs b/QSB/ItemSync/WorldObjects/Items/QSBOWItem.cs index 9de0c8d8..438d5411 100644 --- a/QSB/ItemSync/WorldObjects/Items/QSBOWItem.cs +++ b/QSB/ItemSync/WorldObjects/Items/QSBOWItem.cs @@ -25,21 +25,35 @@ namespace QSB.ItemSync.WorldObjects.Items return; } - InitialParent = attachedObject.transform.parent; - InitialPosition = attachedObject.transform.localPosition; - InitialRotation = attachedObject.transform.localRotation; - InitialSector = QSBWorldSync.GetWorldFromUnity(attachedObject.GetSector()); - - if (InitialParent == null) + StartDelayedReady(); + QSBCore.UnityEvents.RunWhen(() => WorldObjectManager.AllObjectsAdded, () => { - DebugLog.ToConsole($"Warning - InitialParent of {attachedObject.name} is null!", OWML.Common.MessageType.Warning); - } + FinishDelayedReady(); - if (InitialParent?.GetComponent() != null) - { - var qsbObj = (IQSBOWItemSocket)QSBWorldSync.GetWorldFromUnity(InitialParent.GetComponent()); - InitialSocket = qsbObj; - } + InitialParent = attachedObject.transform.parent; + InitialPosition = attachedObject.transform.localPosition; + InitialRotation = attachedObject.transform.localRotation; + var initialSector = attachedObject.GetSector(); + if (initialSector != null) + { + InitialSector = QSBWorldSync.GetWorldFromUnity(initialSector); + } + else + { + DebugLog.ToConsole($"Warning - InitialSector of {attachedObject.name} is null!", OWML.Common.MessageType.Warning); + } + + if (InitialParent == null) + { + DebugLog.ToConsole($"Warning - InitialParent of {attachedObject.name} is null!", OWML.Common.MessageType.Warning); + } + + if (InitialParent?.GetComponent() != null) + { + var qsbObj = (IQSBOWItemSocket)QSBWorldSync.GetWorldFromUnity(InitialParent.GetComponent()); + InitialSocket = qsbObj; + } + }); QSBPlayerManager.OnRemovePlayer += OnPlayerLeave; } @@ -63,7 +77,7 @@ namespace QSB.ItemSync.WorldObjects.Items AttachedObject.transform.localPosition = InitialPosition; AttachedObject.transform.localRotation = InitialRotation; AttachedObject.transform.localScale = Vector3.one; - AttachedObject.SetSector(InitialSector.AttachedObject); + AttachedObject.SetSector(InitialSector?.AttachedObject); AttachedObject.SetColliderActivation(true); } diff --git a/QSB/JellyfishSync/Events/JellyfishRisingEvent.cs b/QSB/JellyfishSync/Events/JellyfishRisingEvent.cs index fc1127a9..7d95195b 100644 --- a/QSB/JellyfishSync/Events/JellyfishRisingEvent.cs +++ b/QSB/JellyfishSync/Events/JellyfishRisingEvent.cs @@ -23,7 +23,7 @@ namespace QSB.JellyfishSync.Events public override void OnReceiveRemote(bool isHost, BoolWorldObjectMessage message) { - if (!WorldObjectManager.AllReady) + if (!WorldObjectManager.AllObjectsReady) { return; } diff --git a/QSB/JellyfishSync/Patches/JellyfishPatches.cs b/QSB/JellyfishSync/Patches/JellyfishPatches.cs index 1a6c332c..aa0cb85a 100644 --- a/QSB/JellyfishSync/Patches/JellyfishPatches.cs +++ b/QSB/JellyfishSync/Patches/JellyfishPatches.cs @@ -15,7 +15,7 @@ namespace QSB.JellyfishSync.Patches [HarmonyPatch(typeof(JellyfishController), nameof(JellyfishController.OnSectorOccupantsUpdated))] public static bool OnSectorOccupantsUpdated(JellyfishController __instance) { - if (!WorldObjectManager.AllReady) + if (!WorldObjectManager.AllObjectsReady) { return true; } @@ -42,7 +42,7 @@ namespace QSB.JellyfishSync.Patches [HarmonyPatch(typeof(JellyfishController), nameof(JellyfishController.FixedUpdate))] public static bool FixedUpdate(JellyfishController __instance) { - if (!WorldObjectManager.AllReady) + if (!WorldObjectManager.AllObjectsReady) { return true; } diff --git a/QSB/JellyfishSync/TransformSync/JellyfishTransformSync.cs b/QSB/JellyfishSync/TransformSync/JellyfishTransformSync.cs index ef6e7ccd..d343fea2 100644 --- a/QSB/JellyfishSync/TransformSync/JellyfishTransformSync.cs +++ b/QSB/JellyfishSync/TransformSync/JellyfishTransformSync.cs @@ -11,7 +11,7 @@ namespace QSB.JellyfishSync.TransformSync { public class JellyfishTransformSync : UnsectoredRigidbodySync { - public override bool IsReady => WorldObjectManager.AllAdded; + public override bool IsReady => WorldObjectManager.AllObjectsAdded; public override bool UseInterpolation => false; private QSBJellyfish _qsbJellyfish; @@ -47,7 +47,7 @@ namespace QSB.JellyfishSync.TransformSync { base.SerializeTransform(writer, initialState); - if (!WorldObjectManager.AllReady) + if (!WorldObjectManager.AllObjectsReady) { writer.Write(false); return; @@ -63,7 +63,7 @@ namespace QSB.JellyfishSync.TransformSync { base.DeserializeTransform(reader, initialState); - if (!WorldObjectManager.AllReady || HasAuthority) + if (!WorldObjectManager.AllObjectsReady || HasAuthority) { reader.ReadBoolean(); return; @@ -142,7 +142,7 @@ namespace QSB.JellyfishSync.TransformSync protected override void OnRenderObject() { - if (!WorldObjectManager.AllReady + if (!WorldObjectManager.AllObjectsReady || !QSBCore.ShowLinesInDebug || !IsReady || ReferenceTransform == null diff --git a/QSB/LogSync/Events/RevealFactEvent.cs b/QSB/LogSync/Events/RevealFactEvent.cs index c2fd4cd3..a37fde09 100644 --- a/QSB/LogSync/Events/RevealFactEvent.cs +++ b/QSB/LogSync/Events/RevealFactEvent.cs @@ -33,7 +33,7 @@ namespace QSB.LogSync.Events QSBWorldSync.AddFactReveal(message.FactId, message.SaveGame, message.ShowNotification); } - if (!WorldObjectManager.AllReady) + if (!WorldObjectManager.AllObjectsReady) { return; } diff --git a/QSB/MeteorSync/Events/FragmentDamageEvent.cs b/QSB/MeteorSync/Events/FragmentDamageEvent.cs index 2e9d2065..18242620 100644 --- a/QSB/MeteorSync/Events/FragmentDamageEvent.cs +++ b/QSB/MeteorSync/Events/FragmentDamageEvent.cs @@ -23,7 +23,7 @@ namespace QSB.MeteorSync.Events public override void OnReceiveRemote(bool isHost, FragmentDamageMessage message) { - if (!WorldObjectManager.AllReady) + if (!WorldObjectManager.AllObjectsReady) { return; } diff --git a/QSB/MeteorSync/Events/FragmentResyncEvent.cs b/QSB/MeteorSync/Events/FragmentResyncEvent.cs index e2c5eeae..3de746d5 100644 --- a/QSB/MeteorSync/Events/FragmentResyncEvent.cs +++ b/QSB/MeteorSync/Events/FragmentResyncEvent.cs @@ -48,7 +48,7 @@ namespace QSB.MeteorSync.Events public override void OnReceiveRemote(bool isHost, FragmentResyncMessage msg) { - if (!WorldObjectManager.AllReady) + if (!WorldObjectManager.AllObjectsReady) { return; } diff --git a/QSB/MeteorSync/Events/MeteorLaunchEvent.cs b/QSB/MeteorSync/Events/MeteorLaunchEvent.cs index 0a712a8f..f9edcddb 100644 --- a/QSB/MeteorSync/Events/MeteorLaunchEvent.cs +++ b/QSB/MeteorSync/Events/MeteorLaunchEvent.cs @@ -24,7 +24,7 @@ namespace QSB.MeteorSync.Events public override void OnReceiveRemote(bool isHost, MeteorLaunchMessage message) { - if (!WorldObjectManager.AllReady) + if (!WorldObjectManager.AllObjectsReady) { return; } diff --git a/QSB/MeteorSync/Events/MeteorPreLaunchEvent.cs b/QSB/MeteorSync/Events/MeteorPreLaunchEvent.cs index b20d573d..85e9b010 100644 --- a/QSB/MeteorSync/Events/MeteorPreLaunchEvent.cs +++ b/QSB/MeteorSync/Events/MeteorPreLaunchEvent.cs @@ -22,7 +22,7 @@ namespace QSB.MeteorSync.Events public override void OnReceiveRemote(bool isHost, WorldObjectMessage message) { - if (!WorldObjectManager.AllReady) + if (!WorldObjectManager.AllObjectsReady) { return; } diff --git a/QSB/MeteorSync/Events/MeteorSpecialImpactEvent.cs b/QSB/MeteorSync/Events/MeteorSpecialImpactEvent.cs index ce4cbbf1..ff263045 100644 --- a/QSB/MeteorSync/Events/MeteorSpecialImpactEvent.cs +++ b/QSB/MeteorSync/Events/MeteorSpecialImpactEvent.cs @@ -22,7 +22,7 @@ namespace QSB.MeteorSync.Events public override void OnReceiveRemote(bool isHost, WorldObjectMessage message) { - if (!WorldObjectManager.AllReady) + if (!WorldObjectManager.AllObjectsReady) { return; } diff --git a/QSB/MeteorSync/Patches/MeteorClientPatches.cs b/QSB/MeteorSync/Patches/MeteorClientPatches.cs index 7b9f0531..90f7f3d7 100644 --- a/QSB/MeteorSync/Patches/MeteorClientPatches.cs +++ b/QSB/MeteorSync/Patches/MeteorClientPatches.cs @@ -148,7 +148,7 @@ namespace QSB.MeteorSync.Patches { return true; } - if (!WorldObjectManager.AllReady) + if (!WorldObjectManager.AllObjectsReady) { return true; } diff --git a/QSB/MeteorSync/Patches/MeteorServerPatches.cs b/QSB/MeteorSync/Patches/MeteorServerPatches.cs index e6a9b981..c909b10d 100644 --- a/QSB/MeteorSync/Patches/MeteorServerPatches.cs +++ b/QSB/MeteorSync/Patches/MeteorServerPatches.cs @@ -15,7 +15,7 @@ namespace QSB.MeteorSync.Patches [HarmonyPatch(typeof(MeteorLauncher), nameof(MeteorLauncher.FixedUpdate))] public static bool FixedUpdate(MeteorLauncher __instance) { - if (!WorldObjectManager.AllReady) + if (!WorldObjectManager.AllObjectsReady) { return true; } @@ -202,7 +202,7 @@ namespace QSB.MeteorSync.Patches { return true; } - if (!WorldObjectManager.AllReady) + if (!WorldObjectManager.AllObjectsReady) { return true; } diff --git a/QSB/OrbSync/TransformSync/NomaiOrbTransformSync.cs b/QSB/OrbSync/TransformSync/NomaiOrbTransformSync.cs index 5f227f70..aacb5eb8 100644 --- a/QSB/OrbSync/TransformSync/NomaiOrbTransformSync.cs +++ b/QSB/OrbSync/TransformSync/NomaiOrbTransformSync.cs @@ -74,7 +74,7 @@ namespace QSB.OrbSync.TransformSync protected override Component InitRemoteTransform() => GetTransform(); protected override float DistanceLeeway => 1f; - public override bool IsReady => WorldObjectManager.AllReady; + public override bool IsReady => WorldObjectManager.AllObjectsReady; public override bool UseInterpolation => false; } } diff --git a/QSB/OrbSync/WorldObjects/QSBOrbSlot.cs b/QSB/OrbSync/WorldObjects/QSBOrbSlot.cs index 90f64311..65c5a5c9 100644 --- a/QSB/OrbSync/WorldObjects/QSBOrbSlot.cs +++ b/QSB/OrbSync/WorldObjects/QSBOrbSlot.cs @@ -20,7 +20,7 @@ namespace QSB.OrbSync.WorldObjects public void HandleEvent(bool state, int orbId) { - if (!WorldObjectManager.AllReady) + if (!WorldObjectManager.AllObjectsReady) { return; } diff --git a/QSB/Player/TransformSync/PlayerTransformSync.cs b/QSB/Player/TransformSync/PlayerTransformSync.cs index c586146e..e82cfac7 100644 --- a/QSB/Player/TransformSync/PlayerTransformSync.cs +++ b/QSB/Player/TransformSync/PlayerTransformSync.cs @@ -86,7 +86,7 @@ namespace QSB.Player.TransformSync protected override Component InitLocalTransform() { - QSBCore.UnityEvents.RunWhen(() => WorldObjectManager.AllReady, () => SectorSync.Init(Locator.GetPlayerSectorDetector(), TargetType.Player)); + QSBCore.UnityEvents.RunWhen(() => WorldObjectManager.AllObjectsReady, () => SectorSync.Init(Locator.GetPlayerSectorDetector(), TargetType.Player)); // player body var player = Locator.GetPlayerTransform(); @@ -249,7 +249,7 @@ namespace QSB.Player.TransformSync { base.OnRenderObject(); - if (!WorldObjectManager.AllReady + if (!WorldObjectManager.AllObjectsReady || !QSBCore.ShowLinesInDebug || !IsReady || ReferenceTransform == null) diff --git a/QSB/QuantumSync/Events/MoonStateChangeEvent.cs b/QSB/QuantumSync/Events/MoonStateChangeEvent.cs index e9795445..54502c16 100644 --- a/QSB/QuantumSync/Events/MoonStateChangeEvent.cs +++ b/QSB/QuantumSync/Events/MoonStateChangeEvent.cs @@ -24,7 +24,7 @@ namespace QSB.QuantumSync.Events public override void OnReceiveRemote(bool server, MoonStateChangeMessage message) { - if (!WorldObjectManager.AllReady) + if (!WorldObjectManager.AllObjectsReady) { return; } diff --git a/QSB/QuantumSync/Events/MultiStateChangeEvent.cs b/QSB/QuantumSync/Events/MultiStateChangeEvent.cs index 74968b7c..119d903d 100644 --- a/QSB/QuantumSync/Events/MultiStateChangeEvent.cs +++ b/QSB/QuantumSync/Events/MultiStateChangeEvent.cs @@ -33,7 +33,7 @@ namespace QSB.QuantumSync.Events public override void OnReceiveRemote(bool server, MultiStateChangeMessage message) { - if (!WorldObjectManager.AllReady) + if (!WorldObjectManager.AllObjectsReady) { return; } diff --git a/QSB/QuantumSync/Events/QuantumAuthorityEvent.cs b/QSB/QuantumSync/Events/QuantumAuthorityEvent.cs index adbd50d5..9e90a26e 100644 --- a/QSB/QuantumSync/Events/QuantumAuthorityEvent.cs +++ b/QSB/QuantumSync/Events/QuantumAuthorityEvent.cs @@ -20,7 +20,7 @@ namespace QSB.QuantumSync.Events public override bool CheckMessage(bool isServer, QuantumAuthorityMessage message) { - if (!WorldObjectManager.AllReady) + if (!WorldObjectManager.AllObjectsReady) { return false; } diff --git a/QSB/QuantumSync/Events/QuantumShuffleEvent.cs b/QSB/QuantumSync/Events/QuantumShuffleEvent.cs index ccd2e136..827e82d3 100644 --- a/QSB/QuantumSync/Events/QuantumShuffleEvent.cs +++ b/QSB/QuantumSync/Events/QuantumShuffleEvent.cs @@ -20,7 +20,7 @@ namespace QSB.QuantumSync.Events public override void OnReceiveRemote(bool server, QuantumShuffleMessage message) { - if (!WorldObjectManager.AllReady) + if (!WorldObjectManager.AllObjectsReady) { return; } diff --git a/QSB/QuantumSync/Events/SocketStateChangeEvent.cs b/QSB/QuantumSync/Events/SocketStateChangeEvent.cs index 31c67551..74d36e73 100644 --- a/QSB/QuantumSync/Events/SocketStateChangeEvent.cs +++ b/QSB/QuantumSync/Events/SocketStateChangeEvent.cs @@ -24,7 +24,7 @@ namespace QSB.QuantumSync.Events public override void OnReceiveRemote(bool server, SocketStateChangeMessage message) { - if (!WorldObjectManager.AllReady) + if (!WorldObjectManager.AllObjectsReady) { return; } diff --git a/QSB/QuantumSync/Patches/QuantumPatches.cs b/QSB/QuantumSync/Patches/QuantumPatches.cs index 72d0d4b8..24b2dce5 100644 --- a/QSB/QuantumSync/Patches/QuantumPatches.cs +++ b/QSB/QuantumSync/Patches/QuantumPatches.cs @@ -38,7 +38,7 @@ namespace QSB.QuantumSync.Patches ref QuantumSocket ____recentlyObscuredSocket, QuantumSocket ____occupiedSocket) { - if (WorldObjectManager.AllReady) + if (WorldObjectManager.AllObjectsReady) { var socketedWorldObject = QSBWorldSync.GetWorldFromUnity(__instance); if (socketedWorldObject.ControllingPlayer != QSBPlayerManager.LocalPlayerId) @@ -143,7 +143,7 @@ namespace QSB.QuantumSync.Patches [HarmonyPatch(typeof(SocketedQuantumObject), nameof(SocketedQuantumObject.MoveToSocket))] public static void SocketedQuantumObject_MoveToSocket(SocketedQuantumObject __instance, QuantumSocket socket) { - if (!WorldObjectManager.AllReady) + if (!WorldObjectManager.AllObjectsReady) { return; } @@ -185,7 +185,7 @@ namespace QSB.QuantumSync.Patches ref bool __result) { QSBQuantumShuffleObject shuffleWorldObject = default; - if (WorldObjectManager.AllReady) + if (WorldObjectManager.AllObjectsReady) { shuffleWorldObject = QSBWorldSync.GetWorldFromUnity(__instance); if (shuffleWorldObject.ControllingPlayer != QSBPlayerManager.LocalPlayerId) @@ -209,7 +209,7 @@ namespace QSB.QuantumSync.Patches ____shuffledObjects[j].localPosition = ____localPositions[____indexList[j]]; } - if (WorldObjectManager.AllReady) + if (WorldObjectManager.AllObjectsReady) { QSBEventManager.FireEvent( EventNames.QSBQuantumShuffle, @@ -225,7 +225,7 @@ namespace QSB.QuantumSync.Patches [HarmonyPatch(typeof(MultiStateQuantumObject), nameof(MultiStateQuantumObject.Start))] public static bool MultiStateQuantumObject_Start(MultiStateQuantumObject __instance, Sector ____sector, bool ____collapseOnStart) { - if (!WorldObjectManager.AllReady) + if (!WorldObjectManager.AllObjectsReady) { return true; } @@ -261,7 +261,7 @@ namespace QSB.QuantumSync.Patches [HarmonyPatch(typeof(MultiStateQuantumObject), nameof(MultiStateQuantumObject.ChangeQuantumState))] public static bool MultiStateQuantumObject_ChangeQuantumState(MultiStateQuantumObject __instance) { - if (!WorldObjectManager.AllReady) + if (!WorldObjectManager.AllObjectsReady) { return true; } @@ -280,7 +280,7 @@ namespace QSB.QuantumSync.Patches [HarmonyPatch(typeof(QuantumState), nameof(QuantumState.SetVisible))] public static void QuantumState_SetVisible(QuantumState __instance, bool visible) { - if (!WorldObjectManager.AllReady) + if (!WorldObjectManager.AllObjectsReady) { return; } diff --git a/QSB/QuantumSync/QuantumManager.cs b/QSB/QuantumSync/QuantumManager.cs index 0be493c2..e525d100 100644 --- a/QSB/QuantumSync/QuantumManager.cs +++ b/QSB/QuantumSync/QuantumManager.cs @@ -67,7 +67,7 @@ namespace QSB.QuantumSync public void OnRenderObject() { - if (!WorldObjectManager.AllReady || !QSBCore.ShowLinesInDebug) + if (!WorldObjectManager.AllObjectsReady || !QSBCore.ShowLinesInDebug) { return; } @@ -99,7 +99,7 @@ namespace QSB.QuantumSync public static Tuple> IsVisibleUsingCameraFrustum(ShapeVisibilityTracker tracker, bool ignoreLocalCamera) { - if (!AllReady) + if (!AllObjectsReady) { return new Tuple>(false, new List()); } @@ -146,7 +146,7 @@ namespace QSB.QuantumSync public static IEnumerable GetEntangledPlayers(QuantumObject obj) { - if (!WorldObjectManager.AllReady) + if (!WorldObjectManager.AllObjectsReady) { return Enumerable.Empty(); } diff --git a/QSB/QuantumSync/WorldObjects/QSBMultiStateQuantumObject.cs b/QSB/QuantumSync/WorldObjects/QSBMultiStateQuantumObject.cs index 6459b5f6..a35c019c 100644 --- a/QSB/QuantumSync/WorldObjects/QSBMultiStateQuantumObject.cs +++ b/QSB/QuantumSync/WorldObjects/QSBMultiStateQuantumObject.cs @@ -34,7 +34,7 @@ namespace QSB.QuantumSync.WorldObjects base.Init(attachedObject, id); StartDelayedReady(); - QSBCore.UnityEvents.RunWhen(() => WorldObjectManager.AllAdded, () => + QSBCore.UnityEvents.RunWhen(() => WorldObjectManager.AllObjectsAdded, () => { FinishDelayedReady(); diff --git a/QSB/QuantumSync/WorldObjects/QSBQuantumObject.cs b/QSB/QuantumSync/WorldObjects/QSBQuantumObject.cs index 48017810..8005135a 100644 --- a/QSB/QuantumSync/WorldObjects/QSBQuantumObject.cs +++ b/QSB/QuantumSync/WorldObjects/QSBQuantumObject.cs @@ -160,7 +160,7 @@ namespace QSB.QuantumSync.WorldObjects } IsEnabled = true; - if (!WorldObjectManager.AllReady && !QSBCore.IsHost) + if (!WorldObjectManager.AllObjectsReady && !QSBCore.IsHost) { return; } @@ -189,7 +189,7 @@ namespace QSB.QuantumSync.WorldObjects } IsEnabled = false; - if (!WorldObjectManager.AllReady && !QSBCore.IsHost) + if (!WorldObjectManager.AllObjectsReady && !QSBCore.IsHost) { return; } diff --git a/QSB/RoastingSync/Events/EnterExitRoastingEvent.cs b/QSB/RoastingSync/Events/EnterExitRoastingEvent.cs index e0cc1f6a..b9ad6fb1 100644 --- a/QSB/RoastingSync/Events/EnterExitRoastingEvent.cs +++ b/QSB/RoastingSync/Events/EnterExitRoastingEvent.cs @@ -42,7 +42,7 @@ namespace QSB.RoastingSync.Events public override void OnReceiveRemote(bool server, BoolWorldObjectMessage message) { - if (!WorldObjectManager.AllReady) + if (!WorldObjectManager.AllObjectsReady) { return; } diff --git a/QSB/RoastingSync/Events/MarshmallowEventEvent.cs b/QSB/RoastingSync/Events/MarshmallowEventEvent.cs index 7fca7d2f..27dc4587 100644 --- a/QSB/RoastingSync/Events/MarshmallowEventEvent.cs +++ b/QSB/RoastingSync/Events/MarshmallowEventEvent.cs @@ -24,7 +24,7 @@ namespace QSB.RoastingSync.Events public override void OnReceiveRemote(bool server, EnumMessage message) { - if (!WorldObjectManager.AllReady) + if (!WorldObjectManager.AllObjectsReady) { return; } diff --git a/QSB/SectorSync/QSBSectorManager.cs b/QSB/SectorSync/QSBSectorManager.cs index 6967cc40..ad8a54a2 100644 --- a/QSB/SectorSync/QSBSectorManager.cs +++ b/QSB/SectorSync/QSBSectorManager.cs @@ -22,7 +22,7 @@ namespace QSB.SectorSync public void Invoke() { - if (!Instance.IsReady || !AllReady) + if (!Instance.IsReady || !AllObjectsReady) { return; } diff --git a/QSB/ShipSync/Patches/ShipPatches.cs b/QSB/ShipSync/Patches/ShipPatches.cs index cabbc0ca..9d786168 100644 --- a/QSB/ShipSync/Patches/ShipPatches.cs +++ b/QSB/ShipSync/Patches/ShipPatches.cs @@ -74,7 +74,7 @@ namespace QSB.ShipSync.Patches * */ - if (!WorldObjectManager.AllReady || __instance != ShipManager.Instance.HatchInteractZone) + if (!WorldObjectManager.AllObjectsReady || __instance != ShipManager.Instance.HatchInteractZone) { return true; } diff --git a/QSB/ShipSync/TransformSync/ShipTransformSync.cs b/QSB/ShipSync/TransformSync/ShipTransformSync.cs index 9a6f232b..d5f910ed 100644 --- a/QSB/ShipSync/TransformSync/ShipTransformSync.cs +++ b/QSB/ShipSync/TransformSync/ShipTransformSync.cs @@ -24,7 +24,7 @@ namespace QSB.ShipSync.TransformSync protected override OWRigidbody GetRigidbody() { - QSBCore.UnityEvents.RunWhen(() => WorldObjectManager.AllReady, () => SectorSync.Init(Locator.GetShipDetector().GetComponent(), TargetType.Ship)); + QSBCore.UnityEvents.RunWhen(() => WorldObjectManager.AllObjectsReady, () => SectorSync.Init(Locator.GetShipDetector().GetComponent(), TargetType.Ship)); return Locator.GetShipBody(); } diff --git a/QSB/Syncs/Sectored/BaseSectoredSync.cs b/QSB/Syncs/Sectored/BaseSectoredSync.cs index f4fa6398..1de611ff 100644 --- a/QSB/Syncs/Sectored/BaseSectoredSync.cs +++ b/QSB/Syncs/Sectored/BaseSectoredSync.cs @@ -83,7 +83,7 @@ namespace QSB.Syncs.Sectored return; } - if (!WorldObjectManager.AllReady) + if (!WorldObjectManager.AllObjectsReady) { base.Update(); return; @@ -138,7 +138,7 @@ namespace QSB.Syncs.Sectored public override void DeserializeTransform(QNetworkReader reader, bool initialState) { int sectorId; - if (!WorldObjectManager.AllReady) + if (!WorldObjectManager.AllObjectsReady) { sectorId = reader.ReadInt32(); if (initialState && sectorId != -1) diff --git a/QSB/Syncs/Sectored/Rigidbodies/SectoredRigidbodySync.cs b/QSB/Syncs/Sectored/Rigidbodies/SectoredRigidbodySync.cs index bcc785d4..5a3ae377 100644 --- a/QSB/Syncs/Sectored/Rigidbodies/SectoredRigidbodySync.cs +++ b/QSB/Syncs/Sectored/Rigidbodies/SectoredRigidbodySync.cs @@ -62,7 +62,7 @@ namespace QSB.Syncs.Sectored.Rigidbodies { base.DeserializeTransform(reader, initialState); - if (!WorldObjectManager.AllReady) + if (!WorldObjectManager.AllObjectsReady) { reader.ReadVector3(); DeserializeRotation(reader); diff --git a/QSB/Syncs/Sectored/Transforms/SectoredTransformSync.cs b/QSB/Syncs/Sectored/Transforms/SectoredTransformSync.cs index 9459ac77..6d923c7e 100644 --- a/QSB/Syncs/Sectored/Transforms/SectoredTransformSync.cs +++ b/QSB/Syncs/Sectored/Transforms/SectoredTransformSync.cs @@ -32,7 +32,7 @@ namespace QSB.Syncs.Sectored.Transforms { base.DeserializeTransform(reader, initialState); - if (!WorldObjectManager.AllReady) + if (!WorldObjectManager.AllObjectsReady) { reader.ReadVector3(); DeserializeRotation(reader); diff --git a/QSB/Syncs/SyncBase.cs b/QSB/Syncs/SyncBase.cs index 624ab7c1..1a25d7d8 100644 --- a/QSB/Syncs/SyncBase.cs +++ b/QSB/Syncs/SyncBase.cs @@ -76,7 +76,7 @@ namespace QSB.Syncs // && Player.IsReady && NetId.Value != uint.MaxValue && NetId.Value != 0U - && WorldObjectManager.AllAdded; + && WorldObjectManager.AllObjectsAdded; public abstract bool IsReady { get; } public abstract bool UseInterpolation { get; } public abstract bool IgnoreDisabledAttachedObject { get; } @@ -298,7 +298,7 @@ namespace QSB.Syncs protected virtual void OnRenderObject() { - if (!WorldObjectManager.AllReady + if (!WorldObjectManager.AllObjectsReady || !QSBCore.ShowLinesInDebug || !IsReady || ReferenceTransform == null) diff --git a/QSB/Syncs/Unsectored/Rigidbodies/UnsectoredRigidbodySync.cs b/QSB/Syncs/Unsectored/Rigidbodies/UnsectoredRigidbodySync.cs index af6b41fd..179078fc 100644 --- a/QSB/Syncs/Unsectored/Rigidbodies/UnsectoredRigidbodySync.cs +++ b/QSB/Syncs/Unsectored/Rigidbodies/UnsectoredRigidbodySync.cs @@ -56,7 +56,7 @@ namespace QSB.Syncs.Unsectored.Rigidbodies public override void DeserializeTransform(QNetworkReader reader, bool initialState) { - if (!WorldObjectManager.AllReady) + if (!WorldObjectManager.AllObjectsReady) { reader.ReadVector3(); DeserializeRotation(reader); diff --git a/QSB/Syncs/Unsectored/Transforms/UnsectoredTransformSync.cs b/QSB/Syncs/Unsectored/Transforms/UnsectoredTransformSync.cs index 799c04d2..f08a20fb 100644 --- a/QSB/Syncs/Unsectored/Transforms/UnsectoredTransformSync.cs +++ b/QSB/Syncs/Unsectored/Transforms/UnsectoredTransformSync.cs @@ -28,7 +28,7 @@ namespace QSB.Syncs.Unsectored.Transforms public override void DeserializeTransform(QNetworkReader reader, bool initialState) { - if (!WorldObjectManager.AllReady) + if (!WorldObjectManager.AllObjectsReady) { reader.ReadVector3(); DeserializeRotation(reader); diff --git a/QSB/Tools/ProbeTool/TransformSync/PlayerProbeSync.cs b/QSB/Tools/ProbeTool/TransformSync/PlayerProbeSync.cs index 7db9e5ae..7eb63bd3 100644 --- a/QSB/Tools/ProbeTool/TransformSync/PlayerProbeSync.cs +++ b/QSB/Tools/ProbeTool/TransformSync/PlayerProbeSync.cs @@ -22,7 +22,7 @@ namespace QSB.Tools.ProbeTool.TransformSync protected override Component InitLocalTransform() { - QSBCore.UnityEvents.RunWhen(() => WorldObjectManager.AllReady, () => SectorSync.Init(Locator.GetProbe().GetSectorDetector(), TargetType.Probe)); + QSBCore.UnityEvents.RunWhen(() => WorldObjectManager.AllObjectsReady, () => SectorSync.Init(Locator.GetProbe().GetSectorDetector(), TargetType.Probe)); var body = Locator.GetProbe().transform; Player.ProbeBody = body.gameObject; diff --git a/QSB/Tools/TranslatorTool/QSBTranslatorScanBeam.cs b/QSB/Tools/TranslatorTool/QSBTranslatorScanBeam.cs index 37c2ccef..3f498900 100644 --- a/QSB/Tools/TranslatorTool/QSBTranslatorScanBeam.cs +++ b/QSB/Tools/TranslatorTool/QSBTranslatorScanBeam.cs @@ -77,7 +77,7 @@ namespace QSB.Tools.TranslatorTool private void OnRenderObject() { - if (!WorldObjectManager.AllReady || !QSBCore.ShowLinesInDebug) + if (!WorldObjectManager.AllObjectsReady || !QSBCore.ShowLinesInDebug) { return; } diff --git a/QSB/Tools/TranslatorTool/TranslationSync/Events/SetAsTranslatedEvent.cs b/QSB/Tools/TranslatorTool/TranslationSync/Events/SetAsTranslatedEvent.cs index a097d084..07e598db 100644 --- a/QSB/Tools/TranslatorTool/TranslationSync/Events/SetAsTranslatedEvent.cs +++ b/QSB/Tools/TranslatorTool/TranslationSync/Events/SetAsTranslatedEvent.cs @@ -21,7 +21,7 @@ namespace QSB.Tools.TranslatorTool.TranslationSync.Events public override void OnReceiveRemote(bool server, SetAsTranslatedMessage message) { - if (!WorldObjectManager.AllReady) + if (!WorldObjectManager.AllObjectsReady) { return; } diff --git a/QSB/Utility/CustomRelativisticParticleSystem.cs b/QSB/Utility/CustomRelativisticParticleSystem.cs index 8ac35981..769d0762 100644 --- a/QSB/Utility/CustomRelativisticParticleSystem.cs +++ b/QSB/Utility/CustomRelativisticParticleSystem.cs @@ -62,7 +62,7 @@ namespace QSB.Utility private void FixedUpdate() { - if (!WorldObjectManager.AllReady || !_isReady) + if (!WorldObjectManager.AllObjectsReady || !_isReady) { return; } diff --git a/QSB/Utility/DebugGUI.cs b/QSB/Utility/DebugGUI.cs index 435739c0..e124ecec 100644 --- a/QSB/Utility/DebugGUI.cs +++ b/QSB/Utility/DebugGUI.cs @@ -88,7 +88,7 @@ namespace QSB.Utility #region Column1 - Server data WriteLine(1, $"FPS : {Mathf.Round(1f / Time.smoothDeltaTime)}"); - WriteLine(1, $"HasWokenUp : {WorldObjectManager.AllReady}"); + WriteLine(1, $"HasWokenUp : {WorldObjectManager.AllObjectsReady}"); if (WakeUpSync.LocalInstance != null) { WriteLine(1, $"Server State : {ServerStateManager.Instance.GetServerState()}"); @@ -133,7 +133,7 @@ namespace QSB.Utility WriteLine(2, $"Ready : {player.IsReady}"); WriteLine(2, $"Suited Up : {player.SuitedUp}"); - if (player.IsReady && WorldObjectManager.AllReady) + if (player.IsReady && WorldObjectManager.AllObjectsReady) { var networkTransform = player.TransformSync; var referenceSector = networkTransform.ReferenceSector; diff --git a/QSB/WorldSync/WorldObjectManager.cs b/QSB/WorldSync/WorldObjectManager.cs index 26907478..e5c081b7 100644 --- a/QSB/WorldSync/WorldObjectManager.cs +++ b/QSB/WorldSync/WorldObjectManager.cs @@ -11,8 +11,15 @@ namespace QSB.WorldSync { private static readonly List _managers = new(); - public static bool AllAdded { get; private set; } - public static bool AllReady { get; private set; } + /// + /// Set when all WorldObjectManagers have called Init() on all their objects (AKA all the objects are created) + /// + public static bool AllObjectsAdded { get; private set; } + + /// + /// Set when all WorldObjects have finished running Init() + /// + public static bool AllObjectsReady { get; private set; } public virtual void Awake() { @@ -28,14 +35,14 @@ namespace QSB.WorldSync public static void SetNotReady() { - AllAdded = false; - AllReady = false; + AllObjectsAdded = false; + AllObjectsReady = false; } private void OnSceneLoaded(OWScene oldScene, OWScene newScene, bool inUniverse) { - AllAdded = false; - AllReady = false; + AllObjectsAdded = false; + AllObjectsReady = false; } public static void Rebuild(OWScene scene) @@ -67,12 +74,13 @@ namespace QSB.WorldSync { _numManagersReadying = 0; _numObjectsReadying = 0; - AllAdded = false; - AllReady = false; + AllObjectsAdded = false; + AllObjectsReady = false; foreach (var manager in _managers) { try { + DebugLog.DebugWrite($"Rebuilding {manager.GetType().Name}", MessageType.Info); manager.RebuildWorldObjects(scene); } catch (Exception ex) @@ -83,11 +91,11 @@ namespace QSB.WorldSync QSBCore.UnityEvents.RunWhen(() => _numManagersReadying == 0, () => { - AllAdded = true; + AllObjectsAdded = true; DebugLog.DebugWrite("World Objects added.", MessageType.Success); QSBCore.UnityEvents.RunWhen(() => _numObjectsReadying == 0, () => { - AllReady = true; + AllObjectsReady = true; DebugLog.DebugWrite("World Objects ready.", MessageType.Success); }); }); From 0906d5d071233a06260ee4bc4b51c8bf84da1f14 Mon Sep 17 00:00:00 2001 From: Mister_Nebula <41904486+misternebula@users.noreply.github.com> Date: Sat, 4 Dec 2021 09:52:00 +0000 Subject: [PATCH 4/4] remove null initialsector warning --- QSB/ItemSync/WorldObjects/Items/QSBOWItem.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/QSB/ItemSync/WorldObjects/Items/QSBOWItem.cs b/QSB/ItemSync/WorldObjects/Items/QSBOWItem.cs index 438d5411..cb335596 100644 --- a/QSB/ItemSync/WorldObjects/Items/QSBOWItem.cs +++ b/QSB/ItemSync/WorldObjects/Items/QSBOWItem.cs @@ -38,10 +38,6 @@ namespace QSB.ItemSync.WorldObjects.Items { InitialSector = QSBWorldSync.GetWorldFromUnity(initialSector); } - else - { - DebugLog.ToConsole($"Warning - InitialSector of {attachedObject.name} is null!", OWML.Common.MessageType.Warning); - } if (InitialParent == null) {