Skip to content

Commit

Permalink
1.1.8.2
Browse files Browse the repository at this point in the history
  • Loading branch information
jrbudda committed Dec 31, 2020
1 parent 9bd31dc commit 68afb56
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 20 deletions.
Binary file modified Assets/Plugins/KerbalEngineer.Unity.dll
Binary file not shown.
4 changes: 4 additions & 0 deletions Documents/CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
1.1.8.2, 2020-12-31, KSP 1.11.0 #3045
- Fix burn time calcs for engines using Intake Air
- All 'time" readouts now show a maximum of 2 units. (i.e. years/days or minutes/seconds)

1.1.8.1, 2020-12-29, KSP 1.11.0 #3045
- Update to 1.11
- Remove kerbal crew mass hacks now that calculation is correct in stock.
Expand Down
2 changes: 1 addition & 1 deletion KerbalEngineer/EngineerGlobals.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static class EngineerGlobals
/// <summary>
/// Current version of the Kerbal Engineer assembly.
/// </summary>
public const string ASSEMBLY_VERSION = "1.1.8.1";
public const string ASSEMBLY_VERSION = "1.1.8.2";

private static string assemblyFile;
private static string assemblyName;
Expand Down
45 changes: 27 additions & 18 deletions KerbalEngineer/Helpers/TimeFormatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,44 +23,53 @@ public static class TimeFormatter
{
public static string ConvertToString(double seconds, string format = "F1")
{
int years = 0;
int days = 0;
int hours = 0;
int minutes = 0;

bool negative = seconds < 0;

seconds = Math.Abs(seconds);

if (seconds > 0.0)
if (!negative)
{

int years = 0;
int days = 0;
int hours = 0;
int minutes = 0;

years = (int)(seconds / KSPUtil.dateTimeFormatter.Year);
seconds -= years * KSPUtil.dateTimeFormatter.Year;

days = (int)(seconds / KSPUtil.dateTimeFormatter.Day);
seconds -= days * KSPUtil.dateTimeFormatter.Day;

hours = (int)(seconds / 3600.0);
hours =(int)(seconds / 3600.0);
seconds -= hours * 3600.0;

minutes = (int)(seconds / 60.0);
seconds -= minutes * 60.0;
}

if (years > 0)
{
return (negative ? "-" : "") + string.Format("{0}y {1}d {2}h {3}m {4}s", years, days, hours, minutes, seconds.ToString(format));
}
if (days > 0)
{
return (negative ? "-" : "") + string.Format("{0}d {1}h {2}m {3}s", days, hours, minutes, seconds.ToString(format));
if (years > 0)
{
return string.Format("{0}y {1}d", years, days);
}
if (days > 0)
{
return string.Format("{0}d {1}h", days, hours);
}
if (hours > 0)
{
return string.Format("{0}h {1}m", hours, minutes);
}
if (minutes > 0)
{
return string.Format("{0}m {1}s", minutes, seconds.ToString("F0"));
}
return string.Format("{0}s", seconds.ToString(format));
}
if (hours > 0)
else
{
return (negative ? "-" : "") + string.Format("{0}h {1}m {2}s", hours, minutes, seconds.ToString(format));
return "-" + string.Format("{0}s", seconds.ToString(format));
}

return (negative ? "-" : "") + (minutes > 0 ? string.Format("{0}m {1}s", minutes, seconds.ToString(format)) : string.Format("{0}s", seconds.ToString(format)));
}
}
}
4 changes: 4 additions & 0 deletions KerbalEngineer/VesselSimulator/EngineSim.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ public static EngineSim New(PartSim theEngine,
for (int i = 0; i < propellants.Count; ++i)
{
Propellant propellant = propellants[i];
if (propellant.name == "ElectricCharge" || propellant.name == "IntakeAir")
{
continue;
}
flowMass += propellant.ratio * ResourceContainer.GetResourceDensity(propellant.id);
}

Expand Down
Binary file modified Output/KerbalEngineer/KerbalEngineer.Unity.dll
Binary file not shown.
Binary file modified Output/KerbalEngineer/KerbalEngineer.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion Output/KerbalEngineer/KerbalEngineer.version
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{
"MAJOR":1,
"MINOR":1,
"PATCH":7,
"PATCH":8,
"BUILD":2
},
"KSP_VERSION":
Expand Down

0 comments on commit 68afb56

Please sign in to comment.