use annotation instead of yucky manual way

This commit is contained in:
JohnCorby 2022-06-08 13:38:04 -07:00
parent 7add9f8d8d
commit b67207555f
2 changed files with 7 additions and 4 deletions

View File

@ -116,10 +116,7 @@ namespace NewHorizons
public void Start()
{
// Patches
Harmony harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly());
harmony.Patch(typeof(CloakFieldController).GetMethod("get_" + nameof(CloakFieldController.isPlayerInsideCloak), BindingFlags.Public | BindingFlags.Instance), postfix: new HarmonyMethod(typeof(Patches.LocatorPatches).GetMethod(nameof(Patches.LocatorPatches.CloakFieldController_isPlayerInsideCloak), BindingFlags.Static | BindingFlags.Public)));
harmony.Patch(typeof(CloakFieldController).GetMethod("get_" + nameof(CloakFieldController.isProbeInsideCloak), BindingFlags.Public | BindingFlags.Instance), postfix: new HarmonyMethod(typeof(Patches.LocatorPatches).GetMethod(nameof(Patches.LocatorPatches.CloakFieldController_isProbeInsideCloak), BindingFlags.Static | BindingFlags.Public)));
harmony.Patch(typeof(CloakFieldController).GetMethod("get_" + nameof(CloakFieldController.isShipInsideCloak), BindingFlags.Public | BindingFlags.Instance), postfix: new HarmonyMethod(typeof(Patches.LocatorPatches).GetMethod(nameof(Patches.LocatorPatches.CloakFieldController_isShipInsideCloak), BindingFlags.Static | BindingFlags.Public)));
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly());
OnChangeStarSystem = new StarSystemEvent();
OnStarSystemLoaded = new StarSystemEvent();

View File

@ -11,16 +11,22 @@ namespace NewHorizons.Patches
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;