From 9f2ff4b6351699616d0947495e184dafbb6454e8 Mon Sep 17 00:00:00 2001 From: Nick Date: Fri, 25 Aug 2023 23:47:26 -0400 Subject: [PATCH] Fix proxies but not really --- NewHorizons/Handlers/ProxyHandler.cs | 6 ++++-- NewHorizons/Patches/ProxyPatches/ProxyBodyPatches.cs | 4 ++-- NewHorizons/Patches/ProxyPatches/ProxyOrbiterPatches.cs | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/NewHorizons/Handlers/ProxyHandler.cs b/NewHorizons/Handlers/ProxyHandler.cs index 42bb51f2..811d0837 100644 --- a/NewHorizons/Handlers/ProxyHandler.cs +++ b/NewHorizons/Handlers/ProxyHandler.cs @@ -49,9 +49,11 @@ namespace NewHorizons.Handlers public static void RegisterVanillaProxyOrbiter(ProxyOrbiter proxy) { - if (proxy._originalPlanetBody != null) + // The _originalBody is the moon + // For _originalPlanetBody, that game object will also have a ProxyBody on it so it'd be counted via the other cache + if (proxy._originalBody != null) { - _vanillaProxyOrbiter.Add(proxy._originalPlanetBody, proxy); + _vanillaProxyOrbiter.Add(proxy._originalBody, proxy); } } diff --git a/NewHorizons/Patches/ProxyPatches/ProxyBodyPatches.cs b/NewHorizons/Patches/ProxyPatches/ProxyBodyPatches.cs index b8f648ac..c3d83d83 100644 --- a/NewHorizons/Patches/ProxyPatches/ProxyBodyPatches.cs +++ b/NewHorizons/Patches/ProxyPatches/ProxyBodyPatches.cs @@ -7,8 +7,8 @@ namespace NewHorizons.Patches.ProxyPatches; public static class ProxyBodyPatches { [HarmonyPostfix] - [HarmonyPatch(nameof(ProxyBody.Awake))] - public static void ProxyBody_Awake(ProxyBody __instance) + [HarmonyPatch(nameof(ProxyBody.LateInitialize))] + public static void ProxyBody_LateInitialize(ProxyBody __instance) { ProxyHandler.RegisterVanillaProxyBody(__instance); } diff --git a/NewHorizons/Patches/ProxyPatches/ProxyOrbiterPatches.cs b/NewHorizons/Patches/ProxyPatches/ProxyOrbiterPatches.cs index c505b5f4..be099350 100644 --- a/NewHorizons/Patches/ProxyPatches/ProxyOrbiterPatches.cs +++ b/NewHorizons/Patches/ProxyPatches/ProxyOrbiterPatches.cs @@ -7,8 +7,8 @@ namespace NewHorizons.Patches.ProxyPatches; public static class ProxyOrbiterPatches { [HarmonyPostfix] - [HarmonyPatch(nameof(ProxyOrbiter.Awake))] - public static void ProxyOrbiter_Awake(ProxyOrbiter __instance) + [HarmonyPatch(nameof(ProxyOrbiter.SetOriginalBodies))] + public static void ProxyOrbiter_SetOriginalBodies(ProxyOrbiter __instance) { ProxyHandler.RegisterVanillaProxyOrbiter(__instance); }