From 41622fb0a73193c5e958fb9ffda93eaa7c7cfcfd Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Tue, 16 Aug 2022 02:16:54 -0400 Subject: [PATCH] Clarify --- NewHorizons/Patches/LocatorPatches.cs | 7 +++++++ NewHorizons/Utility/AstroObjectLocator.cs | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/NewHorizons/Patches/LocatorPatches.cs b/NewHorizons/Patches/LocatorPatches.cs index 1a95dfbb..91a32e93 100644 --- a/NewHorizons/Patches/LocatorPatches.cs +++ b/NewHorizons/Patches/LocatorPatches.cs @@ -41,6 +41,9 @@ namespace NewHorizons.Patches __result = __result || Components.CloakSectorController.isShipInside; } + // Locator Fixes + // Vanilla doesn't register these AstroObjects for some reason. So here is a fix. + [HarmonyPrefix] [HarmonyPatch(typeof(Locator), nameof(Locator.GetAstroObject))] public static bool Locator_GetAstroObject(AstroObject.Name astroObjectName, ref AstroObject __result) @@ -76,6 +79,8 @@ namespace NewHorizons.Patches public static bool Locator_RegisterAstroObject(AstroObject astroObject) { if (astroObject.GetAstroObjectName() == AstroObject.Name.None) return false; + + // Sun Station name change because for some dumb reason it doesn't use AstroObject.Name.SunStation if (!string.IsNullOrEmpty(astroObject._customName) && astroObject._customName.Equals("Sun Station")) { if (astroObject.gameObject.name == "SunStation_Body") @@ -84,9 +89,11 @@ namespace NewHorizons.Patches _sunStation = astroObject; return false; } + // Debris uses same custom name because morbius, so let us change that. else if (astroObject.gameObject.name == "SS_Debris_Body") astroObject._customName = "Sun Station Debris"; return true; } + switch (astroObject.GetAstroObjectName()) { case AstroObject.Name.Eye: diff --git a/NewHorizons/Utility/AstroObjectLocator.cs b/NewHorizons/Utility/AstroObjectLocator.cs index bfe23bfe..317ffc41 100644 --- a/NewHorizons/Utility/AstroObjectLocator.cs +++ b/NewHorizons/Utility/AstroObjectLocator.cs @@ -158,7 +158,7 @@ namespace NewHorizons.Utility .Select(x => x.gameObject) .Where(x => x.name == "SS_Debris_Body")); break; - // For some dumb reason the sun station doesn't use AstroObject.Name.SunStation + // Just in case GetChildren runs before sun station's name is changed case AstroObject.Name.CustomString: if (primary._customName.Equals("Sun Station")) {