mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
qsb compat (#478)
This commit is contained in:
commit
b722297ad5
@ -24,6 +24,10 @@ namespace NewHorizons.Builder.Props
|
||||
|
||||
private static void SceneManager_sceneUnloaded(Scene scene)
|
||||
{
|
||||
foreach (var prefab in _fixedPrefabCache.Values)
|
||||
{
|
||||
GameObject.Destroy(prefab.prefab);
|
||||
}
|
||||
_fixedPrefabCache.Clear();
|
||||
_detailInfoToCorrespondingSpawnedGameObject.Clear();
|
||||
}
|
||||
@ -114,7 +118,8 @@ namespace NewHorizons.Builder.Props
|
||||
|
||||
if (detail.path != null)
|
||||
{
|
||||
_fixedPrefabCache.Add((sector, detail.path), (prop.InstantiateInactive(), isItem));
|
||||
// We put these in DontDestroyOnLoad so that QSB will ignore them and so they don't clutter up the scene.
|
||||
_fixedPrefabCache.Add((sector, detail.path), (prop.InstantiateInactive().DontDestroyOnLoad(), isItem));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -4,7 +4,6 @@ using NewHorizons.Builder.Body;
|
||||
using NewHorizons.Builder.General;
|
||||
using NewHorizons.Builder.Props;
|
||||
using NewHorizons.Components;
|
||||
using NewHorizons.Components.Orbital;
|
||||
using NewHorizons.Components.Fixers;
|
||||
using NewHorizons.Components.SizeControllers;
|
||||
using NewHorizons.External;
|
||||
@ -29,7 +28,6 @@ using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.SceneManagement;
|
||||
using Logger = NewHorizons.Utility.Logger;
|
||||
using NewHorizons.Components.Stars;
|
||||
|
||||
namespace NewHorizons
|
||||
{
|
||||
@ -76,9 +74,9 @@ namespace NewHorizons
|
||||
|
||||
// API events
|
||||
public class StarSystemEvent : UnityEvent<string> { }
|
||||
public StarSystemEvent OnChangeStarSystem;
|
||||
public StarSystemEvent OnStarSystemLoaded;
|
||||
public StarSystemEvent OnPlanetLoaded;
|
||||
public StarSystemEvent OnChangeStarSystem = new();
|
||||
public StarSystemEvent OnStarSystemLoaded = new();
|
||||
public StarSystemEvent OnPlanetLoaded = new();
|
||||
|
||||
public static bool HasDLC { get => EntitlementsManager.IsDlcOwned() == EntitlementsManager.AsyncOwnershipStatus.Owned; }
|
||||
|
||||
@ -187,10 +185,6 @@ namespace NewHorizons
|
||||
// Patches
|
||||
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly());
|
||||
|
||||
OnChangeStarSystem = new StarSystemEvent();
|
||||
OnStarSystemLoaded = new StarSystemEvent();
|
||||
OnPlanetLoaded = new StarSystemEvent();
|
||||
|
||||
SceneManager.sceneLoaded += OnSceneLoaded;
|
||||
SceneManager.sceneUnloaded += OnSceneUnloaded;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user