Make scatter work too and dont set warpedToEye since its unneeded

This commit is contained in:
Nick 2024-06-18 22:48:13 -04:00
parent 804665b3a9
commit aaa21aa3ba
2 changed files with 35 additions and 19 deletions

View File

@ -19,27 +19,44 @@ public static class EyeDetailCacher
foreach (var body in Main.BodyDict["EyeOfTheUniverse"])
{
NHLogger.LogVerbose($"{nameof(EyeDetailCacher)}: {body.Config.name}");
if (body.Config?.Props?.details == null) continue;
if (body.Config?.Props?.details != null)
{
foreach (var detail in body.Config.Props.details)
{
NHLogger.LogVerbose($"{nameof(EyeDetailCacher)}: {detail.path}");
if (!string.IsNullOrEmpty(detail.assetBundle)) continue;
if (string.IsNullOrEmpty(detail.path)) continue;
var planet = detail.path.Contains('/') ? detail.path.Split('/').First() : string.Empty;
AddPathToCache(detail.path);
}
}
if (body.Config?.Props?.scatter != null)
{
foreach (var scatter in body.Config.Props.scatter)
{
if (!string.IsNullOrEmpty(scatter.assetBundle)) continue;
AddPathToCache(scatter.path);
}
}
}
}
private static void AddPathToCache(string path)
{
NHLogger.LogVerbose($"{nameof(EyeDetailCacher)}: {path}");
if (string.IsNullOrEmpty(path)) return;
var planet = path.Contains('/') ? path.Split('/').First() : string.Empty;
if (planet != "EyeOfTheUniverse_Body" && planet != "Vessel_Body")
{
NHLogger.LogVerbose($"{nameof(EyeDetailCacher)}: Looking for {detail.path}");
var obj = SearchUtilities.Find(detail.path);
NHLogger.LogVerbose($"{nameof(EyeDetailCacher)}: Looking for {path}");
var obj = SearchUtilities.Find(path);
if (obj != null)
{
NHLogger.LogVerbose($"{nameof(EyeDetailCacher)}: Added solar system asset to dont destroy on load cache for eye: {detail.path}");
SearchUtilities.AddToDontDestroyOnLoadCache(detail.path, obj);
}
}
NHLogger.LogVerbose($"{nameof(EyeDetailCacher)}: Added solar system asset to dont destroy on load cache for eye: {path}");
SearchUtilities.AddToDontDestroyOnLoadCache(path, obj);
}
}
}

View File

@ -50,7 +50,6 @@ namespace NewHorizons.Utility.DebugTools
if (Main.Instance.CurrentStarSystem == "EyeOfTheUniverse")
{
PlayerData._currentGameSave.warpedToTheEye = true;
Main.Instance.IsWarpingBackToEye = true;
EyeDetailCacher.IsInitialized = false;
Main.Instance.ChangeCurrentStarSystem("SolarSystem");