Fix NRE in ProxyBody.IsObjectInSupernova

This commit is contained in:
Noah Pilarski 2022-08-11 14:22:56 -04:00
parent 2012c911b7
commit 215643607c

View File

@ -1,4 +1,4 @@
using HarmonyLib; using HarmonyLib;
namespace NewHorizons.Patches namespace NewHorizons.Patches
{ {
[HarmonyPatch] [HarmonyPatch]
@ -13,6 +13,13 @@ namespace NewHorizons.Patches
GlobalMessenger.AddListener("ExitMapView", __instance.OnExitMapView); GlobalMessenger.AddListener("ExitMapView", __instance.OnExitMapView);
} }
[HarmonyPrefix]
[HarmonyPatch(typeof(ProxyBody), nameof(ProxyBody.IsObjectInSupernova))]
public static bool ProxyBody_IsObjectInSupernova(ProxyBody __instance)
{
return Locator.GetSunController() != null;
}
[HarmonyPrefix] [HarmonyPrefix]
[HarmonyPatch(typeof(ProxyBody), nameof(ProxyBody.OnDestroy))] [HarmonyPatch(typeof(ProxyBody), nameof(ProxyBody.OnDestroy))]
public static void ProxyBody_OnDestroy(ProxyBody __instance) public static void ProxyBody_OnDestroy(ProxyBody __instance)