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

View File

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