From 8eed478d4a4fdae344407cb9b7b952db2549fb67 Mon Sep 17 00:00:00 2001 From: xen-42 Date: Tue, 17 Dec 2024 20:54:28 -0500 Subject: [PATCH] Renamed it since it affects other calculations beyond zoom speed --- NewHorizons/External/Configs/PlanetConfig.cs | 6 ++++-- NewHorizons/Handlers/PlanetCreationHandler.cs | 19 +++++++++---------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/NewHorizons/External/Configs/PlanetConfig.cs b/NewHorizons/External/Configs/PlanetConfig.cs index b4723aa4..809ec1ff 100644 --- a/NewHorizons/External/Configs/PlanetConfig.cs +++ b/NewHorizons/External/Configs/PlanetConfig.cs @@ -53,9 +53,11 @@ namespace NewHorizons.External.Configs public bool destroy; /// - /// `true` if you want the map zoom speed to adjust to this planet's orbit + /// Do we track the position of this body when calculating the solar system radius? + /// `true` if you want the map zoom speed, map panning distance/speed, map camera farclip plane, + /// and autopilot-returning-to-solar-system to adjust to this planet's orbit /// - [DefaultValue(true)] public bool adjustZoomSpeed = true; + [DefaultValue(true)] public bool trackForSolarSystemRadius = true; /// /// A list of paths to child GameObjects to destroy on this planet diff --git a/NewHorizons/Handlers/PlanetCreationHandler.cs b/NewHorizons/Handlers/PlanetCreationHandler.cs index c9af4897..18618c4a 100644 --- a/NewHorizons/Handlers/PlanetCreationHandler.cs +++ b/NewHorizons/Handlers/PlanetCreationHandler.cs @@ -1,4 +1,3 @@ -using Epic.OnlineServices; using NewHorizons.Builder.Atmosphere; using NewHorizons.Builder.Body; using NewHorizons.Builder.General; @@ -413,7 +412,7 @@ namespace NewHorizons.Handlers AstroObjectLocator.RegisterCustomAstroObject(ao); // Now that we're done move the planet into place - SetPositionFromVector(go, body.Config.Orbit.staticPosition, body.Config.adjustZoomSpeed); + SetPositionFromVector(go, body.Config.Orbit.staticPosition, body.Config.trackForSolarSystemRadius); NHLogger.LogVerbose($"Finished creating Bramble Dimension [{body.Config.name}]"); @@ -500,11 +499,11 @@ namespace NewHorizons.Handlers // Now that we're done move the planet into place if (body.Config.Orbit?.staticPosition != null) { - SetPositionFromVector(go, body.Config.Orbit.staticPosition, body.Config.adjustZoomSpeed); + SetPositionFromVector(go, body.Config.Orbit.staticPosition, body.Config.trackForSolarSystemRadius); } else { - UpdatePosition(go, body.Config.Orbit, primaryBody, ao, body.Config.adjustZoomSpeed); + UpdatePosition(go, body.Config.Orbit, primaryBody, ao, body.Config.trackForSolarSystemRadius); } // Have to do this after setting position @@ -858,7 +857,7 @@ namespace NewHorizons.Handlers } // Move the primary - UpdatePosition(go, body.Config.Orbit, primary, newAO, body.Config.adjustZoomSpeed); + UpdatePosition(go, body.Config.Orbit, primary, newAO, body.Config.trackForSolarSystemRadius); for (int i = 0; i < children.Count(); i++) { @@ -916,7 +915,7 @@ namespace NewHorizons.Handlers UpdatePosition(go, orbit, primaryBody, secondaryBody, true); } - public static void UpdatePosition(GameObject go, IOrbitalParameters orbit, AstroObject primaryBody, AstroObject secondaryBody, bool adjustZoomSpeed) + public static void UpdatePosition(GameObject go, IOrbitalParameters orbit, AstroObject primaryBody, AstroObject secondaryBody, bool trackForSolarSystemRadius) { NHLogger.LogVerbose($"Placing [{secondaryBody?.name}] around [{primaryBody?.name}]"); @@ -926,15 +925,15 @@ namespace NewHorizons.Handlers var secondaryGravity = new Gravity(secondaryBody.GetGravityVolume()); var pos = orbit.GetOrbitalParameters(primaryGravity, secondaryGravity).InitialPosition + primaryBody.transform.position; - SetPositionFromVector(go, pos, adjustZoomSpeed); + SetPositionFromVector(go, pos, trackForSolarSystemRadius); } else { - SetPositionFromVector(go, Vector3.zero, adjustZoomSpeed); + SetPositionFromVector(go, Vector3.zero, trackForSolarSystemRadius); } } - public static void SetPositionFromVector(GameObject go, Vector3 position, bool adjustZoomSpeed) + public static void SetPositionFromVector(GameObject go, Vector3 position, bool trackForSolarSystemRadius) { var rb = go.GetAttachedOWRigidbody(); if (rb) @@ -966,7 +965,7 @@ namespace NewHorizons.Handlers // 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 && adjustZoomSpeed) + if (distanceToCenter > SolarSystemRadius && trackForSolarSystemRadius) { SolarSystemRadius = distanceToCenter; }