mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Don't cache guys continuously forever, make reload configs work at eye
This commit is contained in:
parent
f4bc2f1aa7
commit
67ef927725
@ -6,8 +6,16 @@ namespace NewHorizons.Handlers;
|
||||
|
||||
public static class EyeDetailCacher
|
||||
{
|
||||
public static bool IsInitialized;
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
if (IsInitialized) return;
|
||||
|
||||
SearchUtilities.ClearDontDestroyOnLoadCache();
|
||||
|
||||
IsInitialized = true;
|
||||
|
||||
foreach (var body in Main.BodyDict["EyeOfTheUniverse"])
|
||||
{
|
||||
NHLogger.LogVerbose($"{nameof(EyeDetailCacher)}: {body.Config.name}");
|
||||
@ -17,7 +25,6 @@ public static class EyeDetailCacher
|
||||
{
|
||||
NHLogger.LogVerbose($"{nameof(EyeDetailCacher)}: {detail.path}");
|
||||
|
||||
|
||||
if (string.IsNullOrEmpty(detail.path)) continue;
|
||||
|
||||
var planet = detail.path.Contains('/') ? detail.path.Split('/').First() : string.Empty;
|
||||
|
||||
@ -969,7 +969,8 @@ namespace NewHorizons
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayerData.SaveEyeCompletion(); // So that the title screen doesn't keep warping you back to eye
|
||||
if (!IsWarpingBackToEye)
|
||||
PlayerData.SaveEyeCompletion(); // So that the title screen doesn't keep warping you back to eye
|
||||
|
||||
if (SystemDict[CurrentStarSystem].Config.enableTimeLoop) SecondsElapsedInLoop = TimeLoop.GetSecondsElapsed();
|
||||
else SecondsElapsedInLoop = -1;
|
||||
|
||||
@ -43,10 +43,22 @@ namespace NewHorizons.Utility.DebugTools
|
||||
NHLogger.LogWarning("Error While Reloading");
|
||||
}
|
||||
|
||||
Main.Instance.ForceClearCaches = true;
|
||||
|
||||
|
||||
SearchUtilities.Find("/PauseMenu/PauseMenuManagers").GetComponent<PauseMenuManager>().OnSkipToNextTimeLoop();
|
||||
|
||||
Main.Instance.ForceClearCaches = true;
|
||||
Main.Instance.ChangeCurrentStarSystem(Main.Instance.CurrentStarSystem, Main.Instance.DidWarpFromShip, Main.Instance.DidWarpFromVessel);
|
||||
if (Main.Instance.CurrentStarSystem == "EyeOfTheUniverse")
|
||||
{
|
||||
PlayerData._currentGameSave.warpedToTheEye = true;
|
||||
Main.Instance.IsWarpingBackToEye = true;
|
||||
EyeDetailCacher.IsInitialized = false;
|
||||
Main.Instance.ChangeCurrentStarSystem("SolarSystem");
|
||||
}
|
||||
else
|
||||
{
|
||||
Main.Instance.ChangeCurrentStarSystem(Main.Instance.CurrentStarSystem, Main.Instance.DidWarpFromShip, Main.Instance.DidWarpFromVessel);
|
||||
}
|
||||
|
||||
Main.SecondsElapsedInLoop = -1f;
|
||||
}
|
||||
|
||||
@ -18,6 +18,15 @@ namespace NewHorizons.Utility
|
||||
DontDestroyOnLoadCachedGameObjects[path] = go.InstantiateInactive().DontDestroyOnLoad();
|
||||
}
|
||||
|
||||
public static void ClearDontDestroyOnLoadCache()
|
||||
{
|
||||
foreach (var go in DontDestroyOnLoadCachedGameObjects.Values)
|
||||
{
|
||||
GameObject.Destroy(go);
|
||||
}
|
||||
DontDestroyOnLoadCachedGameObjects.Clear();
|
||||
}
|
||||
|
||||
public static void ClearCache()
|
||||
{
|
||||
NHLogger.LogVerbose("Clearing search cache");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user