Renamed it since it affects other calculations beyond zoom speed

This commit is contained in:
xen-42 2024-12-17 20:54:28 -05:00
parent 9878234026
commit 8eed478d4a
2 changed files with 13 additions and 12 deletions

View File

@ -53,9 +53,11 @@ namespace NewHorizons.External.Configs
public bool destroy; public bool destroy;
/// <summary> /// <summary>
/// `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
/// </summary> /// </summary>
[DefaultValue(true)] public bool adjustZoomSpeed = true; [DefaultValue(true)] public bool trackForSolarSystemRadius = true;
/// <summary> /// <summary>
/// A list of paths to child GameObjects to destroy on this planet /// A list of paths to child GameObjects to destroy on this planet

View File

@ -1,4 +1,3 @@
using Epic.OnlineServices;
using NewHorizons.Builder.Atmosphere; using NewHorizons.Builder.Atmosphere;
using NewHorizons.Builder.Body; using NewHorizons.Builder.Body;
using NewHorizons.Builder.General; using NewHorizons.Builder.General;
@ -413,7 +412,7 @@ namespace NewHorizons.Handlers
AstroObjectLocator.RegisterCustomAstroObject(ao); AstroObjectLocator.RegisterCustomAstroObject(ao);
// Now that we're done move the planet into place // 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}]"); 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 // Now that we're done move the planet into place
if (body.Config.Orbit?.staticPosition != null) 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 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 // Have to do this after setting position
@ -858,7 +857,7 @@ namespace NewHorizons.Handlers
} }
// Move the primary // 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++) for (int i = 0; i < children.Count(); i++)
{ {
@ -916,7 +915,7 @@ namespace NewHorizons.Handlers
UpdatePosition(go, orbit, primaryBody, secondaryBody, true); 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}]"); NHLogger.LogVerbose($"Placing [{secondaryBody?.name}] around [{primaryBody?.name}]");
@ -926,15 +925,15 @@ namespace NewHorizons.Handlers
var secondaryGravity = new Gravity(secondaryBody.GetGravityVolume()); var secondaryGravity = new Gravity(secondaryBody.GetGravityVolume());
var pos = orbit.GetOrbitalParameters(primaryGravity, secondaryGravity).InitialPosition + primaryBody.transform.position; var pos = orbit.GetOrbitalParameters(primaryGravity, secondaryGravity).InitialPosition + primaryBody.transform.position;
SetPositionFromVector(go, pos, adjustZoomSpeed); SetPositionFromVector(go, pos, trackForSolarSystemRadius);
} }
else 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(); var rb = go.GetAttachedOWRigidbody();
if (rb) 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 // 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); var distanceToCenter = go.transform.position.magnitude / (24000 / 30000f);
if (distanceToCenter > SolarSystemRadius && adjustZoomSpeed) if (distanceToCenter > SolarSystemRadius && trackForSolarSystemRadius)
{ {
SolarSystemRadius = distanceToCenter; SolarSystemRadius = distanceToCenter;
} }