mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Fix generating body multiple times
This commit is contained in:
parent
18dbbc57b1
commit
10c203fb8f
@ -166,6 +166,9 @@ namespace NewHorizons.Handlers
|
|||||||
var sector = go.GetComponentInChildren<Sector>();
|
var sector = go.GetComponentInChildren<Sector>();
|
||||||
var rb = go.GetAttachedOWRigidbody();
|
var rb = go.GetAttachedOWRigidbody();
|
||||||
|
|
||||||
|
// Did we already generate the rest of the body
|
||||||
|
var justUpdateOrbit = go.GetComponent<NHAstroObject>() != null && ExistingAOConfigs.ContainsKey(go.GetComponent<NHAstroObject>());
|
||||||
|
|
||||||
// Since orbits are always there just check if they set a semi major axis
|
// Since orbits are always there just check if they set a semi major axis
|
||||||
if (body.Config.Orbit != null && body.Config.Orbit.SemiMajorAxis != 0f)
|
if (body.Config.Orbit != null && body.Config.Orbit.SemiMajorAxis != 0f)
|
||||||
{
|
{
|
||||||
@ -177,6 +180,8 @@ namespace NewHorizons.Handlers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (justUpdateOrbit) return go;
|
||||||
|
|
||||||
if (body.Config.ChildrenToDestroy != null && body.Config.ChildrenToDestroy.Length > 0)
|
if (body.Config.ChildrenToDestroy != null && body.Config.ChildrenToDestroy.Length > 0)
|
||||||
{
|
{
|
||||||
foreach (var child in body.Config.ChildrenToDestroy)
|
foreach (var child in body.Config.ChildrenToDestroy)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user