Allow tracking orbit lines on anything

This commit is contained in:
Nick J. Connors 2022-02-24 21:00:03 -05:00
parent 2f36082ba5
commit 7f1e52af55
3 changed files with 23 additions and 6 deletions

View File

@ -27,13 +27,24 @@ namespace NewHorizons.Builder.Orbital
var parentGravity = astroobject.GetPrimaryBody()?.GetGravityVolume();
OrbitLine orbitLine;
if (ecc == 0)
orbitLine = orbitGO.AddComponent<OrbitLine>();
// Doesn't work for linear eccentric falloff
else if (ecc > 0 && ecc < 1 && (parentGravity != null && parentGravity._falloffType == GravityVolume.FalloffType.inverseSquared))
orbitLine = orbitGO.AddComponent<EllipticOrbitLine>();
else
if(config.Orbit.TrackingOrbitLine)
{
orbitLine = orbitGO.AddComponent<TrackingOrbitLine>();
}
else if (ecc == 0)
{
orbitLine = orbitGO.AddComponent<OrbitLine>();
}
else if (ecc > 0 && ecc < 1 && (parentGravity != null && parentGravity._falloffType == GravityVolume.FalloffType.inverseSquared))
{
// Doesn't work for linear eccentric falloff
orbitLine = orbitGO.AddComponent<EllipticOrbitLine>();
}
else
{
orbitLine = orbitGO.AddComponent<TrackingOrbitLine>();
}
var color = Color.white;
if (config.Orbit.Tint != null) color = config.Orbit.Tint.ToColor32();

View File

@ -23,5 +23,6 @@ namespace NewHorizons.External
public bool ShowOrbitLine { get; set; } = true;
public bool IsStatic { get; set; }
public MColor Tint { get; set; }
public bool TrackingOrbitLine { get; set; } = false;
}
}

View File

@ -317,6 +317,11 @@
"tint": {
"$ref": "#/$defs/color",
"description": "Colour of the orbit-line in the map view."
},
"trackingOrbitLine": {
"type": "boolean",
"default": false,
"description": "Should we just draw a line behind its orbit."
}
}
},