mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Allowed planets to decide if they change SolarSystemRadius
This commit is contained in:
parent
66886f9b2f
commit
21a9643b9e
5
NewHorizons/External/Configs/PlanetConfig.cs
vendored
5
NewHorizons/External/Configs/PlanetConfig.cs
vendored
@ -52,6 +52,11 @@ namespace NewHorizons.External.Configs
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool destroy;
|
public bool destroy;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// `true` if you want the map zoom speed to adjust to this planet's orbit
|
||||||
|
/// </summary>
|
||||||
|
public bool adjustZoomSpeed = 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
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -413,7 +413,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);
|
SetPositionFromVector(go, body.Config.Orbit.staticPosition, body.Config.adjustZoomSpeed);
|
||||||
|
|
||||||
NHLogger.LogVerbose($"Finished creating Bramble Dimension [{body.Config.name}]");
|
NHLogger.LogVerbose($"Finished creating Bramble Dimension [{body.Config.name}]");
|
||||||
|
|
||||||
@ -500,7 +500,7 @@ 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);
|
SetPositionFromVector(go, body.Config.Orbit.staticPosition, body.Config.adjustZoomSpeed);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -920,15 +920,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);
|
SetPositionFromVector(go, pos, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetPositionFromVector(go, Vector3.zero);
|
SetPositionFromVector(go, Vector3.zero, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SetPositionFromVector(GameObject go, Vector3 position)
|
public static void SetPositionFromVector(GameObject go, Vector3 position, bool adjustZoomSpeed)
|
||||||
{
|
{
|
||||||
var rb = go.GetAttachedOWRigidbody();
|
var rb = go.GetAttachedOWRigidbody();
|
||||||
if (rb)
|
if (rb)
|
||||||
@ -960,7 +960,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)
|
if (distanceToCenter > SolarSystemRadius && adjustZoomSpeed)
|
||||||
{
|
{
|
||||||
SolarSystemRadius = distanceToCenter;
|
SolarSystemRadius = distanceToCenter;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,6 +31,11 @@
|
|||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"description": "`true` if you want to delete this planet"
|
"description": "`true` if you want to delete this planet"
|
||||||
},
|
},
|
||||||
|
"adjustZoomSpeed": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "`true` if you want the map zoom speed to adjust to fit this planet's orbit",
|
||||||
|
"default": true
|
||||||
|
},
|
||||||
"removeChildren": {
|
"removeChildren": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"description": "A list of paths to child GameObjects to destroy on this planet",
|
"description": "A list of paths to child GameObjects to destroy on this planet",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user