unloading streaming stuff in custom systems (#1103)

## Improvements

- do not load unnecessary bundles in custom systems. saves VRAM. does
not affect RAM

details stay visible
does not seem to cause softlocks.
works when going from custom to regular (you dont fall thru TH)
seems to cause no extra errors in logs
This commit is contained in:
Noah Pilarski 2025-07-20 20:21:28 -04:00 committed by GitHub
commit 31a6093a1b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -42,6 +42,16 @@ namespace NewHorizons.Handlers
public static void Init(List<NewHorizonsBody> bodies)
{
// TH gets preloaded in title screen. custom systems dont need this
if (Main.Instance.CurrentStarSystem is not ("SolarSystem" or "EyeOfTheUniverse"))
{
foreach (var bundle in StreamingManager.s_activeBundles)
{
// save memory NOW instead of next frame when other stuff has loaded and taken memory
bundle.UnloadImmediate();
}
}
// Start by destroying all planets if need be
if (Main.SystemDict[Main.Instance.CurrentStarSystem].Config.destroyStockPlanets)
{