This commit is contained in:
Noah Pilarski 2022-08-16 02:16:54 -04:00
parent 7eb11e980c
commit 41622fb0a7
2 changed files with 8 additions and 1 deletions

View File

@ -41,6 +41,9 @@ namespace NewHorizons.Patches
__result = __result || Components.CloakSectorController.isShipInside; __result = __result || Components.CloakSectorController.isShipInside;
} }
// Locator Fixes
// Vanilla doesn't register these AstroObjects for some reason. So here is a fix.
[HarmonyPrefix] [HarmonyPrefix]
[HarmonyPatch(typeof(Locator), nameof(Locator.GetAstroObject))] [HarmonyPatch(typeof(Locator), nameof(Locator.GetAstroObject))]
public static bool Locator_GetAstroObject(AstroObject.Name astroObjectName, ref AstroObject __result) 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) public static bool Locator_RegisterAstroObject(AstroObject astroObject)
{ {
if (astroObject.GetAstroObjectName() == AstroObject.Name.None) return false; 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 (!string.IsNullOrEmpty(astroObject._customName) && astroObject._customName.Equals("Sun Station"))
{ {
if (astroObject.gameObject.name == "SunStation_Body") if (astroObject.gameObject.name == "SunStation_Body")
@ -84,9 +89,11 @@ namespace NewHorizons.Patches
_sunStation = astroObject; _sunStation = astroObject;
return false; 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"; else if (astroObject.gameObject.name == "SS_Debris_Body") astroObject._customName = "Sun Station Debris";
return true; return true;
} }
switch (astroObject.GetAstroObjectName()) switch (astroObject.GetAstroObjectName())
{ {
case AstroObject.Name.Eye: case AstroObject.Name.Eye:

View File

@ -158,7 +158,7 @@ namespace NewHorizons.Utility
.Select(x => x.gameObject) .Select(x => x.gameObject)
.Where(x => x.name == "SS_Debris_Body")); .Where(x => x.name == "SS_Debris_Body"));
break; 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: case AstroObject.Name.CustomString:
if (primary._customName.Equals("Sun Station")) if (primary._customName.Equals("Sun Station"))
{ {