Skip to content

Commit

Permalink
Correct atmospheric temps by allowing GetBodyReferencing to return a …
Browse files Browse the repository at this point in the history
…parent star. Revert old faulty commit that edited wrong line.
  • Loading branch information
R-T-B committed Jul 4, 2020
1 parent 1d29b67 commit a3e2655
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Kopernicus/Components/KopernicusStar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ public Double CalculateFluxAt(Vessel vessel)
// Get Thermal Stats
if (vessel.mainBody.atmosphere)
{
if (sun == GetBodyReferencing(vessel.mainBody))
if (sun == GetBodyReferencing(vessel.mainBody) && !vessel.mainBody.isStar)
{
FlightIntegrator FI = vessel.GetComponent<FlightIntegrator>();
vessel.mainBody.GetAtmoThermalStats(true, sun, sunVector, Vector3d.Dot(sunVector, vessel.upAxis), vessel.upAxis, vessel.altitude, out FI.atmosphereTemperatureOffset, out FI.bodyEmissiveFlux, out FI.bodyAlbedoFlux);
Expand Down Expand Up @@ -358,7 +358,7 @@ public static void SunBodyFlux(ModularFlightIntegrator MFI)
/// </summary>
public static CelestialBody GetBodyReferencing(CelestialBody body)
{
while (body?.orbit?.referenceBody != null && !body.orbit.referenceBody.isStar)
while (body?.orbit?.referenceBody != null)
{
body = body.orbit.referenceBody;
}
Expand Down

0 comments on commit a3e2655

Please sign in to comment.