diff --git a/NewHorizons/Handlers/PlanetCreationHandler.cs b/NewHorizons/Handlers/PlanetCreationHandler.cs index 8d37033c..6a3647d6 100644 --- a/NewHorizons/Handlers/PlanetCreationHandler.cs +++ b/NewHorizons/Handlers/PlanetCreationHandler.cs @@ -31,13 +31,13 @@ namespace NewHorizons.Handlers private static Dictionary _customBodyDict; // Farthest distance from the center of the solar system - public static float FurthestOrbit { get; private set; } + public static float SolarSystemRadius { get; private set; } public static float DefaultFurthestOrbit => 30000f; public static void Init(List bodies) { // Base game value - FurthestOrbit = DefaultFurthestOrbit; + SolarSystemRadius = DefaultFurthestOrbit; _existingBodyDict = new(); _customBodyDict = new(); @@ -853,10 +853,11 @@ namespace NewHorizons.Handlers go.transform.position = position; } - var distanceToCenter = go.transform.position.magnitude; - if (distanceToCenter > FurthestOrbit) + // Uses the ratio of the interlopers furthest point to what the base game considers the edge of the solar system + var distanceToCenter = go.transform.position.magnitude * (24000 / 30000f); + if (distanceToCenter > SolarSystemRadius) { - FurthestOrbit = distanceToCenter; + SolarSystemRadius = distanceToCenter; } } diff --git a/NewHorizons/Main.cs b/NewHorizons/Main.cs index 71401f6a..e204ccdc 100644 --- a/NewHorizons/Main.cs +++ b/NewHorizons/Main.cs @@ -522,7 +522,7 @@ namespace NewHorizons var ssrLight = solarSystemRoot.AddComponent(); ssrLight.innerSpotAngle = 0; ssrLight.spotAngle = 179; - ssrLight.range = PlanetCreationHandler.FurthestOrbit * (4f / 3f); + ssrLight.range = PlanetCreationHandler.SolarSystemRadius * (4f / 3f); ssrLight.intensity = 0.001f; var fluid = playerBody.FindChild("PlayerDetector").GetComponent(); diff --git a/NewHorizons/Patches/MapPatches/MapControllerPatches.cs b/NewHorizons/Patches/MapPatches/MapControllerPatches.cs index 28540507..48b0ebac 100644 --- a/NewHorizons/Patches/MapPatches/MapControllerPatches.cs +++ b/NewHorizons/Patches/MapPatches/MapControllerPatches.cs @@ -12,7 +12,7 @@ namespace NewHorizons.Patches.MapPatches [HarmonyPatch(nameof(MapController.Start))] public static void MapController_Start(MapController __instance) { - var modifier = Mathf.Max(1f, PlanetCreationHandler.FurthestOrbit / PlanetCreationHandler.DefaultFurthestOrbit); + var modifier = Mathf.Max(1f, PlanetCreationHandler.SolarSystemRadius / PlanetCreationHandler.DefaultFurthestOrbit); __instance._maxPanDistance *= modifier; __instance._maxZoomDistance *= modifier; diff --git a/NewHorizons/Patches/PlayerPatches/PlayerStatePatches.cs b/NewHorizons/Patches/PlayerPatches/PlayerStatePatches.cs index bf1d26f4..d747033b 100644 --- a/NewHorizons/Patches/PlayerPatches/PlayerStatePatches.cs +++ b/NewHorizons/Patches/PlayerPatches/PlayerStatePatches.cs @@ -16,7 +16,7 @@ namespace NewHorizons.Patches.PlayerPatches var centerTransform = Locator.GetCenterOfTheUniverse().GetStaticReferenceFrame().transform; var shipBody = Locator.GetShipBody(); - var maxDist = Mathf.Max(PlanetCreationHandler.DefaultFurthestOrbit, PlanetCreationHandler.FurthestOrbit); + var maxDist = Mathf.Max(PlanetCreationHandler.DefaultFurthestOrbit, PlanetCreationHandler.SolarSystemRadius); __result = centerTransform != null && shipBody != null && (shipBody.transform.position - centerTransform.position).sqrMagnitude > maxDist * maxDist; return false; }