mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-01 03:32:38 +00:00
Revert "QSBSceneManager: OnStartSceneLoad"
This reverts commit 382fb58003
.
This commit is contained in:
parent
382fb58003
commit
ca043076a4
@ -104,6 +104,7 @@ public class QSBCore : ModBehaviour
|
||||
TextAssetsBundle = Helper.Assets.LoadBundle("AssetBundles/textassets");
|
||||
|
||||
QSBPatchManager.Init();
|
||||
DeterministicManager.Init();
|
||||
|
||||
var components = typeof(IAddComponentOnStart).GetDerivedTypes()
|
||||
.Select(x => gameObject.AddComponent(x))
|
||||
|
@ -16,21 +16,14 @@ public static class QSBSceneManager
|
||||
|
||||
static QSBSceneManager()
|
||||
{
|
||||
LoadManager.OnStartSceneLoad += OnStartSceneLoad;
|
||||
LoadManager.OnCompleteSceneLoad += OnCompleteSceneLoad;
|
||||
DebugLog.DebugWrite("Scene Manager ready.", MessageType.Success);
|
||||
}
|
||||
|
||||
private static void OnStartSceneLoad(OWScene oldScene, OWScene newScene)
|
||||
{
|
||||
DebugLog.DebugWrite($"START SCENE LOAD ({oldScene} -> {newScene})", MessageType.Info);
|
||||
QSBWorldSync.RemoveWorldObjects();
|
||||
DeterministicManager.OnStartSceneLoad();
|
||||
}
|
||||
|
||||
private static void OnCompleteSceneLoad(OWScene oldScene, OWScene newScene)
|
||||
{
|
||||
DebugLog.DebugWrite($"COMPLETE SCENE LOAD ({oldScene} -> {newScene})", MessageType.Info);
|
||||
QSBWorldSync.RemoveWorldObjects();
|
||||
var universe = InUniverse(newScene);
|
||||
if (QSBCore.IsInMultiplayer && universe)
|
||||
{
|
||||
@ -52,4 +45,4 @@ public static class QSBSceneManager
|
||||
|
||||
private static bool InUniverse(OWScene scene) =>
|
||||
scene is OWScene.SolarSystem or OWScene.EyeOfTheUniverse;
|
||||
}
|
||||
}
|
@ -16,21 +16,19 @@ public static class DeterministicManager
|
||||
private static readonly Dictionary<Transform, (int SiblingIndex, Transform Parent)> _cache = new();
|
||||
|
||||
public static void Init() =>
|
||||
LoadManager.OnStartSceneLoad += (_, _) => { };
|
||||
|
||||
public static void OnStartSceneLoad()
|
||||
{
|
||||
DebugLog.DebugWrite("cleared cache");
|
||||
_cache.Clear();
|
||||
|
||||
if (!_patched)
|
||||
LoadManager.OnStartSceneLoad += (_, _) =>
|
||||
{
|
||||
_harmony.PatchAll(typeof(OWRigidbodyPatches));
|
||||
_patched = true;
|
||||
}
|
||||
}
|
||||
DebugLog.DebugWrite("cleared cache");
|
||||
_cache.Clear();
|
||||
|
||||
public static void OnWorldObjectsReady()
|
||||
if (!_patched)
|
||||
{
|
||||
_harmony.PatchAll(typeof(OWRigidbodyPatches));
|
||||
_patched = true;
|
||||
}
|
||||
};
|
||||
|
||||
public static void WorldObjectsReady()
|
||||
{
|
||||
if (QSBCore.DebugSettings.DumpWorldObjects)
|
||||
{
|
||||
@ -301,4 +299,4 @@ public static class DeterministicManager
|
||||
/// </summary>
|
||||
public static IEnumerable<T> SortDeterministic<T>(this IEnumerable<T> components) where T : Component
|
||||
=> components.OrderBy(DeterministicPath);
|
||||
}
|
||||
}
|
@ -96,7 +96,7 @@ public static class QSBWorldSync
|
||||
AllObjectsReady = true;
|
||||
DebugLog.DebugWrite("World Objects ready.", MessageType.Success);
|
||||
|
||||
DeterministicManager.OnWorldObjectsReady();
|
||||
DeterministicManager.WorldObjectsReady();
|
||||
|
||||
if (!QSBCore.IsHost)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user