Make planets get destroyed a tick later for that one guy

This commit is contained in:
Nick 2022-03-30 00:03:27 -04:00
parent 5898b9c52e
commit ce088f499a
3 changed files with 5 additions and 5 deletions

View File

@ -43,11 +43,11 @@ namespace NewHorizons.Builder.General
foreach(var name in _solarSystemBodies) foreach(var name in _solarSystemBodies)
{ {
var ao = AstroObjectLocator.GetAstroObject(name); var ao = AstroObjectLocator.GetAstroObject(name);
if (ao != null) Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => RemoveBody(ao, false)); if (ao != null) Main.Instance.ModHelper.Events.Unity.FireInNUpdates(() => RemoveBody(ao, false), 2);
} }
// Bring the sun back because why not // Bring the sun back because why not
Main.Instance.ModHelper.Events.Unity.FireInNUpdates(() => { if (Locator.GetAstroObject(AstroObject.Name.Sun).gameObject.activeInHierarchy) { sunVolumes.SetActive(true); } }, 2); Main.Instance.ModHelper.Events.Unity.FireInNUpdates(() => { if (Locator.GetAstroObject(AstroObject.Name.Sun).gameObject.activeInHierarchy) { sunVolumes.SetActive(true); } }, 3);
} }
public static void RemoveBody(AstroObject ao, bool delete = false, List<AstroObject> toDestroy = null) public static void RemoveBody(AstroObject ao, bool delete = false, List<AstroObject> toDestroy = null)

View File

@ -128,8 +128,8 @@ namespace NewHorizons.Handlers
if (body.Config.Destroy) if (body.Config.Destroy)
{ {
var ao = existingPlanet.GetComponent<AstroObject>(); var ao = existingPlanet.GetComponent<AstroObject>();
if (ao != null) Main.Instance.ModHelper.Events.Unity.FireInNUpdates(() => PlanetDestroyer.RemoveBody(ao), 1); if (ao != null) Main.Instance.ModHelper.Events.Unity.FireInNUpdates(() => PlanetDestroyer.RemoveBody(ao), 2);
else Main.Instance.ModHelper.Events.Unity.FireInNUpdates(() => existingPlanet.SetActive(false), 1); else Main.Instance.ModHelper.Events.Unity.FireInNUpdates(() => existingPlanet.SetActive(false), 2);
} }
else UpdateBody(body, existingPlanet); else UpdateBody(body, existingPlanet);
} }

View File

@ -429,7 +429,7 @@ namespace NewHorizons
public string[] GetInstalledAddons() public string[] GetInstalledAddons()
{ {
return Main.MountedAddons.ConvertAll(x => x.ModHelper.Manifest.UniqueName).ToArray(); return Main.MountedAddons.Select(x => x.ModHelper.Manifest.UniqueName).ToArray();
} }
} }
#endregion API #endregion API