From 90cff5bfc2a524a0e65e1a4830f79b8f1e96cb4a Mon Sep 17 00:00:00 2001 From: "Nick J. Connors" Date: Tue, 8 Feb 2022 10:44:47 -0500 Subject: [PATCH] Fix issue where you autopilot to the sun when in DB --- NewHorizons/Tools/Patches.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/NewHorizons/Tools/Patches.cs b/NewHorizons/Tools/Patches.cs index 23df6941..4e32af97 100644 --- a/NewHorizons/Tools/Patches.cs +++ b/NewHorizons/Tools/Patches.cs @@ -68,9 +68,12 @@ namespace NewHorizons.Tools public static bool CheckShipOutersideSolarSystem(PlayerState __instance, ref bool __result) { + if (PlayerState._inBrambleDimension) return false; + Transform sunTransform = Locator.GetSunTransform(); OWRigidbody shipBody = Locator.GetShipBody(); - __result = sunTransform != null && shipBody != null && (sunTransform.position - shipBody.transform.position).sqrMagnitude > Main.FurthestOrbit * Main.FurthestOrbit * 4f; + var maxDist2 = Mathf.Max(900000000f, Main.FurthestOrbit * Main.FurthestOrbit * 2f); + __result = sunTransform != null && shipBody != null && (sunTransform.position - shipBody.transform.position).sqrMagnitude > maxDist2; return false; }