mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Fix destruction
This commit is contained in:
parent
59980f8635
commit
7c745b92c4
@ -36,6 +36,12 @@ namespace NewHorizons.Handlers
|
||||
|
||||
public static void Init(List<NewHorizonsBody> bodies)
|
||||
{
|
||||
// Start by destroying all planets if need be
|
||||
if (Main.SystemDict[Main.Instance.CurrentStarSystem].Config.destroyStockPlanets)
|
||||
{
|
||||
PlanetDestructionHandler.RemoveStockPlanets();
|
||||
}
|
||||
|
||||
// Base game value
|
||||
SolarSystemRadius = DefaultFurthestOrbit;
|
||||
|
||||
@ -60,7 +66,7 @@ namespace NewHorizons.Handlers
|
||||
var starLightGO = UnityEngine.Object.Instantiate(sun.GetComponentInChildren<SunLightController>().gameObject);
|
||||
foreach (var comp in starLightGO.GetComponents<Component>())
|
||||
{
|
||||
if (!(comp is SunLightController) && !(comp is SunLightParamUpdater) && !(comp is Light) && !(comp is Transform))
|
||||
if (comp is not SunLightController && comp is not SunLightParamUpdater && comp is not Light && comp is not Transform)
|
||||
{
|
||||
UnityEngine.Object.Destroy(comp);
|
||||
}
|
||||
@ -138,10 +144,6 @@ namespace NewHorizons.Handlers
|
||||
NHLogger.Log("Done loading bodies");
|
||||
|
||||
SingularityBuilder.PairAllSingularities();
|
||||
|
||||
// Events.FireOnNextUpdate(PlanetDestroyer.RemoveAllProxies);
|
||||
|
||||
if (Main.SystemDict[Main.Instance.CurrentStarSystem].Config.destroyStockPlanets) PlanetDestructionHandler.RemoveStockPlanets();
|
||||
}
|
||||
|
||||
public static bool LoadBody(NewHorizonsBody body, bool defaultPrimaryToSun = false)
|
||||
|
||||
@ -54,23 +54,36 @@ namespace NewHorizons.Handlers
|
||||
|
||||
public static void RemoveSolarSystem()
|
||||
{
|
||||
// Stop the sun from killing the player if they spawn at the center of the solar system
|
||||
SearchUtilities.Find("Sun_Body/Sector_SUN/Volumes_SUN").SetActive(false);
|
||||
// Adapted from EOTS thanks corby
|
||||
var toDisable = new List<GameObject>();
|
||||
|
||||
// Collect all rigid bodies and proxies
|
||||
foreach (var rigidbody in CenterOfTheUniverse.s_rigidbodies)
|
||||
{
|
||||
if (rigidbody.name is not "Player_Body" && rigidbody.name is not "Ship_Body")
|
||||
{
|
||||
toDisable.Add(rigidbody.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var proxyBody in GameObject.FindObjectsOfType<ProxyBody>())
|
||||
{
|
||||
toDisable.Add(proxyBody.gameObject);
|
||||
}
|
||||
|
||||
Delay.FireInNUpdates(() =>
|
||||
{
|
||||
// From EOTS thanks corby
|
||||
foreach (var rigidbody in CenterOfTheUniverse.s_rigidbodies)
|
||||
if (rigidbody.name is not "Player_Body" or "Ship_Body")
|
||||
rigidbody.gameObject.SetActive(false);
|
||||
|
||||
foreach (var proxyBody in GameObject.FindObjectsOfType<ProxyBody>())
|
||||
proxyBody.gameObject.SetActive(false);
|
||||
foreach (var gameObject in toDisable)
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
GameObject.FindObjectOfType<SunProxy>().gameObject.SetActive(false);
|
||||
}, 2); // Have to wait or shit goes wild
|
||||
|
||||
foreach (var streamingAssetBundle in StreamingManager.s_activeBundles)
|
||||
streamingAssetBundle.Unload();
|
||||
}, 2); // Random shit breaks if we don't wait idk why
|
||||
foreach (var streamingAssetBundle in StreamingManager.s_activeBundles)
|
||||
{
|
||||
//streamingAssetBundle.Unload();
|
||||
}
|
||||
}
|
||||
|
||||
public static void RemoveEyeOfTheUniverse()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user