From 686e2394d61bb0b81b70c1e2a2d165c09ab41443 Mon Sep 17 00:00:00 2001 From: Nick Date: Mon, 7 Aug 2023 22:15:43 -0400 Subject: [PATCH] Fix cloak not being disabled probably --- NewHorizons/Handlers/PlanetDestructionHandler.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/NewHorizons/Handlers/PlanetDestructionHandler.cs b/NewHorizons/Handlers/PlanetDestructionHandler.cs index 938877c3..bf683b91 100644 --- a/NewHorizons/Handlers/PlanetDestructionHandler.cs +++ b/NewHorizons/Handlers/PlanetDestructionHandler.cs @@ -81,6 +81,9 @@ namespace NewHorizons.Handlers // force call update here to make it switch to an active star. idk why we didnt have to do this before SunLightEffectsController.Instance.Update(); + + // Since we didn't call RemoveBody on the Stranger have to call this here + StrangerRemoved(); }, 2); // Have to wait or shit goes wild foreach (var streamingAssetBundle in StreamingManager.s_activeBundles) @@ -99,14 +102,23 @@ namespace NewHorizons.Handlers } } + public static void StrangerRemoved() + { + CloakHandler.FlagStrangerDisabled = true; + + if (Locator._cloakFieldController?.GetComponentInParent()?.GetAstroObjectName() == AstroObject.Name.RingWorld) + { + Locator._cloakFieldController = null; + } + } + public static void RemoveBody(AstroObject ao, bool delete = false, List toDestroy = null) { NHLogger.LogVerbose($"Removing [{ao.name}]"); if (ao.GetAstroObjectName() == AstroObject.Name.RingWorld) { - CloakHandler.FlagStrangerDisabled = true; - if (Locator._cloakFieldController?.GetComponentInParent() == ao) Locator._cloakFieldController = null; + StrangerRemoved(); } if (ao.gameObject == null || !ao.gameObject.activeInHierarchy)