Move cloak patches

This commit is contained in:
Noah Pilarski 2022-09-11 04:27:15 -04:00
parent c44dd5d85f
commit f145d5ccc8
2 changed files with 31 additions and 21 deletions

View File

@ -0,0 +1,31 @@
using HarmonyLib;
using System;
using System.Collections.Generic;
using System.Linq;
namespace NewHorizons.Patches
{
public static class CloakPatches
{
[HarmonyPostfix]
[HarmonyPatch(typeof(CloakFieldController), nameof(CloakFieldController.isPlayerInsideCloak), MethodType.Getter)]
public static void CloakFieldController_isPlayerInsideCloak(CloakFieldController __instance, ref bool __result)
{
__result = __result || Components.CloakSectorController.isPlayerInside;
}
[HarmonyPostfix]
[HarmonyPatch(typeof(CloakFieldController), nameof(CloakFieldController.isProbeInsideCloak), MethodType.Getter)]
public static void CloakFieldController_isProbeInsideCloak(CloakFieldController __instance, ref bool __result)
{
__result = __result || Components.CloakSectorController.isProbeInside;
}
[HarmonyPostfix]
[HarmonyPatch(typeof(CloakFieldController), nameof(CloakFieldController.isShipInsideCloak), MethodType.Getter)]
public static void CloakFieldController_isShipInsideCloak(CloakFieldController __instance, ref bool __result)
{
__result = __result || Components.CloakSectorController.isShipInside;
}
}
}

View File

@ -19,27 +19,6 @@ namespace NewHorizons.Patches
return Locator._cloakFieldController == null; return Locator._cloakFieldController == null;
} }
[HarmonyPostfix]
[HarmonyPatch(typeof(CloakFieldController), nameof(CloakFieldController.isPlayerInsideCloak), MethodType.Getter)]
public static void CloakFieldController_isPlayerInsideCloak(CloakFieldController __instance, ref bool __result)
{
__result = __result || Components.CloakSectorController.isPlayerInside;
}
[HarmonyPostfix]
[HarmonyPatch(typeof(CloakFieldController), nameof(CloakFieldController.isProbeInsideCloak), MethodType.Getter)]
public static void CloakFieldController_isProbeInsideCloak(CloakFieldController __instance, ref bool __result)
{
__result = __result || Components.CloakSectorController.isProbeInside;
}
[HarmonyPostfix]
[HarmonyPatch(typeof(CloakFieldController), nameof(CloakFieldController.isShipInsideCloak), MethodType.Getter)]
public static void CloakFieldController_isShipInsideCloak(CloakFieldController __instance, ref bool __result)
{
__result = __result || Components.CloakSectorController.isShipInside;
}
// Locator Fixes // Locator Fixes
// Vanilla doesn't register these AstroObjects for some reason. So here is a fix. // Vanilla doesn't register these AstroObjects for some reason. So here is a fix.
[HarmonyPrefix] [HarmonyPrefix]