-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
<!-- A new module or something else important --> ## Major features - <!-- A new parameter added to a module, or API feature --> ## Minor features - <!-- Some improvement that requires no action on the part of add-on creators i.e., improved star graphics --> ## Improvements - When making changes to the Eye of the Universe you can now use any path from the base solar system. Note some objects might not behave as expected since many things aren't made to exist at the eye. <!-- Be sure to reference the existing issue if it exists --> ## Bug fixes - Copied dream lanterns now look correct
- Loading branch information
Showing
7 changed files
with
158 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
using NewHorizons.Utility; | ||
using NewHorizons.Utility.OWML; | ||
using System.Linq; | ||
|
||
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}"); | ||
if (body.Config?.Props?.details != null) | ||
{ | ||
foreach (var detail in body.Config.Props.details) | ||
{ | ||
if (!string.IsNullOrEmpty(detail.assetBundle)) continue; | ||
|
||
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 {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); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters