Skip to content

Commit

Permalink
fixed the fix for the fix
Browse files Browse the repository at this point in the history
  • Loading branch information
SirMortimer committed Jun 17, 2019
1 parent 66b7cee commit ab5c802
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/Kerbalism/Lib.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,19 +204,23 @@ public static UInt32 Hash32(string s)
// return hours in a day
public static double HoursInDay()
{
var homeBody = FlightGlobals.GetHomeBody();
if (homeBody == null)
return GameSettings.KERBIN_TIME ? 6.0 : 24.0;
return Math.Round(homeBody.rotationPeriod / 3600, 0);
if(FlightGlobals.ready || IsEditor())
{
var homeBody = FlightGlobals.GetHomeBody();
return Math.Round(homeBody.rotationPeriod / 3600, 0);
}
return GameSettings.KERBIN_TIME ? 6.0 : 24.0;
}

// return year length
public static double DaysInYear()
{
var homeBody = FlightGlobals.GetHomeBody();
if (homeBody == null)
return 426.0;
return Math.Floor(homeBody.orbit.period / (HoursInDay() * 60.0 * 60.0));
if (FlightGlobals.ready || IsEditor())
{
var homeBody = FlightGlobals.GetHomeBody();
return Math.Floor(homeBody.orbit.period / (HoursInDay() * 60.0 * 60.0));
}
return 426.0;
}

// stop time warping
Expand Down

0 comments on commit ab5c802

Please sign in to comment.