From 581f7072799900daef4bc7713b04e29260549b7b Mon Sep 17 00:00:00 2001 From: Nick Date: Sat, 23 Mar 2024 17:51:57 -0400 Subject: [PATCH] Fix phanton shuttle --- .../Builder/Atmosphere/SunOverrideBuilder.cs | 1 + .../VolumePatches/DestructionVolumePatches.cs | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/NewHorizons/Builder/Atmosphere/SunOverrideBuilder.cs b/NewHorizons/Builder/Atmosphere/SunOverrideBuilder.cs index df696f4d..9ee0e365 100644 --- a/NewHorizons/Builder/Atmosphere/SunOverrideBuilder.cs +++ b/NewHorizons/Builder/Atmosphere/SunOverrideBuilder.cs @@ -1,6 +1,7 @@ using NewHorizons.External.Modules; using NewHorizons.External.Modules.VariableSize; using UnityEngine; + namespace NewHorizons.Builder.Atmosphere { public static class SunOverrideBuilder diff --git a/NewHorizons/Patches/VolumePatches/DestructionVolumePatches.cs b/NewHorizons/Patches/VolumePatches/DestructionVolumePatches.cs index 0dd86a57..3091d1fd 100644 --- a/NewHorizons/Patches/VolumePatches/DestructionVolumePatches.cs +++ b/NewHorizons/Patches/VolumePatches/DestructionVolumePatches.cs @@ -26,5 +26,25 @@ namespace NewHorizons.Patches.VolumePatches return false; } + + /// + /// This method detects Nomai shuttles that are inactive + /// When active, it swaps the position of the NomaiShuttleController and the Rigidbody, so its not found as a child here and explodes continuously forever + /// Just ignore the shuttle if its inactive + /// + [HarmonyPrefix] + [HarmonyPatch(nameof(DestructionVolume.VanishNomaiShuttle))] + public static bool DestructionVolume_VanishNomaiShuttle(DestructionVolume __instance, OWRigidbody shuttleBody, RelativeLocationData entryLocation) + { + if (shuttleBody.GetComponentInChildren() == null) + { + if (__instance._nomaiShuttleBody == shuttleBody) + { + __instance._nomaiShuttleBody = null; + } + return false; + } + return true; + } } }