diff --git a/NewHorizons/Components/Stars/SunLightEffectsController.cs b/NewHorizons/Components/Stars/SunLightEffectsController.cs index 14af0ee9..fe6c3741 100644 --- a/NewHorizons/Components/Stars/SunLightEffectsController.cs +++ b/NewHorizons/Components/Stars/SunLightEffectsController.cs @@ -201,7 +201,8 @@ namespace NewHorizons.Components.Stars transform.localPosition = Vector3.zero; // Some effects use Locator.GetSunTransform so hopefully its fine to change it - Locator._sunTransform = transform; + // Use the root transform of the star because that's the default behaviour, breaks SunProxy is not (potentially others) + Locator._sunTransform = star.transform; // TODO?: maybe also turn off star controller stuff (mainly proxy light) since idk if that can handle more than 1 being on } diff --git a/NewHorizons/Patches/ProxyPatches/SunProxyPatches.cs b/NewHorizons/Patches/ProxyPatches/SunProxyPatches.cs new file mode 100644 index 00000000..48590d22 --- /dev/null +++ b/NewHorizons/Patches/ProxyPatches/SunProxyPatches.cs @@ -0,0 +1,19 @@ +using HarmonyLib; +using NewHorizons.Utility; + +namespace NewHorizons.Patches.ProxyPatches +{ + [HarmonyPatch(typeof(SunProxy))] + public static class SunProxyPatches + { + [HarmonyPostfix] + [HarmonyPatch(nameof(SunProxy.Start))] + public static void SunProxy_Start(SunProxy __instance) + { + // We mess with the Locator.GetSunTransform() value to switch it to other relevant stars since it's used for some other effects + // However if it's set to a different star when the SunProxy starts it breaks, so we double check it here + __instance._sunTransform = SearchUtilities.Find("Sun_Body").transform; + __instance._realSunController = __instance._sunTransform.GetComponent(); + } + } +}