From 7e2f911811018191e23b0f1b016abb7bb6ab7e35 Mon Sep 17 00:00:00 2001 From: Nick Date: Wed, 18 Oct 2023 17:18:56 -0400 Subject: [PATCH 1/4] Put the sun back after --- NewHorizons/Handlers/PlanetDestructionHandler.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NewHorizons/Handlers/PlanetDestructionHandler.cs b/NewHorizons/Handlers/PlanetDestructionHandler.cs index a2b9310b..572aa834 100644 --- a/NewHorizons/Handlers/PlanetDestructionHandler.cs +++ b/NewHorizons/Handlers/PlanetDestructionHandler.cs @@ -119,6 +119,9 @@ namespace NewHorizons.Handlers // Just to be safe SunLightEffectsController.Instance.Update(); + + // Put it back after banishing it else there are weird graphical bugs + sun.gameObject.transform.position = CenterOfTheUniverse.s_instance.transform.position; } private static void TimberHearthRemoved() From 0b10c6d0b5c5dc7a398e108b99bd864da3da6951 Mon Sep 17 00:00:00 2001 From: Nick Date: Wed, 18 Oct 2023 17:22:59 -0400 Subject: [PATCH 2/4] Only kill sun if theres a sun! --- .../Handlers/PlanetDestructionHandler.cs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/NewHorizons/Handlers/PlanetDestructionHandler.cs b/NewHorizons/Handlers/PlanetDestructionHandler.cs index 572aa834..7253c828 100644 --- a/NewHorizons/Handlers/PlanetDestructionHandler.cs +++ b/NewHorizons/Handlers/PlanetDestructionHandler.cs @@ -16,13 +16,16 @@ namespace NewHorizons.Handlers public static void RemoveStockPlanets() { - // For some reason disabling planets immediately ruins the creation of everything else - // However, the sun breaks a lot of stuff sometimes (literally destroys it in its volumes I imagine) - // Eg, vision torch in Mindscapes - // TODO: Fix it better by disabling destruction volumes the first few frames maybe - // Until then - // I am become death, the destroyer of worlds - SearchUtilities.Find("Sun_Body").transform.position = Vector3.left * 1000000000f; + if (Main.Instance.CurrentStarSystem != "EyeOfTheUniverse") + { + // For some reason disabling planets immediately ruins the creation of everything else + // However, the sun breaks a lot of stuff sometimes (literally destroys it in its volumes I imagine) + // Eg, vision torch in Mindscapes + // TODO: Fix it better by disabling destruction volumes the first few frames maybe + // Until then + // I am become death, the destroyer of worlds + SearchUtilities.Find("Sun_Body").transform.position = Vector3.left * 1000000000f; + } // Adapted from EOTS thanks corby var toDisable = new List(); From b45fe49a7c2a0b7a92f2dd319f3ed2ec25e432e8 Mon Sep 17 00:00:00 2001 From: Nick Date: Wed, 18 Oct 2023 17:26:52 -0400 Subject: [PATCH 3/4] Don't split up across two methods bc john asked to --- NewHorizons/Handlers/PlanetDestructionHandler.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/NewHorizons/Handlers/PlanetDestructionHandler.cs b/NewHorizons/Handlers/PlanetDestructionHandler.cs index 7253c828..b9b77493 100644 --- a/NewHorizons/Handlers/PlanetDestructionHandler.cs +++ b/NewHorizons/Handlers/PlanetDestructionHandler.cs @@ -71,6 +71,9 @@ namespace NewHorizons.Handlers { StrangerRemoved(); } + + // Put it back after banishing it else there are weird graphical bugs + SearchUtilities.Find("Sun_Body").gameObject.transform.position = CenterOfTheUniverse.s_instance.transform.position; } }, 2); // Have to wait or shit goes wild @@ -122,9 +125,6 @@ namespace NewHorizons.Handlers // Just to be safe SunLightEffectsController.Instance.Update(); - - // Put it back after banishing it else there are weird graphical bugs - sun.gameObject.transform.position = CenterOfTheUniverse.s_instance.transform.position; } private static void TimberHearthRemoved() From 13792b0fd0458ccbc332b7ce04e2dad492e2797d Mon Sep 17 00:00:00 2001 From: Nick Date: Thu, 19 Oct 2023 19:09:29 -0400 Subject: [PATCH 4/4] Actually fix the bug --- .../Handlers/PlanetDestructionHandler.cs | 4 ++-- .../MapPatches/PlaneOffsetMarkerPatches.cs | 18 ++++++++++++++++++ NewHorizons/manifest.json | 2 +- 3 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 NewHorizons/Patches/MapPatches/PlaneOffsetMarkerPatches.cs diff --git a/NewHorizons/Handlers/PlanetDestructionHandler.cs b/NewHorizons/Handlers/PlanetDestructionHandler.cs index b9b77493..7087c6fe 100644 --- a/NewHorizons/Handlers/PlanetDestructionHandler.cs +++ b/NewHorizons/Handlers/PlanetDestructionHandler.cs @@ -72,8 +72,8 @@ namespace NewHorizons.Handlers StrangerRemoved(); } - // Put it back after banishing it else there are weird graphical bugs - SearchUtilities.Find("Sun_Body").gameObject.transform.position = CenterOfTheUniverse.s_instance.transform.position; + // Put it back at the center of the universe after banishing it else there are weird graphical bugs + SearchUtilities.Find("Sun_Body").gameObject.transform.position = Locator._centerOfTheUniverse._staticReferenceFrame.transform.position; } }, 2); // Have to wait or shit goes wild diff --git a/NewHorizons/Patches/MapPatches/PlaneOffsetMarkerPatches.cs b/NewHorizons/Patches/MapPatches/PlaneOffsetMarkerPatches.cs new file mode 100644 index 00000000..2cc83d83 --- /dev/null +++ b/NewHorizons/Patches/MapPatches/PlaneOffsetMarkerPatches.cs @@ -0,0 +1,18 @@ +using HarmonyLib; + +namespace NewHorizons.Patches.MapPatches; + +[HarmonyPatch(typeof(PlaneOffsetMarker))] +internal class PlaneOffsetMarkerPatches +{ + [HarmonyPrefix] + [HarmonyPatch(nameof(PlaneOffsetMarker.Update))] + public static bool PlaneOffsetMarker_Update(PlaneOffsetMarker __instance) + { + // It tracks the sun originally + // Too lazy to perfectly time it getting the right static ref transform so we'll just do this + // It disables itself if the ref frame is ever null so don't let it do that bc the ref frame is null when it starts + __instance._sunTransform = Locator._centerOfTheUniverse._staticReferenceFrame.transform; + return __instance._sunTransform != null; + } +} diff --git a/NewHorizons/manifest.json b/NewHorizons/manifest.json index 1f0f6919..52c18523 100644 --- a/NewHorizons/manifest.json +++ b/NewHorizons/manifest.json @@ -4,7 +4,7 @@ "author": "xen, Bwc9876, clay, MegaPiggy, John, Trifid, Hawkbar, Book", "name": "New Horizons", "uniqueName": "xen.NewHorizons", - "version": "1.17.2", + "version": "1.17.3", "owmlVersion": "2.9.8", "dependencies": [ "JohnCorby.VanillaFix", "_nebula.MenuFramework", "xen.CommonCameraUtility", "dgarro.CustomShipLogModes" ], "conflicts": [ "Raicuparta.QuantumSpaceBuddies", "PacificEngine.OW_CommonResources" ],