Change furthest orbit to solar system radius

This commit is contained in:
Nick 2023-07-18 23:36:36 -04:00
parent a5e55f4081
commit 3f11a31d2d
4 changed files with 9 additions and 8 deletions

View File

@ -31,13 +31,13 @@ namespace NewHorizons.Handlers
private static Dictionary<NHAstroObject, NewHorizonsBody> _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<NewHorizonsBody> 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;
}
}

View File

@ -522,7 +522,7 @@ namespace NewHorizons
var ssrLight = solarSystemRoot.AddComponent<Light>();
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<DynamicFluidDetector>();

View File

@ -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;

View File

@ -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;
}