Fix phanton shuttle

This commit is contained in:
Nick 2024-03-23 17:51:57 -04:00
parent f490238d60
commit 581f707279
2 changed files with 21 additions and 0 deletions

View File

@ -1,6 +1,7 @@
using NewHorizons.External.Modules; using NewHorizons.External.Modules;
using NewHorizons.External.Modules.VariableSize; using NewHorizons.External.Modules.VariableSize;
using UnityEngine; using UnityEngine;
namespace NewHorizons.Builder.Atmosphere namespace NewHorizons.Builder.Atmosphere
{ {
public static class SunOverrideBuilder public static class SunOverrideBuilder

View File

@ -26,5 +26,25 @@ namespace NewHorizons.Patches.VolumePatches
return false; return false;
} }
/// <summary>
/// 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
/// </summary>
[HarmonyPrefix]
[HarmonyPatch(nameof(DestructionVolume.VanishNomaiShuttle))]
public static bool DestructionVolume_VanishNomaiShuttle(DestructionVolume __instance, OWRigidbody shuttleBody, RelativeLocationData entryLocation)
{
if (shuttleBody.GetComponentInChildren<NomaiShuttleController>() == null)
{
if (__instance._nomaiShuttleBody == shuttleBody)
{
__instance._nomaiShuttleBody = null;
}
return false;
}
return true;
}
} }
} }