From 95af39497c61db51793fe374414191842e70fde5 Mon Sep 17 00:00:00 2001 From: Nick Date: Wed, 23 Aug 2023 01:51:37 -0400 Subject: [PATCH] Apparently this doesn't even get called but I DONT CARE --- .../ShipLogEntryLocationPatches.cs | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 NewHorizons/Patches/ShipLogPatches/ShipLogEntryLocationPatches.cs diff --git a/NewHorizons/Patches/ShipLogPatches/ShipLogEntryLocationPatches.cs b/NewHorizons/Patches/ShipLogPatches/ShipLogEntryLocationPatches.cs new file mode 100644 index 00000000..956f22c5 --- /dev/null +++ b/NewHorizons/Patches/ShipLogPatches/ShipLogEntryLocationPatches.cs @@ -0,0 +1,30 @@ +using HarmonyLib; +using NewHorizons.Handlers; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace NewHorizons.Patches.ShipLogPatches +{ + [HarmonyPatch(typeof(ShipLogEntryLocation))] + public static class ShipLogEntryLocationPatches + { + [HarmonyPrefix] + [HarmonyPatch(nameof(ShipLogEntryLocation.OnValidate))] + public static bool ShipLogEntryLocation_OnValidate(ShipLogEntryLocation __instance) + { + // This part is unchanged + if (!__instance._entryID.Equals(string.Empty) && !__instance.gameObject.name.Equals(__instance._entryID)) + { + __instance.gameObject.name = __instance._entryID; + } + + // Base method checks if its on the Ringworld to see if it can be cloaked, we wanna check for a cloak field controller instead + var cloak = __instance.GetComponentInChildren(); + __instance._isWithinCloakField = cloak != null; + return false; + } + } +}