Prep v1.0.19.3
--- a/Documents/CHANGES.txt
+++ b/Documents/CHANGES.txt
@@ -1,3 +1,62 @@
+1.0.19.1, 09-11-15
+ Added: Key binding editor accessible under 'Settings' on the Build Engineer.
+ Added: Added current vessel name readout. (antplant)
+ Added: 'Relative Radial Velocity' and 'Time To Rendezvous' readouts. (itwtx)
+ Added: Readout help strings. (harryyoung)
+ Changed: The 'Torque' value in the editor is now precise to two decimal places.
+ Changed: Time formatting reference (Kerbin/Earth) is now based on the in-game setting.
+ Changed: Eccentric Anomaly, Mean Anomaly and Mean Anomaly At Epoc now display in degrees rather than radians.
+ Fixed: Optimised time formatting. (itwtx)
+ Fixed: TimeToAtmosphere checks that the Apoapsis is outside atmosphere. (Kerbas-ad-astra)
+ Fixed: Issue with stage priority flow. Caused Rapier calculations to fail if LF and O are drawn from different tanks. (Padishar)
+ Fixed: Issue with angle to prograde/retrograde calculations on highly inclined orbits.
+ Fixed: Editor input locks not being reset when a scene change is forced (e.g. via Kerbal Construction Time).
+ Fixed: Roll axis readout now shows the correct sign.
+ Removed: Time Formatter readout as it's not required anymore.
+
+1.0.18.0
+ Added: Orbital readouts - "Speed at Periapsis" and "Speed at Apoapsis". (Padishar)
+ Added: Manoeuvre readouts - "Post-burn Apoapsis" and "Post-burn Periapsis". (Padishar)
+ Added: Orbital readout - "Time to Atmosphere".
+ Fixed: Synched the minimum simulation time sliders and stopped them from snapping back after 999ms. (saybur)
+ Fixed: Added workaround for the bug in Vessel.horizontalSrfSpeed (Padishar)
+ Fixed: Physically insignificant part mass was not being correctly cascaded down through multiple parent parts.
+ Fixed: Intake air demand calculation not working.
+ Fixed: Some build engineer settings labels do not scale with UI size.
+
+1.0.17.0
+ Added: 'Mach Number' readout under the 'Surface' category and included it on the default surface HUD.
+ Added: Stock sections in the Flight Engineer can now become HUDs.
+ Added 'Thermal' readouts category including:
+ Internal Flux
+ Convection Flux
+ Radiation Flux
+ Critical Part Name
+ Critical Part Temperature
+ Critical Part Skin Temperature
+ Critical Part Thermal Percentage of Max Temperature
+ Hottest Part Name
+ Hottest Part Temperature
+ Hottest Part Skin Temperature
+ Coldest Part Name
+ Coldest Part Temperature
+ Coldest Part Skin Temperature
+
+ Changed: Mach on the Build Engineer now accurate to 2 decimal places.
+ Changed: Max mach in the Build Engineer defaults to 1.00 even when no jet engines are present.
+ Changed: Increased eccentricity readout to 5 decimal places.
+ Changed: Implemented Sarbian's object pooling.
+ Changed: The default selected body is now assigned via 'Planitarium.Home'.
+ Changed: HUDs to clamp fully inside the screen instead of allowing them to run off the edge by a certain amount.
+ Fixed: Physically insignificant part mass is now associated with the parent part.
+ Fixed: Longitude and Latitude readouts now use a KER formatter instead of Squad's incorrect implementation.
+ Fixed: Possible null reference in the Rendezvous Processor.
+ Fixed: Fairing mass issues introduced with regards to simulation changes.
+ Fixed: Use of per-propellant fuel flow mode override.
+ Fixed: Burn times calculated for jet engines.
+ Fixed: Thrust issues introduced with Sarbian's simulation alterations.
+ Fixed: Issue where HUDs positioned close to the top/bottom of the screen could be pushed out of position.
+
1.0.16.6, 02-05-15
Fixed: Separately staged fairing mass jettisons are now calculated in the editor.
@@ -40,7 +99,7 @@
1.0.15.1, 13-02-2015
Rebuild
-
+
1.0.15.0, 08-02-2015
Padishar's Fixes:
Added: Support KIDS ISP thrust correction.
@@ -50,7 +109,7 @@
1.0.14.1, 28-12-2014
Fixed: Missing texture on the ER-7500 model.
-
+
1.0.14.0, 28-12-2014
Added: Career mode that limits the Flight Engineer by:
- Requiring an Engineer Kerbal of any level, or placement of an Engineer Chip or ER-7500 part.
@@ -170,7 +229,7 @@
Added: New readout to the surface category:
- Vertical Acceleration
- Horizontal Acceleration
-
+
Changed: Atmospheric efficiency readout now shows as a percentage.
Changed: Atmospheric settings (pressure/velocity) in the editor condensed onto a single line.
Fixed: Bug where the overlays in the editor would stay open outside of parts screen.
@@ -327,6 +386,7 @@
Added: Stock toolbar support in the Flight Engineer.
Changed: Orbital Period has higher precision.
Fixed: Various NullRefs in editor window and overlay.
-
+
1.0.0.0, 24-07-2014
Initial release for public testing.
+
--- a/KerbalEngineer/CelestialBodies.cs
+++ b/KerbalEngineer/CelestialBodies.cs
@@ -37,7 +37,8 @@
try
{
SystemBody = new BodyInfo(PSystemManager.Instance.localBodies.Find(b => b.referenceBody == null || b.referenceBody == b));
- if (!SetSelectedBody("Kerbin"))
+ String homeCBName = Planetarium.fetch.Home.bodyName;
+ if (!SetSelectedBody(homeCBName))
{
SelectedBody = SystemBody;
SelectedBody.SetSelected(true);
--- a/KerbalEngineer/Control/ControlCentre.cs
+++ b/KerbalEngineer/Control/ControlCentre.cs
@@ -142,7 +142,7 @@
try
{
GUI.skin = null;
- this.position = GUILayout.Window(this.GetInstanceID(), this.position, this.Window, "KERBAL ENGINEER REDUX " + EngineerGlobals.AssemblyVersion + " - CONTROL CENTRE", HighLogic.Skin.window);
+ this.position = GUILayout.Window(this.GetInstanceID(), this.position, this.Window, "KERBAL ENGINEER REDUX " + EngineerGlobals.ASSEMBLY_VERSION + " - CONTROL CENTRE", HighLogic.Skin.window);
this.CentreWindow();
}
catch (Exception ex)
--- a/KerbalEngineer/Editor/BuildAdvanced.cs
+++ b/KerbalEngineer/Editor/BuildAdvanced.cs
@@ -1,7 +1,5 @@
//
-// Kerbal Engineer Redux
-//
-// Copyright (C) 2014 CYBUTEK
+// Copyright (C) 2015 CYBUTEK
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -19,23 +17,26 @@
namespace KerbalEngineer.Editor
{
- #region Using Directives
using System;
using Extensions;
using Flight;
using Helpers;
+ using KeyBinding;
using Settings;
using UIControls;
using UnityEngine;
using VesselSimulator;
- #endregion
-
[KSPAddon(KSPAddon.Startup.EditorAny, false)]
public class BuildAdvanced : MonoBehaviour
{
- #region Fields
- public static float Altitude = 0.0f;
+ public static float Altitude;
+
+ private static Rect compactModeRect = new Rect(0.0f, 5.0f, 0.0f, 20.0f);
+ private static Stage stage;
+ private static int stagesCount;
+ private static int stagesLength;
+ private static string title;
private GUIStyle areaSettingStyle;
private GUIStyle areaStyle;
@@ -64,9 +65,7 @@
private GUIStyle titleStyle;
private bool visible = true;
private GUIStyle windowStyle;
- #endregion
-
- #region Properties
+
/// <summary>
/// Gets the current instance if started or returns null.
/// </summary>
@@ -146,14 +145,6 @@
visible = value;
}
}
- #endregion
-
- #region Methods
- private static Rect compactModeRect = new Rect(0.0f, 5.0f, 0.0f, 20.0f);
- private static Stage stage;
- private static int stagesCount;
- private static int stagesLength;
- private static string title;
protected void Awake()
{
@@ -179,6 +170,8 @@
/// </summary>
protected void OnDestroy()
{
+ Logger.Log("BuildAdvanced->OnDestroy");
+
try
{
SettingHandler handler = new SettingHandler();
@@ -198,6 +191,8 @@
{
Logger.Exception(ex, "BuildAdvanced.OnDestroy()");
}
+
+ EditorLock(false);
}
protected void OnGUI()
@@ -215,7 +210,7 @@
}
// Change the window title based on whether in compact mode or not.
- title = !compactMode ? "KERBAL ENGINEER REDUX " + EngineerGlobals.AssemblyVersion : "K.E.R. " + EngineerGlobals.AssemblyVersion;
+ title = !compactMode ? "KERBAL ENGINEER REDUX " + EngineerGlobals.ASSEMBLY_VERSION : "K.E.R. " + EngineerGlobals.ASSEMBLY_VERSION;
// Reset the window size when the staging or something else has changed.
stagesLength = stages.Length;
@@ -523,12 +518,12 @@
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
- GUILayout.Label("Simulate using vectored thrust values:");
+ GUILayout.Label("Simulate using vectored thrust values:", settingStyle);
SimManager.vectoredThrust = GUILayout.Toggle(SimManager.vectoredThrust, "ENABLED", buttonStyle, GUILayout.Width(100.0f * GuiDisplaySize.Offset));
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
- GUILayout.Label("Verbose Simulation Log:");
+ GUILayout.Label("Verbose Simulation Log:", settingStyle);
SimManager.logOutput = GUILayout.Toggle(SimManager.logOutput, "ENABLED", buttonStyle, GUILayout.Width(100.0f * GuiDisplaySize.Offset));
GUILayout.EndHorizontal();
@@ -552,6 +547,14 @@
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
+ GUILayout.Label("Key Bindings:", settingStyle);
+ if (GUILayout.Button("EDIT KEY BINDINGS", buttonStyle, GUILayout.Width(200.0f * GuiDisplaySize.Offset)))
+ {
+ KeyBinder.Show();
+ }
+ GUILayout.EndHorizontal();
+
+ GUILayout.BeginHorizontal();
GUILayout.Label("GUI Size: " + GuiDisplaySize.Increment, settingStyle);
if (GUILayout.Button("<", buttonStyle, GUILayout.Width(100.0f * GuiDisplaySize.Offset)))
{
@@ -563,9 +566,10 @@
}
GUILayout.EndHorizontal();
- GUILayout.Label("Minimum delay between simulations: " + SimManager.minSimTime.Milliseconds + "ms", settingStyle);
+ GUILayout.Label("Minimum delay between simulations: " + SimManager.minSimTime.TotalMilliseconds + "ms", settingStyle);
GUI.skin = HighLogic.Skin;
- SimManager.minSimTime = new TimeSpan(0, 0, 0, 0, (int)GUILayout.HorizontalSlider(SimManager.minSimTime.Milliseconds, 0, 2000.0f));
+ SimManager.minSimTime = TimeSpan.FromMilliseconds(GUILayout.HorizontalSlider((float)SimManager.minSimTime.TotalMilliseconds, 0, 2000.0f));
+
GUI.skin = null;
}
@@ -706,7 +710,7 @@
fontSize = (int)(11 * GuiDisplaySize.Offset),
fontStyle = FontStyle.Bold,
alignment = TextAnchor.MiddleCenter,
- stretchWidth = true,
+ stretchWidth = true
};
infoStyle = new GUIStyle(HighLogic.Skin.label)
@@ -884,6 +888,5 @@
Logger.Exception(ex, "BuildAdvanced.Window()");
}
}
- #endregion
}
}
--- a/KerbalEngineer/EngineerGlobals.cs
+++ b/KerbalEngineer/EngineerGlobals.cs
@@ -1,7 +1,5 @@
//
-// Kerbal Engineer Redux
-//
-// Copyright (C) 2014 CYBUTEK
+// Copyright (C) 2015 CYBUTEK
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -17,42 +15,32 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
-#region Using Directives
-
-using System.IO;
-using System.Reflection;
-
-#endregion
-
namespace KerbalEngineer
{
- public class EngineerGlobals
+ using System.IO;
+ using System.Reflection;
+
+ public static class EngineerGlobals
{
- #region Constants
-
/// <summary>
/// Current version of the Kerbal Engineer assembly.
/// </summary>
- public const string AssemblyVersion = "1.0.16.6";
-
- #endregion
-
- #region Fields
+ public const string ASSEMBLY_VERSION = "1.0.19.3";
private static string assemblyFile;
private static string assemblyName;
private static string assemblyPath;
-
- #endregion
-
- #region Properties
+ private static string settingsPath;
/// <summary>
/// Gets the Kerbal Engineer assembly's path including the file name.
/// </summary>
public static string AssemblyFile
{
- get { return assemblyFile ?? (assemblyFile = Assembly.GetExecutingAssembly().Location); }
+ get
+ {
+ return assemblyFile ?? (assemblyFile = Assembly.GetExecutingAssembly().Location);
+ }
}
/// <summary>
@@ -60,7 +48,10 @@
/// </summary>
public static string AssemblyName
{
- get { return assemblyName ?? (assemblyName = new FileInfo(AssemblyFile).Name); }
+ get
+ {
+ return assemblyName ?? (assemblyName = new FileInfo(AssemblyFile).Name);
+ }
}
/// <summary>
@@ -68,9 +59,25 @@
/// </summary>
public static string AssemblyPath
{
- get { return assemblyPath ?? (assemblyPath = AssemblyFile.Replace(new FileInfo(AssemblyFile).Name, "")); }
+ get
+ {
+ return assemblyPath ?? (assemblyPath = AssemblyFile.Replace(new FileInfo(AssemblyFile).Name, ""));
+ }
}
- #endregion
+ /// <summary>
+ /// Gets the settings directory path.
+ /// </summary>
+ public static string SettingsPath
+ {
+ get
+ {
+ if (string.IsNullOrEmpty(settingsPath))
+ {
+ settingsPath = Path.Combine(AssemblyPath, "Settings");
+ }
+ return settingsPath;
+ }
+ }
}
}
--- a/KerbalEngineer/Extensions/DoubleExtensions.cs
+++ b/KerbalEngineer/Extensions/DoubleExtensions.cs
@@ -1,7 +1,7 @@
//
// Kerbal Engineer Redux
//
-// Copyright (C) 2014 CYBUTEK
+// Copyright (C) 2015 CYBUTEK
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -17,18 +17,12 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
-#region Using Directives
-
-using KerbalEngineer.Helpers;
-
-#endregion
-
namespace KerbalEngineer.Extensions
{
+ using Helpers;
+
public static class DoubleExtensions
{
- #region Methods: public
-
public static double Clamp(this double value, double lower, double higher)
{
return value < lower ? lower : value > higher ? higher : value;
@@ -49,14 +43,19 @@
return Units.ToDistance(value);
}
- public static string ToTorque(this double value)
+ public static string ToFlux(this double value)
{
- return Units.ToTorque(value);
+ return Units.ToFlux(value);
}
public static string ToForce(this double value)
{
return Units.ToForce(value);
+ }
+
+ public static string ToMach(this double value)
+ {
+ return Units.ToMach(value);
}
public static string ToMass(this double value)
@@ -79,6 +78,14 @@
return Units.ToSpeed(value);
}
- #endregion
+ public static string ToTemperature(this double value)
+ {
+ return Units.ToTemperature(value);
+ }
+
+ public static string ToTorque(this double value)
+ {
+ return Units.ToTorque(value);
+ }
}
}
--- a/KerbalEngineer/Extensions/FloatExtensions.cs
+++ b/KerbalEngineer/Extensions/FloatExtensions.cs
@@ -1,7 +1,7 @@
//
// Kerbal Engineer Redux
//
-// Copyright (C) 2014 CYBUTEK
+// Copyright (C) 2015 CYBUTEK
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -17,18 +17,12 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
-#region Using Directives
-
-using KerbalEngineer.Helpers;
-
-#endregion
-
namespace KerbalEngineer.Extensions
{
+ using Helpers;
+
public static class FloatExtensions
{
- #region Methods: public
-
public static string ToAcceleration(this float value)
{
return Units.ToAcceleration(value);
@@ -44,14 +38,19 @@
return Units.ToDistance(value);
}
+ public static string ToFlux(this float value)
+ {
+ return Units.ToFlux(value);
+ }
+
public static string ToForce(this float value)
{
return Units.ToForce(value);
}
- public static string ToTorque(this float value)
+ public static string ToMach(this float value)
{
- return Units.ToTorque(value);
+ return Units.ToMach(value);
}
public static string ToMass(this float value)
@@ -74,6 +73,14 @@
return Units.ToSpeed(value);
}
- #endregion
+ public static string ToTemperature(this float value)
+ {
+ return Units.ToTemperature(value);
+ }
+
+ public static string ToTorque(this float value)
+ {
+ return Units.ToTorque(value);
+ }
}
}
--- a/KerbalEngineer/Extensions/OrbitExtensions.cs
+++ b/KerbalEngineer/Extensions/OrbitExtensions.cs
@@ -61,12 +61,15 @@
return 0.0;
}
- var angle = AngleHelper.GetAngleBetweenVectors(orbit.getRelativePositionAtUT(universalTime),
- Vector3d.Exclude(orbit.GetOrbitNormal(), orbit.referenceBody.orbit.getRelativePositionAtUT(universalTime)));
+ Vector3d orbitVector = orbit.getRelativePositionAtUT(universalTime);
+ orbitVector.z = 0.0;
- angle = AngleHelper.Clamp360(angle - 90.0);
+ Vector3d bodyVector = orbit.referenceBody.orbit.getOrbitalVelocityAtUT(universalTime);
+ bodyVector.z = 0.0;
- return orbit.inclination > 90.0 ? angle : 360.0 - angle;
+ double angle = AngleHelper.GetAngleBetweenVectors(bodyVector, orbitVector);
+
+ return AngleHelper.Clamp360(orbit.inclination < 90.0 ? angle : 360.0 - angle);
}
public static double GetAngleToRetrograde(this Orbit orbit)
@@ -81,12 +84,15 @@
return 0.0;
}
- var angle = AngleHelper.GetAngleBetweenVectors(orbit.getRelativePositionAtUT(universalTime),
- Vector3d.Exclude(orbit.GetOrbitNormal(), orbit.referenceBody.orbit.getRelativePositionAtUT(universalTime)));
+ Vector3d orbitVector = orbit.getRelativePositionAtUT(universalTime);
+ orbitVector.z = 0.0;
- angle = AngleHelper.Clamp360(angle + 90.0);
+ Vector3d bodyVector = orbit.referenceBody.orbit.getOrbitalVelocityAtUT(universalTime);
+ bodyVector.z = 0.0;
- return orbit.inclination > 90.0 ? angle : 360.0 - angle;
+ double angle = AngleHelper.GetAngleBetweenVectors(-bodyVector, orbitVector);
+
+ return AngleHelper.Clamp360(orbit.inclination < 90.0 ? angle : 360.0 - angle);
}
public static double GetAngleToTrueAnomaly(this Orbit orbit, double trueAnomaly)
--- a/KerbalEngineer/Extensions/PartExtensions.cs
+++ b/KerbalEngineer/Extensions/PartExtensions.cs
@@ -197,10 +197,10 @@
return GetModule<ModuleEngines>(part);
}
- public static ModuleEnginesFX GetModuleEnginesFx(this Part part)
+/* public static ModuleEnginesFX GetModuleEnginesFx(this Part part)
{
return GetModule<ModuleEnginesFX>(part);
- }
+ }*/
/// <summary>
/// Gets a ModuleGenerator typed PartModule.
@@ -221,19 +221,19 @@
/// <summary>
/// Gets the current selected ModuleEnginesFX.
/// </summary>
- public static ModuleEnginesFX GetModuleMultiModeEngine(this Part part)
- {
- ModuleEnginesFX moduleEngineFx;
+ public static ModuleEngines GetModuleMultiModeEngine(this Part part)
+ {
+ ModuleEngines moduleEngines;
MultiModeEngine multiMod = GetModule<MultiModeEngine>(part);
if (multiMod != null)
{
string mode = multiMod.mode;
for (int i = 0; i < part.Modules.Count; ++i)
{
- moduleEngineFx = part.Modules[i] as ModuleEnginesFX;
- if (moduleEngineFx != null && moduleEngineFx.engineID == mode)
+ moduleEngines = part.Modules[i] as ModuleEngines;
+ if (moduleEngines != null && moduleEngines.engineID == mode)
{
- return moduleEngineFx;
+ return moduleEngines;
}
}
}
@@ -466,7 +466,7 @@
/// </summary>
public static bool IsEngine(this Part part)
{
- return HasModule<ModuleEngines>(part) || HasModule<ModuleEnginesFX>(part);
+ return HasModule<ModuleEngines>(part);
}
/// <summary>
@@ -549,7 +549,7 @@
/// </summary>
public static bool IsSolidRocket(this Part part)
{
- return (part.HasModule<ModuleEngines>() && part.GetModuleEngines().throttleLocked) || (part.HasModule<ModuleEnginesFX>() && part.GetModuleEnginesFx().throttleLocked);
+ return (part.HasModule<ModuleEngines>() && part.GetModuleEngines().throttleLocked);
}
public class ProtoModuleDecoupler
--- /dev/null
+++ b/KerbalEngineer/Extensions/StringExtensions.cs
@@ -1,1 +1,33 @@
+//
+// Kerbal Engineer Redux
+//
+// Copyright (C) 2015 CYBUTEK
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+namespace KerbalEngineer.Extensions
+{
+ public static class StringExtensions
+ {
+ public static string ToLength(this string value, int length)
+ {
+ if (value != null && value.Length > length)
+ {
+ value = value.Substring(0, length) + "...";
+ }
+ return value;
+ }
+ }
+}
--- a/KerbalEngineer/Flight/DisplayStack.cs
+++ b/KerbalEngineer/Flight/DisplayStack.cs
@@ -33,6 +33,7 @@
namespace KerbalEngineer.Flight
{
+ using KeyBinding;
using Upgradeables;
/// <summary>
@@ -214,7 +215,7 @@
/// </summary>
private void DrawControlBar()
{
- GUILayout.Label("FLIGHT ENGINEER " + EngineerGlobals.AssemblyVersion, this.titleStyle);
+ GUILayout.Label("FLIGHT ENGINEER " + EngineerGlobals.ASSEMBLY_VERSION, this.titleStyle);
this.DrawControlBarButtons(SectionLibrary.StockSections);
this.DrawControlBarButtons(SectionLibrary.CustomSections);
--- a/KerbalEngineer/Flight/Readouts/Miscellaneous/Separator.cs
+++ b/KerbalEngineer/Flight/Readouts/Miscellaneous/Separator.cs
@@ -45,7 +45,7 @@
{
this.Name = "Separator";
this.Category = ReadoutCategory.GetCategory("Miscellaneous");
- this.HelpString = String.Empty;
+ this.HelpString = "Creats a line to help seperate subsections in a module.";
this.IsDefault = false;
this.Cloneable = true;
--- a/KerbalEngineer/Flight/Readouts/Miscellaneous/SimulationDelay.cs
+++ b/KerbalEngineer/Flight/Readouts/Miscellaneous/SimulationDelay.cs
@@ -51,7 +51,7 @@
GUILayout.BeginHorizontal();
GUILayout.Label("Sim Delay", this.NameStyle);
GUI.skin = HighLogic.Skin;
- SimManager.minSimTime = new TimeSpan(0, 0, 0, 0, (int)GUILayout.HorizontalSlider(SimManager.minSimTime.Milliseconds, 0, 1000.0f));
+ SimManager.minSimTime = TimeSpan.FromMilliseconds(GUILayout.HorizontalSlider((float)SimManager.minSimTime.TotalMilliseconds, 0, 2000.0f));
GUI.skin = null;
GUILayout.EndHorizontal();
}
--- a/KerbalEngineer/Flight/Readouts/Miscellaneous/SystemTime.cs
+++ b/KerbalEngineer/Flight/Readouts/Miscellaneous/SystemTime.cs
@@ -40,7 +40,7 @@
{
this.Name = "System Time";
this.Category = ReadoutCategory.GetCategory("Miscellaneous");
- this.HelpString = String.Empty;
+ this.HelpString = "Shows the System Time in 12 hour format (AM/PM)";
this.IsDefault = false;
}
--- a/KerbalEngineer/Flight/Readouts/Miscellaneous/TimeReference.cs
+++ /dev/null
@@ -1,66 +1,1 @@
-//
-// Kerbal Engineer Redux
-//
-// Copyright (C) 2014 CYBUTEK
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-//
-#region Using Directives
-
-using System;
-
-using KerbalEngineer.Flight.Sections;
-using KerbalEngineer.Helpers;
-
-using UnityEngine;
-
-#endregion
-
-namespace KerbalEngineer.Flight.Readouts.Miscellaneous
-{
- public class TimeReference : ReadoutModule
- {
- #region Constructors
-
- public TimeReference()
- {
- this.Name = "Time Reference Adjuster";
- this.Category = ReadoutCategory.GetCategory("Miscellaneous");
- this.HelpString = String.Empty;
- this.IsDefault = false;
- }
-
- #endregion
-
- #region Methods: public
-
- public override void Draw(SectionModule section)
- {
- GUILayout.BeginHorizontal();
- GUILayout.Label("Time Ref.: " + TimeFormatter.Reference, this.NameStyle);
- if (GUILayout.Button("Earth", this.ButtonStyle))
- {
- TimeFormatter.SetReference();
- }
- if (GUILayout.Button("Kerbin", this.ButtonStyle))
- {
- TimeFormatter.SetReference(PSystemManager.Instance.localBodies.Find(body => body.bodyName.Equals("Kerbin")));
- }
- GUILayout.EndHorizontal();
- }
-
- #endregion
- }
-}
--- a/KerbalEngineer/Flight/Readouts/Orbital/AngleToEquatorialAscendingNode.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/AngleToEquatorialAscendingNode.cs
@@ -34,7 +34,7 @@
{
this.Name = "Angle to Equ. AN";
this.Category = ReadoutCategory.GetCategory("Orbital");
- this.HelpString = string.Empty;
+ this.HelpString = "Angular Distance from the vessel to crossing the Equator of the central body, going north of it.";
this.IsDefault = false;
}
--- a/KerbalEngineer/Flight/Readouts/Orbital/AngleToEquatorialDescendingNode.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/AngleToEquatorialDescendingNode.cs
@@ -34,7 +34,7 @@
{
this.Name = "Angle to Equ. DN";
this.Category = ReadoutCategory.GetCategory("Orbital");
- this.HelpString = string.Empty;
+ this.HelpString = "Angular Distance from the vessel to crossing the Equator of the central body, going south of it.";
this.IsDefault = false;
}
--- a/KerbalEngineer/Flight/Readouts/Orbital/AngleToPrograde.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/AngleToPrograde.cs
@@ -36,7 +36,7 @@
{
this.Name = "Angle to Prograde";
this.Category = ReadoutCategory.GetCategory("Orbital");
- this.HelpString = String.Empty;
+ this.HelpString = "Angular Distance from the vessel to crossing the Orbit of the central body on it's retrograde side.";
this.IsDefault = true;
}
--- a/KerbalEngineer/Flight/Readouts/Orbital/AngleToRetrograde.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/AngleToRetrograde.cs
@@ -36,7 +36,7 @@
{
this.Name = "Angle to Retrograde";
this.Category = ReadoutCategory.GetCategory("Orbital");
- this.HelpString = String.Empty;
+ this.HelpString = "Angular Distance from the vessel to crossing the Orbit of the central body on it's retrograde side.";
this.IsDefault = true;
}
--- a/KerbalEngineer/Flight/Readouts/Orbital/ApoapsisHeight.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/ApoapsisHeight.cs
@@ -34,7 +34,7 @@
{
this.Name = "Apoapsis Height";
this.Category = ReadoutCategory.GetCategory("Orbital");
- this.HelpString = "Shows the vessel's apoapsis height relative to sea level. (Apoapsis is the highest point of an orbit.)";
+ this.HelpString = "Shows the vessel's apoapsis height relative to sea level. (Apoapsis is the highest point of an orbit.)";
this.IsDefault = true;
}
--- a/KerbalEngineer/Flight/Readouts/Orbital/EccentricAnomaly.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/EccentricAnomaly.cs
@@ -1,7 +1,7 @@
//
// Kerbal Engineer Redux
//
-// Copyright (C) 2014 CYBUTEK
+// Copyright (C) 2015 CYBUTEK
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -17,38 +17,25 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
-#region Using Directives
-
-using System;
-
-using KerbalEngineer.Extensions;
-using KerbalEngineer.Flight.Sections;
-
-#endregion
-
namespace KerbalEngineer.Flight.Readouts.Orbital
{
+ using Extensions;
+ using Helpers;
+ using Sections;
+
public class EccentricAnomaly : ReadoutModule
{
- #region Constructors
-
public EccentricAnomaly()
{
- this.Name = "Eccentric Anomaly";
- this.Category = ReadoutCategory.GetCategory("Orbital");
- this.HelpString = String.Empty;
- this.IsDefault = false;
+ Name = "Eccentric Anomaly";
+ Category = ReadoutCategory.GetCategory("Orbital");
+ HelpString = string.Empty;
+ IsDefault = false;
}
-
- #endregion
-
- #region Methods: public
public override void Draw(SectionModule section)
{
- this.DrawLine(FlightGlobals.ship_orbit.eccentricAnomaly.ToAngle(), section.IsHud);
+ DrawLine((FlightGlobals.ship_orbit.eccentricAnomaly * Units.RAD_TO_DEG).ToAngle(), section.IsHud);
}
-
- #endregion
}
}
--- a/KerbalEngineer/Flight/Readouts/Orbital/Inclination.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/Inclination.cs
@@ -34,7 +34,7 @@
{
this.Name = "Inclination";
this.Category = ReadoutCategory.GetCategory("Orbital");
- this.HelpString = "Shows the vessel's orbital inclination.";
+ this.HelpString = "Shows the vessel's orbital inclination relative to the Equator.";
this.IsDefault = true;
}
--- a/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/ManoeuvreProcessor.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/ManoeuvreProcessor.cs
@@ -30,6 +30,8 @@
namespace KerbalEngineer.Flight.Readouts.Orbital.ManoeuvreNode
{
+ using Helpers;
+
public class ManoeuvreProcessor : IUpdatable, IUpdateRequest
{
#region Fields
@@ -60,6 +62,10 @@
}
public static double NormalDeltaV { get; private set; }
+
+ public static double PostBurnAp { get; private set; }
+
+ public static double PostBurnPe { get; private set; }
public static double ProgradeDeltaV { get; private set; }
@@ -108,6 +114,8 @@
NormalDeltaV = deltaV.y;
RadialDeltaV = deltaV.x;
TotalDeltaV = node.GetBurnVector(FlightGlobals.ship_orbit).magnitude;
+ PostBurnAp = node.nextPatch != null ? node.nextPatch.ApA : 0;
+ PostBurnPe = node.nextPatch != null ? node.nextPatch.PeA : 0;
UniversalTime = FlightGlobals.ActiveVessel.patchedConicSolver.maneuverNodes[0].UT;
AngleToPrograde = FlightGlobals.ActiveVessel.patchedConicSolver.maneuverNodes[0].patch.GetAngleToPrograde(UniversalTime);
@@ -163,7 +171,7 @@
deltaVDrain = deltaV.Clamp(0.0, stageDeltaV);
}
- var exhaustVelocity = stage.isp * 9.82;
+ var exhaustVelocity = stage.isp * Units.GRAVITY;
var flowRate = stage.thrust / exhaustVelocity;
var endMass = Math.Exp(Math.Log(startMass) - deltaVDrain / exhaustVelocity);
var deltaMass = (startMass - endMass) * Math.Exp(-(deltaVDrain * 0.001) / exhaustVelocity);
--- a/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeAngleToPrograde.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeAngleToPrograde.cs
@@ -36,7 +36,7 @@
{
this.Name = "Manoeuvre Node Angle to Prograde";
this.Category = ReadoutCategory.GetCategory("Orbital");
- this.HelpString = String.Empty;
+ this.HelpString = "Angular Distance from the Node to crossing the Orbit of the central body on it's prograde side.";
this.IsDefault = true;
}
--- a/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeAngleToRetrograde.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeAngleToRetrograde.cs
@@ -36,7 +36,7 @@
{
this.Name = "Manoeuvre Node Angle to Retrograde";
this.Category = ReadoutCategory.GetCategory("Orbital");
- this.HelpString = String.Empty;
+ this.HelpString = "Angular Distance from the Node to crossing the Orbit of the central body on it's retrograde side.";
this.IsDefault = true;
}
--- a/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeBurnTime.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeBurnTime.cs
@@ -36,7 +36,7 @@
{
this.Name = "Manoeuvre Node Burn Time";
this.Category = ReadoutCategory.GetCategory("Orbital");
- this.HelpString = String.Empty;
+ this.HelpString = "The burn's total duration.";
this.IsDefault = true;
}
--- a/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeHalfBurnTime.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeHalfBurnTime.cs
@@ -36,7 +36,7 @@
{
this.Name = "Manoeuvre Node Half Burn Time";
this.Category = ReadoutCategory.GetCategory("Orbital");
- this.HelpString = String.Empty;
+ this.HelpString = "Half of the burn's total duration.";
this.IsDefault = true;
}
--- a/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeNormalDeltaV.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeNormalDeltaV.cs
@@ -36,7 +36,7 @@
{
this.Name = "Manoeuvre Node DeltaV (Normal)";
this.Category = ReadoutCategory.GetCategory("Orbital");
- this.HelpString = String.Empty;
+ this.HelpString = "Normal component of the total change in velocity.";
this.IsDefault = true;
}
--- a/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeProgradeDeltaV.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeProgradeDeltaV.cs
@@ -36,7 +36,7 @@
{
this.Name = "Manoeuvre Node DeltaV (Prograde)";
this.Category = ReadoutCategory.GetCategory("Orbital");
- this.HelpString = String.Empty;
+ this.HelpString = "Prograde/Retrograde component of the total change in velocity.";
this.IsDefault = true;
}
--- a/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeRadialDeltaV.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeRadialDeltaV.cs
@@ -36,7 +36,7 @@
{
this.Name = "Manoeuvre Node DeltaV (Radial)";
this.Category = ReadoutCategory.GetCategory("Orbital");
- this.HelpString = String.Empty;
+ this.HelpString = "Radial component of the total change in velocity.";
this.IsDefault = true;
}
--- a/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeTimeToHalfBurn.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeTimeToHalfBurn.cs
@@ -36,7 +36,7 @@
{
this.Name = "Time to Manoeuvre Burn";
this.Category = ReadoutCategory.GetCategory("Orbital");
- this.HelpString = String.Empty;
+ this.HelpString = "Time until the Manoeuvre should be started.";
this.IsDefault = true;
}
--- a/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeTimeToManoeuvre.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeTimeToManoeuvre.cs
@@ -36,7 +36,7 @@
{
this.Name = "Time to Manoeuvre Node";
this.Category = ReadoutCategory.GetCategory("Orbital");
- this.HelpString = String.Empty;
+ this.HelpString = "Time until the vessel reaches the position of the Manoeuvre Node.";
this.IsDefault = true;
}
--- a/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeTotalDeltaV.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeTotalDeltaV.cs
@@ -36,7 +36,7 @@
{
this.Name = "Manoeuvre Node DeltaV (Total)";
this.Category = ReadoutCategory.GetCategory("Orbital");
- this.HelpString = String.Empty;
+ this.HelpString = "Total change in velocity during the burn.";
this.IsDefault = true;
}
--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/PostBurnApoapsis.cs
@@ -1,1 +1,69 @@
+//
+// Kerbal Engineer Redux
+//
+// Copyright (C) 2014 CYBUTEK
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+#region Using Directives
+
+using System;
+
+using KerbalEngineer.Extensions;
+using KerbalEngineer.Flight.Sections;
+
+#endregion
+
+namespace KerbalEngineer.Flight.Readouts.Orbital.ManoeuvreNode
+{
+ public class PostBurnApoapsis : ReadoutModule
+ {
+ #region Constructors
+
+ public PostBurnApoapsis()
+ {
+ this.Name = "Post-burn Apoapsis";
+ this.Category = ReadoutCategory.GetCategory("Orbital");
+ this.HelpString = "Farthest point of the vessel's ofbit after the burn.";
+ this.IsDefault = false;
+ }
+
+ #endregion
+
+ #region Methods: public
+
+ public override void Draw(SectionModule section)
+ {
+ if (!ManoeuvreProcessor.ShowDetails)
+ {
+ return;
+ }
+
+ this.DrawLine("Post-burn Apoapsis", ManoeuvreProcessor.PostBurnAp.ToDistance(), section.IsHud);
+ }
+
+ public override void Reset()
+ {
+ ManoeuvreProcessor.Reset();
+ }
+
+ public override void Update()
+ {
+ ManoeuvreProcessor.RequestUpdate();
+ }
+
+ #endregion
+ }
+}
--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/PostBurnPeriapsis.cs
@@ -1,1 +1,69 @@
+//
+// Kerbal Engineer Redux
+//
+// Copyright (C) 2014 CYBUTEK
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+#region Using Directives
+
+using System;
+
+using KerbalEngineer.Extensions;
+using KerbalEngineer.Flight.Sections;
+
+#endregion
+
+namespace KerbalEngineer.Flight.Readouts.Orbital.ManoeuvreNode
+{
+ public class PostBurnPeriapsis : ReadoutModule
+ {
+ #region Constructors
+
+ public PostBurnPeriapsis()
+ {
+ this.Name = "Post-burn Periapsis";
+ this.Category = ReadoutCategory.GetCategory("Orbital");
+ this.HelpString = "Closest point of the vessel's ofbit after the burn.";
+ this.IsDefault = false;
+ }
+
+ #endregion
+
+ #region Methods: public
+
+ public override void Draw(SectionModule section)
+ {
+ if (!ManoeuvreProcessor.ShowDetails)
+ {
+ return;
+ }
+
+ this.DrawLine("Post-burn Periapsis", ManoeuvreProcessor.PostBurnPe.ToDistance(), section.IsHud);
+ }
+
+ public override void Reset()
+ {
+ ManoeuvreProcessor.Reset();
+ }
+
+ public override void Update()
+ {
+ ManoeuvreProcessor.RequestUpdate();
+ }
+
+ #endregion
+ }
+}
--- a/KerbalEngineer/Flight/Readouts/Orbital/MeanAnomaly.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/MeanAnomaly.cs
@@ -1,7 +1,7 @@
//
// Kerbal Engineer Redux
//
-// Copyright (C) 2014 CYBUTEK
+// Copyright (C) 2015 CYBUTEK
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -17,38 +17,25 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
-#region Using Directives
-
-using System;
-
-using KerbalEngineer.Extensions;
-using KerbalEngineer.Flight.Sections;
-
-#endregion
-
namespace KerbalEngineer.Flight.Readouts.Orbital
{
+ using Extensions;
+ using Helpers;
+ using Sections;
+
public class MeanAnomaly : ReadoutModule
{
- #region Constructors
-
public MeanAnomaly()
{
- this.Name = "Mean Anomaly";
- this.Category = ReadoutCategory.GetCategory("Orbital");
- this.HelpString = String.Empty;
- this.IsDefault = false;
+ Name = "Mean Anomaly";
+ Category = ReadoutCategory.GetCategory("Orbital");
+ HelpString = string.Empty;
+ IsDefault = false;
}
-
- #endregion
-
- #region Methods: public
public override void Draw(SectionModule section)
{
- this.DrawLine(FlightGlobals.ship_orbit.meanAnomaly.ToAngle(), section.IsHud);
+ DrawLine((FlightGlobals.ship_orbit.meanAnomaly * Units.RAD_TO_DEG).ToAngle(), section.IsHud);
}
-
- #endregion
}
}
--- a/KerbalEngineer/Flight/Readouts/Orbital/MeanAnomalyAtEpoc.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/MeanAnomalyAtEpoc.cs
@@ -1,7 +1,7 @@
//
// Kerbal Engineer Redux
//
-// Copyright (C) 2014 CYBUTEK
+// Copyright (C) 2015 CYBUTEK
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -17,38 +17,25 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
-#region Using Directives
-
-using System;
-
-using KerbalEngineer.Extensions;
-using KerbalEngineer.Flight.Sections;
-
-#endregion
-
namespace KerbalEngineer.Flight.Readouts.Orbital
{
+ using Extensions;
+ using Helpers;
+ using Sections;
+
public class MeanAnomalyAtEpoc : ReadoutModule
{
- #region Constructors
-
public MeanAnomalyAtEpoc()
{
- this.Name = "Mean Anomaly at Epoc";
- this.Category = ReadoutCategory.GetCategory("Orbital");
- this.HelpString = String.Empty;
- this.IsDefault = false;
+ Name = "Mean Anomaly at Epoc";
+ Category = ReadoutCategory.GetCategory("Orbital");
+ HelpString = string.Empty;
+ IsDefault = false;
}
-
- #endregion
-
- #region Methods: public
public override void Draw(SectionModule section)
{
- this.DrawLine(FlightGlobals.ship_orbit.meanAnomalyAtEpoch.ToAngle(), section.IsHud);
+ DrawLine((FlightGlobals.ship_orbit.meanAnomalyAtEpoch * Units.RAD_TO_DEG).ToAngle(), section.IsHud);
}
-
- #endregion
}
}
--- a/KerbalEngineer/Flight/Readouts/Orbital/PeriapsisHeight.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/PeriapsisHeight.cs
@@ -34,7 +34,7 @@
{
this.Name = "Periapsis Height";
this.Category = ReadoutCategory.GetCategory("Orbital");
- this.HelpString = "Shows the vessel's periapsis height relative to sea level. (Periapsis is the lowest point of an orbit.";
+ this.HelpString = "Shows the vessel's periapsis height relative to sea level. (Periapsis is the lowest point of an orbit.)";
this.IsDefault = true;
}
--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Orbital/SpeedAtApoapsis.cs
@@ -1,1 +1,68 @@
+//
+// Kerbal Engineer Redux
+//
+// Copyright (C) 2014 CYBUTEK
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+#region Using Directives
+
+using System;
+using KerbalEngineer.Flight.Sections;
+using KerbalEngineer.Helpers;
+using KerbalEngineer.Extensions;
+
+#endregion
+
+namespace KerbalEngineer.Flight.Readouts.Orbital
+{
+ public class SpeedAtApoapsis : ReadoutModule
+ {
+ #region Constructors
+
+ public SpeedAtApoapsis()
+ {
+ this.Name = "Speed at Apoapsis";
+ this.Category = ReadoutCategory.GetCategory("Orbital");
+ this.HelpString = "Shows the orbital speed of the vessel when at apoapsis, the highest point of the orbit.";
+ this.IsDefault = false;
+ }
+
+ #endregion
+
+ #region Methods: public
+
+ public override void Draw(SectionModule section)
+ {
+ // Vis-viva: v^2 = GM(2/r - 1/a)
+ // All this is easily got from the ships orbit (and reference body)
+ String str;
+ Orbit orbit = FlightGlobals.ship_orbit;
+ if (orbit.eccentricity > 1.0)
+ str = "---m/s";
+ else
+ {
+ double speedsqr = orbit.referenceBody.gravParameter * ((2 / orbit.ApR) - (1 / orbit.semiMajorAxis));
+ if (Double.IsNaN(speedsqr) || speedsqr < 0)
+ str = "---m/s"; // Don't think this is possible barring bugs in the Orbit class
+ else
+ str = Math.Sqrt(speedsqr).ToSpeed();
+ }
+ this.DrawLine(str, section.IsHud);
+ }
+
+ #endregion
+ }
+}
--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Orbital/SpeedAtPeriapsis.cs
@@ -1,1 +1,64 @@
+//
+// Kerbal Engineer Redux
+//
+// Copyright (C) 2014 CYBUTEK
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+#region Using Directives
+
+using System;
+using KerbalEngineer.Flight.Sections;
+using KerbalEngineer.Helpers;
+using KerbalEngineer.Extensions;
+
+#endregion
+
+namespace KerbalEngineer.Flight.Readouts.Orbital
+{
+ public class SpeedAtPeriapsis : ReadoutModule
+ {
+ #region Constructors
+
+ public SpeedAtPeriapsis()
+ {
+ this.Name = "Speed at Periapsis";
+ this.Category = ReadoutCategory.GetCategory("Orbital");
+ this.HelpString = "Shows the orbital speed of the vessel when at periapsis, the lowest point of the orbit.";
+ this.IsDefault = false;
+ }
+
+ #endregion
+
+ #region Methods: public
+
+ public override void Draw(SectionModule section)
+ {
+ // Vis-viva: v^2 = GM(2/r - 1/a)
+ // All this is easily got from the ships orbit (and reference body)
+ String str;
+ Orbit orbit = FlightGlobals.ship_orbit;
+ double oneovera = (orbit.eccentricity == 1) ? 0 : (1 / orbit.semiMajorAxis);
+ double speedsqr = orbit.referenceBody.gravParameter * ((2 / orbit.PeR) - oneovera);
+ if (Double.IsNaN(speedsqr) || speedsqr < 0)
+ str = "---m/s";
+ else
+ str = Math.Sqrt(speedsqr).ToSpeed();
+ this.DrawLine(str, section.IsHud);
+ }
+
+ #endregion
+ }
+}
--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Orbital/TimeToAtmosphere.cs
@@ -1,1 +1,99 @@
+//
+// Kerbal Engineer Redux
+//
+// Copyright (C) 2014 CYBUTEK
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+#region Using Directives
+
+using System;
+using KerbalEngineer.Flight.Sections;
+using KerbalEngineer.Helpers;
+
+#endregion
+
+namespace KerbalEngineer.Flight.Readouts.Orbital
+{
+ public class TimeToAtmosphere : ReadoutModule
+ {
+ //private LogMsg log = new LogMsg();
+
+ #region Constructors
+
+ public TimeToAtmosphere()
+ {
+ this.Name = "Time to Atmosphere";
+ this.Category = ReadoutCategory.GetCategory("Orbital");
+ this.HelpString = "Shows the time until the vessel enters or leaves the atmosphere.";
+ this.IsDefault = false;
+ }
+
+ #endregion
+
+ #region Methods: public
+
+ public override void Draw(SectionModule section)
+ {
+ String str;
+ Orbit orbit = FlightGlobals.ship_orbit;
+
+ if (orbit.referenceBody.atmosphere && orbit.PeA < orbit.referenceBody.atmosphereDepth && orbit.ApA > orbit.referenceBody.atmosphereDepth)
+ {
+ double tA = orbit.TrueAnomalyAtRadius(orbit.referenceBody.atmosphereDepth + orbit.referenceBody.Radius);
+ //log.buf.AppendFormat("tA = {0}\n", tA);
+ double utTime = Planetarium.GetUniversalTime();
+ //log.buf.AppendFormat("utTime = {0}\n", utTime);
+ double timeAtRad1 = orbit.GetUTforTrueAnomaly(tA, orbit.period * 0.5);
+ //log.buf.AppendFormat("timeAtRad1 = {0}\n", timeAtRad1);
+ if (timeAtRad1 < utTime)
+ {
+ timeAtRad1 += orbit.period;
+ //log.buf.AppendFormat("timeAtRad1 = {0}\n", timeAtRad1);
+ }
+ double timeAtRad2 = orbit.GetUTforTrueAnomaly(-tA, orbit.period * 0.5);
+ //log.buf.AppendFormat("timeAtRad2 = {0}\n", timeAtRad2);
+ if (timeAtRad2 < utTime)
+ {
+ timeAtRad2 += orbit.period;
+ //log.buf.AppendFormat("timeAtRad2 = {0}\n", timeAtRad2);
+ }
+ double time = Math.Min(timeAtRad1, timeAtRad2) - utTime;
+ //log.buf.AppendFormat("time = {0}\n", time);
+
+ if (Double.IsNaN(time))
+ {
+ str = "---s";
+ //log.buf.AppendLine("time is NaN");
+ }
+ else
+ {
+ str = TimeFormatter.ConvertToString(time);
+ //log.buf.AppendFormat("str = {0}\n", str);
+ }
+ }
+ else
+ {
+ str = "---s";
+ //log.buf.AppendLine("no atmosphere, pe > atmosphere, or ap < atmosphere");
+ }
+
+ //log.Flush();
+ this.DrawLine(str, section.IsHud);
+ }
+
+ #endregion
+ }
+}
--- a/KerbalEngineer/Flight/Readouts/Orbital/TimeToEquatorialAscendingNode.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/TimeToEquatorialAscendingNode.cs
@@ -35,7 +35,7 @@
{
this.Name = "Time to Equ. AN";
this.Category = ReadoutCategory.GetCategory("Orbital");
- this.HelpString = string.Empty;
+ this.HelpString = "Shows the time until the vessel corsses the Equator, going north of it.";
this.IsDefault = false;
}
--- a/KerbalEngineer/Flight/Readouts/Orbital/TimeToEquatorialDescendingNode.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/TimeToEquatorialDescendingNode.cs
@@ -35,7 +35,7 @@
{
this.Name = "Time to Equ. DN";
this.Category = ReadoutCategory.GetCategory("Orbital");
- this.HelpString = string.Empty;
+ this.HelpString = "Shows the time until the vessel corsses the Equator, going south of it.";
this.IsDefault = false;
}
--- a/KerbalEngineer/Flight/Readouts/ReadoutLibrary.cs
+++ b/KerbalEngineer/Flight/Readouts/ReadoutLibrary.cs
@@ -1,7 +1,5 @@
//
-// Kerbal Engineer Redux
-//
-// Copyright (C) 2014 CYBUTEK
+// Copyright (C) 2015 CYBUTEK
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -19,8 +17,6 @@
namespace KerbalEngineer.Flight.Readouts
{
- #region Using Directives
-
using System;
using System.Collections.Generic;
using System.Linq;
@@ -30,6 +26,7 @@
using Rendezvous;
using Settings;
using Surface;
+ using Thermal;
using Vessel;
using AltitudeSeaLevel = Surface.AltitudeSeaLevel;
using ApoapsisHeight = Orbital.ApoapsisHeight;
@@ -40,17 +37,9 @@
using TimeToApoapsis = Orbital.TimeToApoapsis;
using TimeToPeriapsis = Orbital.TimeToPeriapsis;
- #endregion
-
public static class ReadoutLibrary
{
- #region Fields
-
private static List<ReadoutModule> readouts = new List<ReadoutModule>();
-
- #endregion
-
- #region Constructors
/// <summary>
/// Sets up and populates the readout library with the stock readouts.
@@ -63,6 +52,7 @@
ReadoutCategory.SetCategory("Surface", "Surface and atmospheric readouts.");
ReadoutCategory.SetCategory("Vessel", "Vessel performance statistics.");
ReadoutCategory.SetCategory("Rendezvous", "Readouts for rendezvous manovoeures.");
+ ReadoutCategory.SetCategory("Thermal", "Thermal characteristics readouts.");
ReadoutCategory.SetCategory("Miscellaneous", "Miscellaneous readouts.");
ReadoutCategory.Selected = ReadoutCategory.GetCategory("Orbital");
@@ -101,6 +91,11 @@
readouts.Add(new NodeTimeToHalfBurn());
readouts.Add(new NodeAngleToPrograde());
readouts.Add(new NodeAngleToRetrograde());
+ readouts.Add(new PostBurnApoapsis());
+ readouts.Add(new PostBurnPeriapsis());
+ readouts.Add(new SpeedAtApoapsis());
+ readouts.Add(new SpeedAtPeriapsis());
+ readouts.Add(new TimeToAtmosphere());
// Surface
readouts.Add(new AltitudeSeaLevel());
@@ -109,6 +104,7 @@
readouts.Add(new VerticalAcceleration());
readouts.Add(new HorizontalSpeed());
readouts.Add(new HorizontalAcceleration());
+ readouts.Add(new MachNumber());
readouts.Add(new Latitude());
readouts.Add(new Longitude());
readouts.Add(new GeeForce());
@@ -124,6 +120,7 @@
readouts.Add(new ImpactBiome());
// Vessel
+ readouts.Add(new Name());
readouts.Add(new DeltaVStaged());
readouts.Add(new DeltaVCurrent());
readouts.Add(new DeltaVTotal());
@@ -171,12 +168,28 @@
readouts.Add(new Rendezvous.OrbitalPeriod());
readouts.Add(new Rendezvous.SemiMajorAxis());
readouts.Add(new Rendezvous.SemiMinorAxis());
-
+ readouts.Add(new Rendezvous.RelativeRadialVelocity());
+ readouts.Add(new Rendezvous.TimeToRendezvous());
+
+ // Thermal
+ readouts.Add(new InternalFlux());
+ readouts.Add(new ConvectionFlux());
+ readouts.Add(new RadiationFlux());
+ readouts.Add(new CriticalPart());
+ readouts.Add(new CriticalTemperature());
+ readouts.Add(new CriticalSkinTemperature());
+ readouts.Add(new CriticalThermalPercentage());
+ readouts.Add(new HottestPart());
+ readouts.Add(new HottestTemperature());
+ readouts.Add(new HottestSkinTemperature());
+ readouts.Add(new CoolestPart());
+ readouts.Add(new CoolestTemperature());
+ readouts.Add(new CoolestSkinTemperature());
+
// Misc
readouts.Add(new Separator());
readouts.Add(new GuiSizeAdjustor());
readouts.Add(new SimulationDelay());
- readouts.Add(new TimeReference());
readouts.Add(new VectoredThrustToggle());
readouts.Add(new SystemTime());
@@ -188,22 +201,20 @@
}
}
- #endregion
-
- #region Properties
-
/// <summary>
/// Gets and sets the available readout modules.
/// </summary>
public static List<ReadoutModule> Readouts
{
- get { return readouts; }
- set { readouts = value; }
- }
-
- #endregion
-
- #region Methods
+ get
+ {
+ return readouts;
+ }
+ set
+ {
+ readouts = value;
+ }
+ }
/// <summary>
/// Gets a list of readout modules which are associated with the specified category.
@@ -226,7 +237,7 @@
/// </summary>
public static void Reset()
{
- foreach (var readout in readouts)
+ foreach (ReadoutModule readout in readouts)
{
readout.Reset();
}
@@ -239,8 +250,8 @@
{
try
{
- var handler = SettingHandler.Load("HelpStrings.xml");
- foreach (var readout in readouts)
+ SettingHandler handler = SettingHandler.Load("HelpStrings.xml");
+ foreach (ReadoutModule readout in readouts)
{
readout.HelpString = handler.GetSet(readout.Category + "." + readout.GetType().Name, readout.HelpString);
}
@@ -251,7 +262,5 @@
Logger.Exception(ex);
}
}
-
- #endregion
}
}
--- a/KerbalEngineer/Flight/Readouts/ReadoutModule.cs
+++ b/KerbalEngineer/Flight/Readouts/ReadoutModule.cs
@@ -29,6 +29,8 @@
namespace KerbalEngineer.Flight.Readouts
{
+ using Extensions;
+
public abstract class ReadoutModule
{
#region Fields
@@ -178,13 +180,13 @@
{
GUILayout.Label(this.Name, this.NameStyle);
GUILayout.FlexibleSpace();
- GUILayout.Label(value, this.ValueStyle);
+ GUILayout.Label(value.ToLength(20), this.ValueStyle);
}
else
{
GUILayout.Label(this.Name, this.NameStyle, GUILayout.Height(this.NameStyle.fontSize * 1.2f));
GUILayout.FlexibleSpace();
- GUILayout.Label(value, this.ValueStyle, GUILayout.Height(this.ValueStyle.fontSize * 1.2f));
+ GUILayout.Label(value.ToLength(20), this.ValueStyle, GUILayout.Height(this.ValueStyle.fontSize * 1.2f));
}
GUILayout.EndHorizontal();
@@ -198,13 +200,13 @@
{
GUILayout.Label(name, this.NameStyle);
GUILayout.FlexibleSpace();
- GUILayout.Label(value, this.ValueStyle);
+ GUILayout.Label(value.ToLength(20), this.ValueStyle);
}
else
{
GUILayout.Label(name, this.NameStyle, GUILayout.Height(this.NameStyle.fontSize * 1.2f));
GUILayout.FlexibleSpace();
- GUILayout.Label(value, this.ValueStyle, GUILayout.Height(this.ValueStyle.fontSize * 1.2f));
+ GUILayout.Label(value.ToLength(20), this.ValueStyle, GUILayout.Height(this.ValueStyle.fontSize * 1.2f));
}
GUILayout.EndHorizontal();
--- a/KerbalEngineer/Flight/Readouts/Rendezvous/AltitudeSeaLevel.cs
+++ b/KerbalEngineer/Flight/Readouts/Rendezvous/AltitudeSeaLevel.cs
@@ -34,7 +34,7 @@
{
this.Name = "Altitude (Sea Level)";
this.Category = ReadoutCategory.GetCategory("Rendezvous");
- this.HelpString = string.Empty;
+ this.HelpString = "Shows the target's altitude above sea level.";
this.IsDefault = true;
}
--- a/KerbalEngineer/Flight/Readouts/Rendezvous/AngleToRelativeAscendingNode.cs
+++ b/KerbalEngineer/Flight/Readouts/Rendezvous/AngleToRelativeAscendingNode.cs
@@ -34,7 +34,7 @@
{
this.Name = "Angle to Rel. AN";
this.Category = ReadoutCategory.GetCategory("Rendezvous");
- this.HelpString = string.Empty;
+ this.HelpString = "Angular Distance from the vessel to crossing the orbit of the target object, going north of it.";
this.IsDefault = false;
}
--- a/KerbalEngineer/Flight/Readouts/Rendezvous/AngleToRelativeDescendingNode.cs
+++ b/KerbalEngineer/Flight/Readouts/Rendezvous/AngleToRelativeDescendingNode.cs
@@ -34,7 +34,7 @@
{
this.Name = "Angle to Rel. DN";
this.Category = ReadoutCategory.GetCategory("Rendezvous");
- this.HelpString = string.Empty;
+ this.HelpString = "Angular Distance from the vessel to crossing the orbit of the target object, going south of it.";
this.IsDefault = false;
}
--- a/KerbalEngineer/Flight/Readouts/Rendezvous/ApoapsisHeight.cs
+++ b/KerbalEngineer/Flight/Readouts/Rendezvous/ApoapsisHeight.cs
@@ -34,7 +34,7 @@
{
this.Name = "Apoapsis Height";
this.Category = ReadoutCategory.GetCategory("Rendezvous");
- this.HelpString = string.Empty;
+ this.HelpString = "Shows the targets's apoapsis height relative to sea level. (Apoapsis is the highest point of an orbit.)";
this.IsDefault = true;
}
--- a/KerbalEngineer/Flight/Readouts/Rendezvous/Distance.cs
+++ b/KerbalEngineer/Flight/Readouts/Rendezvous/Distance.cs
@@ -34,7 +34,7 @@
{
this.Name = "Distance";
this.Category = ReadoutCategory.GetCategory("Rendezvous");
- this.HelpString = string.Empty;
+ this.HelpString = "Current distance between the vessel and the target object.";
this.IsDefault = true;
}
--- a/KerbalEngineer/Flight/Readouts/Rendezvous/OrbitalPeriod.cs
+++ b/KerbalEngineer/Flight/Readouts/Rendezvous/OrbitalPeriod.cs
@@ -34,7 +34,7 @@
{
this.Name = "Orbital Period";
this.Category = ReadoutCategory.GetCategory("Rendezvous");
- this.HelpString = string.Empty;
+ this.HelpString = "Shows the amount of time it will take the target object to complete a full orbit.";
this.IsDefault = false;
}
--- a/KerbalEngineer/Flight/Readouts/Rendezvous/PeriapsisHeight.cs
+++ b/KerbalEngineer/Flight/Readouts/Rendezvous/PeriapsisHeight.cs
@@ -34,7 +34,7 @@
{
this.Name = "Periapsis Height";
this.Category = ReadoutCategory.GetCategory("Rendezvous");
- this.HelpString = string.Empty;
+ this.HelpString = "Shows the targets's periapsis height relative to sea level. (Periapsis is the lowest point of an orbit.)";
this.IsDefault = true;
}
--- a/KerbalEngineer/Flight/Readouts/Rendezvous/PhaseAngle.cs
+++ b/KerbalEngineer/Flight/Readouts/Rendezvous/PhaseAngle.cs
@@ -34,7 +34,7 @@
{
this.Name = "Phase Angle";
this.Category = ReadoutCategory.GetCategory("Rendezvous");
- this.HelpString = string.Empty;
+ this.HelpString = "Angular distance of the vessel relative to the target object.";
this.IsDefault = true;
}
--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Rendezvous/RelativeRadialVelocity.cs
@@ -1,1 +1,66 @@
+//
+// Kerbal Engineer Redux
+//
+// Copyright (C) 2014 CYBUTEK
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+#region Using Directives
+
+using KerbalEngineer.Extensions;
+using KerbalEngineer.Flight.Sections;
+
+#endregion
+
+namespace KerbalEngineer.Flight.Readouts.Rendezvous
+{
+ public class RelativeRadialVelocity : ReadoutModule
+ {
+ #region Constructors
+
+ public RelativeRadialVelocity()
+ {
+ this.Name = "Relative Radial Velocity";
+ this.Category = ReadoutCategory.GetCategory("Rendezvous");
+ this.HelpString = "Relative radial velocity between your vessel and the target object";
+ this.IsDefault = false;
+ }
+
+ #endregion
+
+ #region Methods: public
+
+ public override void Draw(SectionModule section)
+ {
+ if (RendezvousProcessor.ShowDetails)
+ {
+ this.DrawLine(RendezvousProcessor.RelativeRadialVelocity.ToSpeed(), section.IsHud);
+ }
+ }
+
+ public override void Reset()
+ {
+ FlightEngineerCore.Instance.AddUpdatable(RendezvousProcessor.Instance);
+ }
+
+ public override void Update()
+ {
+ RendezvousProcessor.RequestUpdate();
+ }
+
+ #endregion
+ }
+}
+
--- a/KerbalEngineer/Flight/Readouts/Rendezvous/RendezvousProcessor.cs
+++ b/KerbalEngineer/Flight/Readouts/Rendezvous/RendezvousProcessor.cs
@@ -135,6 +135,16 @@
/// Gets the target's time to periapsis.
/// </summary>
public static double TimeToPeriapsis { get; private set; }
+
+ /// <summary>
+ /// Gets the relative radial velocity.
+ /// </summary>
+ public static double RelativeRadialVelocity { get; private set; }
+
+ /// <summary>
+ /// Gets approximate (linearly) time to the minimum distance between objects.
+ /// </summary>
+ public static double TimeToRendezvous { get; private set; }
/// <summary>
/// Gets and sets whether the updatable object should be updated.
@@ -193,6 +203,14 @@
Distance = Vector3d.Distance(targetOrbit.pos, originOrbit.pos);
OrbitalPeriod = targetOrbit.period;
+
+ // beware that the order/sign of coordinates is inconsistent across different exposed variables
+ // in particular, v below does not equal to FlightGlobals.ship_tgtVelocity
+ Vector3d x = targetOrbit.pos - originOrbit.pos;
+ Vector3d v = targetOrbit.vel - originOrbit.vel;
+ double xv = Vector3d.Dot(x, v);
+ TimeToRendezvous = - xv / Vector3d.SqrMagnitude(v);
+ RelativeRadialVelocity = xv / Vector3d.Magnitude(x);
}
private double CalcInterceptAngle()
--- a/KerbalEngineer/Flight/Readouts/Rendezvous/SemiMajorAxis.cs
+++ b/KerbalEngineer/Flight/Readouts/Rendezvous/SemiMajorAxis.cs
@@ -36,7 +36,7 @@
{
this.Name = "Semi-major Axis";
this.Category = ReadoutCategory.GetCategory("Rendezvous");
- this.HelpString = String.Empty;
+ this.HelpString = "Shows the distance from the centre of the target's orbit to the farthest edge.";
this.IsDefault = true;
}
--- a/KerbalEngineer/Flight/Readouts/Rendezvous/SemiMinorAxis.cs
+++ b/KerbalEngineer/Flight/Readouts/Rendezvous/SemiMinorAxis.cs
@@ -36,7 +36,7 @@
{
this.Name = "Semi-minor Axis";
this.Category = ReadoutCategory.GetCategory("Rendezvous");
- this.HelpString = String.Empty;
+ this.HelpString = "Shows the distance from the centre of the target's orbit to the nearest edge.";
this.IsDefault = false;
}
--- a/KerbalEngineer/Flight/Readouts/Rendezvous/TimeToApoapsis.cs
+++ b/KerbalEngineer/Flight/Readouts/Rendezvous/TimeToApoapsis.cs
@@ -34,7 +34,7 @@
{
this.Name = "Time to Apoapsis";
this.Category = ReadoutCategory.GetCategory("Rendezvous");
- this.HelpString = string.Empty;
+ this.HelpString = "Shows the time until the target reaches apoapsis, the highest point of the orbit.";
this.IsDefault = false;
}
--- a/KerbalEngineer/Flight/Readouts/Rendezvous/TimeToPeriapsis.cs
+++ b/KerbalEngineer/Flight/Readouts/Rendezvous/TimeToPeriapsis.cs
@@ -34,7 +34,7 @@
{
this.Name = "Time to Periapsis";
this.Category = ReadoutCategory.GetCategory("Rendezvous");
- this.HelpString = string.Empty;
+ this.HelpString = "Shows the time until the target reaches periapsis, the lowest point of the orbit.";
this.IsDefault = false;
}
--- a/KerbalEngineer/Flight/Readouts/Rendezvous/TimeToRelativeAscendingNode.cs
+++ b/KerbalEngineer/Flight/Readouts/Rendezvous/TimeToRelativeAscendingNode.cs
@@ -34,7 +34,7 @@
{
this.Name = "Time to Rel. AN";
this.Category = ReadoutCategory.GetCategory("Rendezvous");
- this.HelpString = string.Empty;
+ this.HelpString = "Time until the vessel crosses the target's orbit, going north.";
this.IsDefault = true;
}
--- a/KerbalEngineer/Flight/Readouts/Rendezvous/TimeToRelativeDescendingNode.cs
+++ b/KerbalEngineer/Flight/Readouts/Rendezvous/TimeToRelativeDescendingNode.cs
@@ -34,7 +34,7 @@
{
this.Name = "Time to Rel. DN";
this.Category = ReadoutCategory.GetCategory("Rendezvous");
- this.HelpString = string.Empty;
+ this.HelpString = "Time until the vessel crosses the target's orbit, going south.";
this.IsDefault = true;
}
--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Rendezvous/TimeToRendezvous.cs
@@ -1,1 +1,65 @@
+//
+// Kerbal Engineer Redux
+//
+// Copyright (C) 2014 CYBUTEK
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+#region Using Directives
+
+using KerbalEngineer.Flight.Sections;
+using KerbalEngineer.Helpers;
+
+#endregion
+
+namespace KerbalEngineer.Flight.Readouts.Rendezvous
+{
+ public class TimeToRendezvous : ReadoutModule
+ {
+ #region Constructors
+
+ public TimeToRendezvous()
+ {
+ this.Name = "Time to Rendezvous";
+ this.Category = ReadoutCategory.GetCategory("Rendezvous");
+ this.HelpString = "Approximate (linearly) time to the minimum distance between objects.";
+ this.IsDefault = false;
+ }
+
+ #endregion
+
+ #region Methods: public
+
+ public override void Draw(SectionModule section)
+ {
+ if (RendezvousProcessor.ShowDetails)
+ {
+ this.DrawLine(TimeFormatter.ConvertToString(RendezvousProcessor.TimeToRendezvous), section.IsHud);
+ }
+ }
+
+ public override void Reset()
+ {
+ FlightEngineerCore.Instance.AddUpdatable(RendezvousProcessor.Instance);
+ }
+
+ public override void Update()
+ {
+ RendezvousProcessor.RequestUpdate();
+ }
+
+ #endregion
+ }
+}
--- a/KerbalEngineer/Flight/Readouts/Surface/AtmosphericEfficiency.cs
+++ b/KerbalEngineer/Flight/Readouts/Surface/AtmosphericEfficiency.cs
@@ -1,7 +1,7 @@
//
// Kerbal Engineer Redux
//
-// Copyright (C) 2014 CYBUTEK
+// Copyright (C) 2015 CYBUTEK
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -17,36 +17,26 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
-#region Using Directives
-
-using KerbalEngineer.Extensions;
-using KerbalEngineer.Flight.Sections;
-
-#endregion
-
namespace KerbalEngineer.Flight.Readouts.Surface
{
+ using Extensions;
+ using Sections;
+
public class AtmosphericEfficiency : ReadoutModule
{
- #region Constructors
-
public AtmosphericEfficiency()
{
- this.Name = "Atmos. Efficiency";
- this.Category = ReadoutCategory.GetCategory("Surface");
- this.HelpString = "Shows you vessel's efficiency as a ratio of the current velocity and terminal velocity. Less than 1 means that you are losing efficiency due to gravity and greater than 1 is due to drag.";
- this.IsDefault = true;
+ Name = "Atmos. Efficiency";
+ Category = ReadoutCategory.GetCategory("Surface");
+ HelpString = "Shows you vessel's efficiency as a ratio of the current velocity and terminal velocity. Less than 100% means that you are losing efficiency due to gravity and greater than 100% is due to drag.";
+ IsDefault = false;
}
-
- #endregion
-
- #region Methods: public
public override void Draw(SectionModule section)
{
if (AtmosphericProcessor.ShowDetails)
{
- this.DrawLine(AtmosphericProcessor.Efficiency.ToPercent(), section.IsHud);
+ DrawLine(AtmosphericProcessor.Efficiency.ToPercent(), section.IsHud);
}
}
@@ -59,7 +49,5 @@
{
AtmosphericProcessor.RequestUpdate();
}
-
- #endregion
}
}
--- a/KerbalEngineer/Flight/Readouts/Surface/HorizontalSpeed.cs
+++ b/KerbalEngineer/Flight/Readouts/Surface/HorizontalSpeed.cs
@@ -21,6 +21,7 @@
using KerbalEngineer.Extensions;
using KerbalEngineer.Flight.Sections;
+using System;
#endregion
@@ -44,7 +45,11 @@
public override void Draw(SectionModule section)
{
- this.DrawLine(FlightGlobals.ActiveVessel.horizontalSrfSpeed.ToSpeed(), section.IsHud);
+ // Used to do this but the bug-fix to horizontalSrfSpeed in KSP 1.0.3 actually made it worse so workaround
+ //this.DrawLine(FlightGlobals.ActiveVessel.horizontalSrfSpeed.ToSpeed(), section.IsHud);
+ var ves = FlightGlobals.ActiveVessel;
+ double horizSpeed = Math.Sqrt(ves.srfSpeed * ves.srfSpeed - ves.verticalSpeed * ves.verticalSpeed);
+ this.DrawLine(horizSpeed.ToSpeed(), section.IsHud);
}
#endregion
--- a/KerbalEngineer/Flight/Readouts/Surface/ImpactAltitude.cs
+++ b/KerbalEngineer/Flight/Readouts/Surface/ImpactAltitude.cs
@@ -34,7 +34,7 @@
{
this.Name = "Impact Altitude";
this.Category = ReadoutCategory.GetCategory("Surface");
- this.HelpString = string.Empty;
+ this.HelpString = "Altitude at which the Vessel will impact.";
this.IsDefault = false;
}
--- a/KerbalEngineer/Flight/Readouts/Surface/ImpactBiome.cs
+++ b/KerbalEngineer/Flight/Readouts/Surface/ImpactBiome.cs
@@ -33,7 +33,7 @@
{
this.Name = "Impact Biome";
this.Category = ReadoutCategory.GetCategory("Surface");
- this.HelpString = string.Empty;
+ this.HelpString = "Biome the Vessel will impact in.";
this.IsDefault = true;
}
--- a/KerbalEngineer/Flight/Readouts/Surface/ImpactLatitude.cs
+++ b/KerbalEngineer/Flight/Readouts/Surface/ImpactLatitude.cs
@@ -34,7 +34,7 @@
{
this.Name = "Impact Latitude";
this.Category = ReadoutCategory.GetCategory("Surface");
- this.HelpString = string.Empty;
+ this.HelpString = "Latitude of the impact position.";
this.IsDefault = false;
}
--- a/KerbalEngineer/Flight/Readouts/Surface/ImpactLongitude.cs
+++ b/KerbalEngineer/Flight/Readouts/Surface/ImpactLongitude.cs
@@ -34,7 +34,7 @@
{
this.Name = "Impact Longitude";
this.Category = ReadoutCategory.GetCategory("Surface");
- this.HelpString = string.Empty;
+ this.HelpString = "Longditude of the impact position.";
this.IsDefault = false;
}
--- a/KerbalEngineer/Flight/Readouts/Surface/ImpactTime.cs
+++ b/KerbalEngineer/Flight/Readouts/Surface/ImpactTime.cs
@@ -34,7 +34,7 @@
{
this.Name = "Impact Time";
this.Category = ReadoutCategory.GetCategory("Surface");
- this.HelpString = string.Empty;
+ this.HelpString = "Shows time until the vessel impacts the central object.";
this.IsDefault = true;
}
--- a/KerbalEngineer/Flight/Readouts/Surface/Latitude.cs
+++ b/KerbalEngineer/Flight/Readouts/Surface/Latitude.cs
@@ -34,7 +34,7 @@
{
this.Name = "Latitude";
this.Category = ReadoutCategory.GetCategory("Surface");
- this.HelpString = "Shows the vessel's latitude position around the celestial body. Latitude is the angle from the equator to poles.";
+ this.HelpString = "Shows the vessel's latitude position around the celestial body. Latitude is the angle from the equator to poles.";
this.IsDefault = true;
}
--- a/KerbalEngineer/Flight/Readouts/Surface/Longitude.cs
+++ b/KerbalEngineer/Flight/Readouts/Surface/Longitude.cs
@@ -28,7 +28,7 @@
{
Name = "Longitude";
Category = ReadoutCategory.GetCategory("Surface");
- HelpString = "Shows the vessel's longitude around a celestial body. Longitude is the angle from the bodies prime meridian.";
+ HelpString = "Shows the vessel's longitude around a celestial body. Longitude is the angle from the bodies prime meridian.";
IsDefault = true;
}
--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Surface/MachNumber.cs
@@ -1,1 +1,43 @@
+//
+// Kerbal Engineer Redux
+//
+// Copyright (C) 2015 CYBUTEK
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+namespace KerbalEngineer.Flight.Readouts.Surface
+{
+ using Extensions;
+ using Sections;
+
+ public class MachNumber : ReadoutModule
+ {
+ public MachNumber()
+ {
+ Name = "Mach Number";
+ Category = ReadoutCategory.GetCategory("Surface");
+ HelpString = "Shows the vessel's mach number.";
+ IsDefault = true;
+ }
+
+ public override void Draw(SectionModule section)
+ {
+ if (FlightGlobals.ActiveVessel.atmDensity > 0.0)
+ {
+ DrawLine(FlightGlobals.ActiveVessel.mach.ToMach(), section.IsHud);
+ }
+ }
+ }
+}
--- a/KerbalEngineer/Flight/Readouts/Surface/Situation.cs
+++ b/KerbalEngineer/Flight/Readouts/Surface/Situation.cs
@@ -33,7 +33,7 @@
{
this.Name = "Situation";
this.Category = ReadoutCategory.GetCategory("Surface");
- this.HelpString = string.Empty;
+ this.HelpString = "Shows the vessel's current scientific situation. (Landed, Splashed, Flying Low/High, In Space Low/High)";
this.IsDefault = true;
}
--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Thermal/ConvectionFlux.cs
@@ -1,1 +1,53 @@
+//
+// Kerbal Engineer Redux
+//
+// Copyright (C) 2015 CYBUTEK
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+namespace KerbalEngineer.Flight.Readouts.Thermal
+{
+ using Extensions;
+ using Sections;
+
+ public class ConvectionFlux : ReadoutModule
+ {
+ public ConvectionFlux()
+ {
+ Name = "Convection Flux";
+ Category = ReadoutCategory.GetCategory("Thermal");
+ HelpString = string.Empty;
+ IsDefault = true;
+ }
+
+ public override void Draw(SectionModule section)
+ {
+ if (ThermalProcessor.ShowDetails && FlightGlobals.ActiveVessel.atmDensity > 0.0)
+ {
+ DrawLine(ThermalProcessor.ConvectionFlux.ToFlux(), section.IsHud);
+ }
+ }
+
+ public override void Reset()
+ {
+ FlightEngineerCore.Instance.AddUpdatable(ThermalProcessor.Instance);
+ }
+
+ public override void Update()
+ {
+ ThermalProcessor.RequestUpdate();
+ }
+ }
+}
--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Thermal/CoolestPart.cs
@@ -1,1 +1,52 @@
+//
+// Kerbal Engineer Redux
+//
+// Copyright (C) 2015 CYBUTEK
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+namespace KerbalEngineer.Flight.Readouts.Thermal
+{
+ using Sections;
+
+ public class CoolestPart : ReadoutModule
+ {
+ public CoolestPart()
+ {
+ Name = "Coolest Part";
+ Category = ReadoutCategory.GetCategory("Thermal");
+ HelpString = "The part of the vessel that is enduring the lowest temperature.";
+ IsDefault = true;
+ }
+
+ public override void Draw(SectionModule section)
+ {
+ if (ThermalProcessor.ShowDetails)
+ {
+ DrawLine(ThermalProcessor.CoolestPartName, section.IsHud);
+ }
+ }
+
+ public override void Reset()
+ {
+ FlightEngineerCore.Instance.AddUpdatable(ThermalProcessor.Instance);
+ }
+
+ public override void Update()
+ {
+ ThermalProcessor.RequestUpdate();
+ }
+ }
+}
--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Thermal/CoolestSkinTemperature.cs
@@ -1,1 +1,53 @@
+//
+// Kerbal Engineer Redux
+//
+// Copyright (C) 2015 CYBUTEK
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+namespace KerbalEngineer.Flight.Readouts.Thermal
+{
+ using Helpers;
+ using Sections;
+
+ public class CoolestSkinTemperature : ReadoutModule
+ {
+ public CoolestSkinTemperature()
+ {
+ Name = "Coolest Skin Temperature";
+ Category = ReadoutCategory.GetCategory("Thermal");
+ HelpString = "Lowest external Temperature on the Vessel.";
+ IsDefault = true;
+ }
+
+ public override void Draw(SectionModule section)
+ {
+ if (ThermalProcessor.ShowDetails)
+ {
+ DrawLine(Units.ToTemperature(ThermalProcessor.CoolestSkinTemperature, ThermalProcessor.CoolestSkinTemperatureMax), section.IsHud);
+ }
+ }
+
+ public override void Reset()
+ {
+ FlightEngineerCore.Instance.AddUpdatable(ThermalProcessor.Instance);
+ }
+
+ public override void Update()
+ {
+ ThermalProcessor.RequestUpdate();
+ }
+ }
+}
--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Thermal/CoolestTemperature.cs
@@ -1,1 +1,53 @@
+//
+// Kerbal Engineer Redux
+//
+// Copyright (C) 2015 CYBUTEK
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+namespace KerbalEngineer.Flight.Readouts.Thermal
+{
+ using Helpers;
+ using Sections;
+
+ public class CoolestTemperature : ReadoutModule
+ {
+ public CoolestTemperature()
+ {
+ Name = "Coolest Temperature";
+ Category = ReadoutCategory.GetCategory("Thermal");
+ HelpString = "Lowest internal Temperature on the Vessel.";
+ IsDefault = true;
+ }
+
+ public override void Draw(SectionModule section)
+ {
+ if (ThermalProcessor.ShowDetails)
+ {
+ DrawLine(Units.ToTemperature(ThermalProcessor.CoolestTemperature, ThermalProcessor.CoolestTemperatureMax), section.IsHud);
+ }
+ }
+
+ public override void Reset()
+ {
+ FlightEngineerCore.Instance.AddUpdatable(ThermalProcessor.Instance);
+ }
+
+ public override void Update()
+ {
+ ThermalProcessor.RequestUpdate();
+ }
+ }
+}
--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Thermal/CriticalPart.cs
@@ -1,1 +1,52 @@
+//
+// Kerbal Engineer Redux
+//
+// Copyright (C) 2015 CYBUTEK
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+namespace KerbalEngineer.Flight.Readouts.Thermal
+{
+ using Sections;
+
+ public class CriticalPart : ReadoutModule
+ {
+ public CriticalPart()
+ {
+ Name = "Critical Part";
+ Category = ReadoutCategory.GetCategory("Thermal");
+ HelpString = "This part is structually most critical. If it endures too high temperature there is a high chance for major structual failure!";
+ IsDefault = true;
+ }
+
+ public override void Draw(SectionModule section)
+ {
+ if (ThermalProcessor.ShowDetails)
+ {
+ DrawLine(ThermalProcessor.CriticalPartName, section.IsHud);
+ }
+ }
+
+ public override void Reset()
+ {
+ FlightEngineerCore.Instance.AddUpdatable(ThermalProcessor.Instance);
+ }
+
+ public override void Update()
+ {
+ ThermalProcessor.RequestUpdate();
+ }
+ }
+}
--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Thermal/CriticalSkinTemperature.cs
@@ -1,1 +1,53 @@
+//
+// Kerbal Engineer Redux
+//
+// Copyright (C) 2015 CYBUTEK
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+namespace KerbalEngineer.Flight.Readouts.Thermal
+{
+ using Helpers;
+ using Sections;
+
+ public class CriticalSkinTemperature : ReadoutModule
+ {
+ public CriticalSkinTemperature()
+ {
+ Name = "Critical Skin Temperature";
+ Category = ReadoutCategory.GetCategory("Thermal");
+ HelpString = "Highest external Temperature on the part of the Vessel that is structually most critical.";
+ IsDefault = true;
+ }
+
+ public override void Draw(SectionModule section)
+ {
+ if (ThermalProcessor.ShowDetails)
+ {
+ DrawLine(Units.ToTemperature(ThermalProcessor.CriticalSkinTemperature, ThermalProcessor.CriticalSkinTemperatureMax), section.IsHud);
+ }
+ }
+
+ public override void Reset()
+ {
+ FlightEngineerCore.Instance.AddUpdatable(ThermalProcessor.Instance);
+ }
+
+ public override void Update()
+ {
+ ThermalProcessor.RequestUpdate();
+ }
+ }
+}
--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Thermal/CriticalTemperature.cs
@@ -1,1 +1,53 @@
+//
+// Kerbal Engineer Redux
+//
+// Copyright (C) 2015 CYBUTEK
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+namespace KerbalEngineer.Flight.Readouts.Thermal
+{
+ using Helpers;
+ using Sections;
+
+ public class CriticalTemperature : ReadoutModule
+ {
+ public CriticalTemperature()
+ {
+ Name = "Critical Temperature";
+ Category = ReadoutCategory.GetCategory("Thermal");
+ HelpString = "Internal Temperature on the part of the Vessel that is structually most critical.";
+ IsDefault = true;
+ }
+
+ public override void Draw(SectionModule section)
+ {
+ if (ThermalProcessor.ShowDetails)
+ {
+ DrawLine(Units.ToTemperature(ThermalProcessor.CriticalTemperature, ThermalProcessor.CriticalTemperatureMax), section.IsHud);
+ }
+ }
+
+ public override void Reset()
+ {
+ FlightEngineerCore.Instance.AddUpdatable(ThermalProcessor.Instance);
+ }
+
+ public override void Update()
+ {
+ ThermalProcessor.RequestUpdate();
+ }
+ }
+}
--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Thermal/CriticalThermalPercentage.cs
@@ -1,1 +1,53 @@
+//
+// Kerbal Engineer Redux
+//
+// Copyright (C) 2015 CYBUTEK
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+namespace KerbalEngineer.Flight.Readouts.Thermal
+{
+ using Extensions;
+ using Sections;
+
+ public class CriticalThermalPercentage : ReadoutModule
+ {
+ public CriticalThermalPercentage()
+ {
+ Name = "Critical Thermal Percentage";
+ Category = ReadoutCategory.GetCategory("Thermal");
+ HelpString = "Shows how high a temperature the critical Part is enduring relative to it's maximal temperature.";
+ IsDefault = true;
+ }
+
+ public override void Draw(SectionModule section)
+ {
+ if (ThermalProcessor.ShowDetails)
+ {
+ DrawLine(ThermalProcessor.CriticalTemperaturePercentage.ToPercent(), section.IsHud);
+ }
+ }
+
+ public override void Reset()
+ {
+ FlightEngineerCore.Instance.AddUpdatable(ThermalProcessor.Instance);
+ }
+
+ public override void Update()
+ {
+ ThermalProcessor.RequestUpdate();
+ }
+ }
+}
--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Thermal/HottestPart.cs
@@ -1,1 +1,52 @@
+//
+// Kerbal Engineer Redux
+//
+// Copyright (C) 2015 CYBUTEK
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+namespace KerbalEngineer.Flight.Readouts.Thermal
+{
+ using Sections;
+
+ public class HottestPart : ReadoutModule
+ {
+ public HottestPart()
+ {
+ Name = "Hottest Part";
+ Category = ReadoutCategory.GetCategory("Thermal");
+ HelpString = "The part of the vessel that is enduring the highest temperature.";
+ IsDefault = true;
+ }
+
+ public override void Draw(SectionModule section)
+ {
+ if (ThermalProcessor.ShowDetails)
+ {
+ DrawLine(ThermalProcessor.HottestPartName, section.IsHud);
+ }
+ }
+
+ public override void Reset()
+ {
+ FlightEngineerCore.Instance.AddUpdatable(ThermalProcessor.Instance);
+ }
+
+ public override void Update()
+ {
+ ThermalProcessor.RequestUpdate();
+ }
+ }
+}
--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Thermal/HottestSkinTemperature.cs
@@ -1,1 +1,53 @@
+//
+// Kerbal Engineer Redux
+//
+// Copyright (C) 2015 CYBUTEK
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+namespace KerbalEngineer.Flight.Readouts.Thermal
+{
+ using Helpers;
+ using Sections;
+
+ public class HottestSkinTemperature : ReadoutModule
+ {
+ public HottestSkinTemperature()
+ {
+ Name = "Hottest Skin Temperature";
+ Category = ReadoutCategory.GetCategory("Thermal");
+ HelpString = "Highest external Temperature on the Vessel.";
+ IsDefault = true;
+ }
+
+ public override void Draw(SectionModule section)
+ {
+ if (ThermalProcessor.ShowDetails)
+ {
+ DrawLine(Units.ToTemperature(ThermalProcessor.HottestSkinTemperature, ThermalProcessor.HottestSkinTemperatureMax), section.IsHud);
+ }
+ }
+
+ public override void Reset()
+ {
+ FlightEngineerCore.Instance.AddUpdatable(ThermalProcessor.Instance);
+ }
+
+ public override void Update()
+ {
+ ThermalProcessor.RequestUpdate();
+ }
+ }
+}
--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Thermal/HottestTemperature.cs
@@ -1,1 +1,53 @@
+//
+// Kerbal Engineer Redux
+//
+// Copyright (C) 2015 CYBUTEK
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+namespace KerbalEngineer.Flight.Readouts.Thermal
+{
+ using Helpers;
+ using Sections;
+
+ public class HottestTemperature : ReadoutModule
+ {
+ public HottestTemperature()
+ {
+ Name = "Hottest Temperature";
+ Category = ReadoutCategory.GetCategory("Thermal");
+ HelpString = "Highest internal Temperature on the Vessel.";
+ IsDefault = true;
+ }
+
+ public override void Draw(SectionModule section)
+ {
+ if (ThermalProcessor.ShowDetails)
+ {
+ DrawLine(Units.ToTemperature(ThermalProcessor.HottestTemperature, ThermalProcessor.HottestTemperatureMax), section.IsHud);
+ }
+ }
+
+ public override void Reset()
+ {
+ FlightEngineerCore.Instance.AddUpdatable(ThermalProcessor.Instance);
+ }
+
+ public override void Update()
+ {
+ ThermalProcessor.RequestUpdate();
+ }
+ }
+}
--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Thermal/InternalFlux.cs
@@ -1,1 +1,53 @@
+//
+// Kerbal Engineer Redux
+//
+// Copyright (C) 2015 CYBUTEK
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+namespace KerbalEngineer.Flight.Readouts.Thermal
+{
+ using Extensions;
+ using Sections;
+
+ public class InternalFlux : ReadoutModule
+ {
+ public InternalFlux()
+ {
+ Name = "Internal Flux";
+ Category = ReadoutCategory.GetCategory("Thermal");
+ HelpString = string.Empty;
+ IsDefault = true;
+ }
+
+ public override void Draw(SectionModule section)
+ {
+ if (ThermalProcessor.ShowDetails)
+ {
+ DrawLine(ThermalProcessor.InternalFlux.ToFlux(), section.IsHud);
+ }
+ }
+
+ public override void Reset()
+ {
+ FlightEngineerCore.Instance.AddUpdatable(ThermalProcessor.Instance);
+ }
+
+ public override void Update()
+ {
+ ThermalProcessor.RequestUpdate();
+ }
+ }
+}
--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Thermal/RadiationFlux.cs
@@ -1,1 +1,53 @@
+//
+// Kerbal Engineer Redux
+//
+// Copyright (C) 2015 CYBUTEK
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+namespace KerbalEngineer.Flight.Readouts.Thermal
+{
+ using Extensions;
+ using Sections;
+
+ public class RadiationFlux : ReadoutModule
+ {
+ public RadiationFlux()
+ {
+ Name = "Radiation Flux";
+ Category = ReadoutCategory.GetCategory("Thermal");
+ HelpString = string.Empty;
+ IsDefault = true;
+ }
+
+ public override void Draw(SectionModule section)
+ {
+ if (ThermalProcessor.ShowDetails)
+ {
+ DrawLine(ThermalProcessor.RadiationFlux.ToFlux(), section.IsHud);
+ }
+ }
+
+ public override void Reset()
+ {
+ FlightEngineerCore.Instance.AddUpdatable(ThermalProcessor.Instance);
+ }
+
+ public override void Update()
+ {
+ ThermalProcessor.RequestUpdate();
+ }
+ }
+}
--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Thermal/ThermalProcessor.cs
@@ -1,1 +1,161 @@
+//
+// Copyright (C) 2015 CYBUTEK
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+namespace KerbalEngineer.Flight.Readouts.Thermal
+{
+ using System;
+
+ public class ThermalProcessor : IUpdatable, IUpdateRequest
+ {
+ private static readonly ThermalProcessor instance = new ThermalProcessor();
+
+ static ThermalProcessor()
+ {
+ HottestTemperature = 0.0;
+ HottestTemperatureMax = 0.0;
+ HottestSkinTemperature = 0.0;
+ HottestSkinTemperatureMax = 0.0;
+ CoolestTemperature = 0.0;
+ CoolestTemperatureMax = 0.0;
+ CoolestSkinTemperature = 0.0;
+ CoolestSkinTemperatureMax = 0.0;
+ CriticalTemperature = 0.0;
+ CriticalTemperatureMax = 0.0;
+ CriticalSkinTemperature = 0.0;
+ CriticalSkinTemperatureMax = 0.0;
+ HottestPartName = string.Empty;
+ CoolestPartName = string.Empty;
+ CriticalPartName = string.Empty;
+ }
+
+ public static double ConvectionFlux { get; private set; }
+
+ public static string CoolestPartName { get; private set; }
+
+ public static double CoolestSkinTemperature { get; private set; }
+
+ public static double CoolestSkinTemperatureMax { get; private set; }
+
+ public static double CoolestTemperature { get; private set; }
+
+ public static double CoolestTemperatureMax { get; private set; }
+
+ public static string CriticalPartName { get; private set; }
+
+ public static double CriticalSkinTemperature { get; private set; }
+
+ public static double CriticalSkinTemperatureMax { get; private set; }
+
+ public static double CriticalTemperature { get; private set; }
+
+ public static double CriticalTemperatureMax { get; private set; }
+
+ public static double CriticalTemperaturePercentage { get; private set; }
+
+ public static string HottestPartName { get; private set; }
+
+ public static double HottestSkinTemperature { get; private set; }
+
+ public static double HottestSkinTemperatureMax { get; private set; }
+
+ public static double HottestTemperature { get; private set; }
+
+ public static double HottestTemperatureMax { get; private set; }
+
+ public static ThermalProcessor Instance
+ {
+ get
+ {
+ return instance;
+ }
+ }
+
+ public static double InternalFlux { get; private set; }
+
+ public static double RadiationFlux { get; private set; }
+
+ public static bool ShowDetails { get; private set; }
+
+ public void Update()
+ {
+ if (FlightGlobals.ActiveVessel.parts.Count == 0)
+ {
+ ShowDetails = false;
+ return;
+ }
+
+ ShowDetails = true;
+
+ ConvectionFlux = 0.0;
+ RadiationFlux = 0.0;
+ InternalFlux = 0.0;
+ HottestTemperature = 0.0;
+ HottestSkinTemperature = 0.0;
+ CoolestTemperature = double.MaxValue;
+ CoolestSkinTemperature = double.MaxValue;
+ CriticalTemperature = double.MaxValue;
+ CriticalSkinTemperature = double.MaxValue;
+ CriticalTemperaturePercentage = 0.0;
+ HottestPartName = string.Empty;
+ CoolestPartName = string.Empty;
+ CriticalPartName = string.Empty;
+
+ for (int i = 0; i < FlightGlobals.ActiveVessel.parts.Count; ++i)
+ {
+ Part part = FlightGlobals.ActiveVessel.parts[i];
+
+ ConvectionFlux = ConvectionFlux + part.thermalConvectionFlux;
+ RadiationFlux = RadiationFlux + part.thermalRadiationFlux;
+ InternalFlux = InternalFlux + part.thermalInternalFluxPrevious;
+
+ if (part.temperature > HottestTemperature || part.skinTemperature > HottestSkinTemperature)
+ {
+ HottestTemperature = part.temperature;
+ HottestTemperatureMax = part.maxTemp;
+ HottestSkinTemperature = part.skinTemperature;
+ HottestSkinTemperatureMax = part.skinMaxTemp;
+ HottestPartName = part.partInfo.title;
+ }
+ if (part.temperature < CoolestTemperature || part.skinTemperature < CoolestSkinTemperature)
+ {
+ CoolestTemperature = part.temperature;
+ CoolestTemperatureMax = part.maxTemp;
+ CoolestSkinTemperature = part.skinTemperature;
+ CoolestSkinTemperatureMax = part.skinMaxTemp;
+ CoolestPartName = part.partInfo.title;
+ }
+
+ if (part.temperature / part.maxTemp > CriticalTemperaturePercentage || part.skinTemperature / part.skinMaxTemp > CriticalTemperaturePercentage)
+ {
+ CriticalTemperature = part.temperature;
+ CriticalTemperatureMax = part.maxTemp;
+ CriticalSkinTemperature = part.skinTemperature;
+ CriticalSkinTemperatureMax = part.skinMaxTemp;
+ CriticalTemperaturePercentage = Math.Max(part.temperature / part.maxTemp, part.skinTemperature / part.skinMaxTemp);
+ CriticalPartName = part.partInfo.title;
+ }
+ }
+ }
+
+ public bool UpdateRequested { get; set; }
+
+ public static void RequestUpdate()
+ {
+ instance.UpdateRequested = true;
+ }
+ }
+}
--- a/KerbalEngineer/Flight/Readouts/Vessel/Acceleration.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/Acceleration.cs
@@ -34,7 +34,7 @@
{
this.Name = "Acceleration";
this.Category = ReadoutCategory.GetCategory("Vessel");
- this.HelpString = string.Empty;
+ this.HelpString = "Shows the current and maximum acceleration of the craft.";
this.IsDefault = true;
}
--- a/KerbalEngineer/Flight/Readouts/Vessel/AttitudeProcessor.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/AttitudeProcessor.cs
@@ -110,8 +110,8 @@
? 360.0f - this.surfaceRotation.eulerAngles.x
: -this.surfaceRotation.eulerAngles.x;
this.roll = this.surfaceRotation.eulerAngles.z > 180.0f
- ? this.surfaceRotation.eulerAngles.z - 360.0f
- : this.surfaceRotation.eulerAngles.z;
+ ? 360.0f - this.surfaceRotation.eulerAngles.z
+ : -this.surfaceRotation.eulerAngles.z;
this.headingRate = this.heading - this.previousHeading;
this.pitchRate = this.pitch - this.previousPitch;
--- a/KerbalEngineer/Flight/Readouts/Vessel/DeltaVStaged.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/DeltaVStaged.cs
@@ -30,13 +30,6 @@
{
public class DeltaVStaged : ReadoutModule
{
- #region Fields
-
- private int numberOfStages;
- private bool showing;
-
- #endregion
-
#region Constructors
public DeltaVStaged()
--- a/KerbalEngineer/Flight/Readouts/Vessel/Heading.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/Heading.cs
@@ -34,7 +34,7 @@
{
this.Name = "Heading";
this.Category = ReadoutCategory.GetCategory("Vessel");
- this.HelpString = string.Empty;
+ this.HelpString = "Shows the current Heading.";
this.IsDefault = false;
}
--- a/KerbalEngineer/Flight/Readouts/Vessel/HeadingRate.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/HeadingRate.cs
@@ -34,7 +34,7 @@
{
this.Name = "Heading Rate";
this.Category = ReadoutCategory.GetCategory("Vessel");
- this.HelpString = string.Empty;
+ this.HelpString = "Shows the current change in Heading.";
this.IsDefault = false;
}
--- a/KerbalEngineer/Flight/Readouts/Vessel/IntakeAirDemand.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/IntakeAirDemand.cs
@@ -39,7 +39,7 @@
{
this.Name = "Intake Air (Demand)";
this.Category = ReadoutCategory.GetCategory("Vessel");
- this.HelpString = string.Empty;
+ this.HelpString = "Displays the Amount of Intake Air required.";
this.IsDefault = false;
}
--- a/KerbalEngineer/Flight/Readouts/Vessel/IntakeAirDemandSupply.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/IntakeAirDemandSupply.cs
@@ -42,7 +42,7 @@
{
this.Name = "Intake Air (D/S)";
this.Category = ReadoutCategory.GetCategory("Vessel");
- this.HelpString = string.Empty;
+ this.HelpString = "Displays the Ration between required and available Intake Air.";
this.IsDefault = false;
}
@@ -55,20 +55,11 @@
var demand = 0.0;
foreach (var part in FlightGlobals.ActiveVessel.Parts)
{
- if (part.Modules.Contains("ModuleEngines"))
+ for (int i = 0; i < part.Modules.Count; i++)
{
- var engine = part.Modules["ModuleEngines"] as ModuleEngines;
- if (engine.isOperational)
- {
- demand += engine.propellants
- .Where(p => p.name == "IntakeAir")
- .Sum(p => p.currentRequirement);
- }
- }
- if (part.Modules.Contains("ModuleEnginesFX"))
- {
- var engine = part.Modules["ModuleEnginesFX"] as ModuleEnginesFX;
- if (engine.isOperational)
+ PartModule partmod = part.Modules[i];
+ var engine = partmod as ModuleEngines;
+ if (engine != null && engine.isOperational)
{
demand += engine.propellants
.Where(p => p.name == "IntakeAir")
--- a/KerbalEngineer/Flight/Readouts/Vessel/IntakeAirSupply.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/IntakeAirSupply.cs
@@ -39,7 +39,7 @@
{
this.Name = "Intake Air (Supply)";
this.Category = ReadoutCategory.GetCategory("Vessel");
- this.HelpString = string.Empty;
+ this.HelpString = "Displays the available Intake Air.";
this.IsDefault = false;
}
--- a/KerbalEngineer/Flight/Readouts/Vessel/IntakeAirUsage.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/IntakeAirUsage.cs
@@ -42,7 +42,7 @@
{
this.Name = "Intake Air (Usage)";
this.Category = ReadoutCategory.GetCategory("Vessel");
- this.HelpString = string.Empty;
+ this.HelpString = "Displays the consumption of Intake Air.";
this.IsDefault = true;
}
--- a/KerbalEngineer/Flight/Readouts/Vessel/Mass.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/Mass.cs
@@ -28,19 +28,13 @@
{
public class Mass : ReadoutModule
{
- #region Fields
-
- private bool showing;
-
- #endregion
-
#region Constructors
public Mass()
{
this.Name = "Mass";
this.Category = ReadoutCategory.GetCategory("Vessel");
- this.HelpString = string.Empty;
+ this.HelpString = "Displays the total Mass of the Vessel.";
this.IsDefault = true;
}
--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Vessel/Name.cs
@@ -1,1 +1,55 @@
+//
+// Kerbal Engineer Redux
+//
+// Copyright (C) 2014 CYBUTEK
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+#region Using Directives
+
+using KerbalEngineer.Flight.Sections;
+using KerbalEngineer.Helpers;
+
+#endregion
+
+namespace KerbalEngineer.Flight.Readouts.Vessel
+{
+ public class Name : ReadoutModule
+ {
+ #region Constructors
+
+ public Name()
+ {
+ Name = "Name";
+ Category = ReadoutCategory.GetCategory("Vessel");
+ HelpString = "Displays the name of the current vessel.";
+ IsDefault = true;
+ }
+
+ #endregion
+
+ #region Methods: public
+
+ public override void Draw(SectionModule section)
+ {
+ if (SimulationProcessor.ShowDetails)
+ {
+ DrawLine(FlightGlobals.ActiveVessel.vesselName);
+ }
+ }
+
+ #endregion
+ }
+}
--- a/KerbalEngineer/Flight/Readouts/Vessel/PartCount.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/PartCount.cs
@@ -34,7 +34,7 @@
{
this.Name = "Part Count";
this.Category = ReadoutCategory.GetCategory("Vessel");
- this.HelpString = string.Empty;
+ this.HelpString = "Shows the total number of Parts the current and next stage.";
this.IsDefault = true;
}
--- a/KerbalEngineer/Flight/Readouts/Vessel/Pitch.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/Pitch.cs
@@ -34,7 +34,7 @@
{
this.Name = "Pitch";
this.Category = ReadoutCategory.GetCategory("Vessel");
- this.HelpString = string.Empty;
+ this.HelpString = "Shows the current Pitch angle.";
this.IsDefault = false;
}
--- a/KerbalEngineer/Flight/Readouts/Vessel/PitchRate.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/PitchRate.cs
@@ -34,7 +34,7 @@
{
this.Name = "Pitch Rate";
this.Category = ReadoutCategory.GetCategory("Vessel");
- this.HelpString = string.Empty;
+ this.HelpString = "Shows the current Pitch speed.";
this.IsDefault = false;
}
--- a/KerbalEngineer/Flight/Readouts/Vessel/Roll.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/Roll.cs
@@ -34,7 +34,7 @@
{
this.Name = "Roll";
this.Category = ReadoutCategory.GetCategory("Vessel");
- this.HelpString = string.Empty;
+ this.HelpString = "Shows the current Roll angle.";
this.IsDefault = false;
}
--- a/KerbalEngineer/Flight/Readouts/Vessel/RollRate.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/RollRate.cs
@@ -34,7 +34,7 @@
{
this.Name = "Roll Rate";
this.Category = ReadoutCategory.GetCategory("Vessel");
- this.HelpString = string.Empty;
+ this.HelpString = "Shows the current Roll speed.";
this.IsDefault = false;
}
--- a/KerbalEngineer/Flight/Readouts/Vessel/SpecificImpulse.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/SpecificImpulse.cs
@@ -33,7 +33,7 @@
{
this.Name = "Specific Impulse";
this.Category = ReadoutCategory.GetCategory("Vessel");
- this.HelpString = string.Empty;
+ this.HelpString = "Shows the average Specific Impulse of all engines in the current stage.";
this.IsDefault = false;
}
--- a/KerbalEngineer/Flight/Readouts/Vessel/Thrust.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/Thrust.cs
@@ -34,7 +34,7 @@
{
this.Name = "Thrust";
this.Category = ReadoutCategory.GetCategory("Vessel");
- this.HelpString = string.Empty;
+ this.HelpString = "Shows the current and maximum thrust the vessel can put out.";
this.IsDefault = true;
}
--- a/KerbalEngineer/Flight/Sections/SectionEditor.cs
+++ b/KerbalEngineer/Flight/Sections/SectionEditor.cs
@@ -215,15 +215,18 @@
this.ParentSection.Name = GUILayout.TextField(this.ParentSection.Name, this.textStyle);
var isShowingInControlBar = !string.IsNullOrEmpty(this.ParentSection.Abbreviation);
this.ParentSection.Abbreviation = GUILayout.TextField(this.ParentSection.Abbreviation, this.textStyle, GUILayout.Width(75.0f));
+
+ ParentSection.IsHud = GUILayout.Toggle(this.ParentSection.IsHud, "HUD", this.readoutButtonStyle, GUILayout.Width(50.0f));
+ if (ParentSection.IsHud)
+ {
+ this.ParentSection.IsHudBackground = GUILayout.Toggle(this.ParentSection.IsHudBackground, "BG", this.readoutButtonStyle, GUILayout.Width(50.0f));
+ }
+
if (this.ParentSection.IsCustom)
{
if (isShowingInControlBar && string.IsNullOrEmpty(this.ParentSection.Abbreviation))
{
DisplayStack.Instance.RequestResize();
- }
- if (this.ParentSection.IsHud = GUILayout.Toggle(this.ParentSection.IsHud, "HUD", this.readoutButtonStyle, GUILayout.Width(50.0f)))
- {
- this.ParentSection.IsHudBackground = GUILayout.Toggle(this.ParentSection.IsHudBackground, "BG", this.readoutButtonStyle, GUILayout.Width(50.0f));
}
if (GUILayout.Button("DELETE SECTION", this.readoutButtonStyle, GUILayout.Width(150.0f)))
--- a/KerbalEngineer/Flight/Sections/SectionLibrary.cs
+++ b/KerbalEngineer/Flight/Sections/SectionLibrary.cs
@@ -1,7 +1,7 @@
//
// Kerbal Engineer Redux
//
-// Copyright (C) 2014 CYBUTEK
+// Copyright (C) 2015 CYBUTEK
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -19,22 +19,19 @@
#region Using Directives
-using System.Collections.Generic;
-using System.Linq;
-
-using KerbalEngineer.Flight.Readouts;
-using KerbalEngineer.Settings;
-
-using UnityEngine;
-
#endregion
namespace KerbalEngineer.Flight.Sections
{
+ using System.Collections.Generic;
+ using System.Linq;
+ using Readouts;
+ using Settings;
+ using UnityEngine;
+
public static class SectionLibrary
{
#region Constructors
-
/// <summary>
/// Sets up and populates the library with the stock sections on creation.
/// </summary>
@@ -71,7 +68,15 @@
ReadoutModules = ReadoutLibrary.GetCategory(ReadoutCategory.GetCategory("Rendezvous")).Where(r => r.IsDefault).ToList()
});
- var hud1 = new SectionModule
+ CustomSections.Add(new SectionModule
+ {
+ Name = "THERMAL",
+ Abbreviation = "HEAT",
+ ReadoutModules = ReadoutLibrary.GetCategory(ReadoutCategory.GetCategory("Thermal")).Where(r => r.IsDefault).ToList(),
+ IsCustom = true
+ });
+
+ SectionModule hud1 = new SectionModule
{
Name = "HUD 1",
Abbreviation = "HUD 1",
@@ -90,7 +95,7 @@
hud1.IsHud = true;
CustomSections.Add(hud1);
- var hud2 = new SectionModule
+ SectionModule hud2 = new SectionModule
{
Name = "HUD 2",
Abbreviation = "HUD 2",
@@ -101,7 +106,8 @@
ReadoutLibrary.GetReadout("AltitudeTerrain"),
ReadoutLibrary.GetReadout("VerticalSpeed"),
ReadoutLibrary.GetReadout("HorizontalSpeed"),
- ReadoutLibrary.GetReadout("Biome")
+ ReadoutLibrary.GetReadout("Biome"),
+ ReadoutLibrary.GetReadout("MachNumber")
},
};
hud2.FloatingPositionX = Screen.width * 0.75f - (hud2.ReadoutModules.First().ContentWidth * 0.5f);
@@ -109,11 +115,9 @@
hud2.IsHud = true;
CustomSections.Add(hud2);
}
-
#endregion
#region Properties
-
/// <summary>
/// Gets and sets a list of custom sections.
/// </summary>
@@ -133,13 +137,11 @@
/// Gets and sets a list of stock sections
/// </summary>
public static List<SectionModule> StockSections { get; set; }
-
#endregion
#region Updating
#region Methods: public
-
/// <summary>
/// Fixed update all of the sections.
/// </summary>
@@ -160,17 +162,15 @@
UpdateSections(StockSections);
UpdateSections(CustomSections);
}
-
#endregion
#region Methods: private
-
/// <summary>
/// Fixed updates a list of sections.
/// </summary>
private static void FixedUpdateSections(IEnumerable<SectionModule> sections)
{
- foreach (var section in sections)
+ foreach (SectionModule section in sections)
{
if (section.IsVisible)
{
@@ -184,13 +184,13 @@
/// </summary>
private static void UpdateSections(IEnumerable<SectionModule> sections)
{
- foreach (var section in sections)
+ foreach (SectionModule section in sections)
{
if (section.IsVisible)
{
if (!section.IsFloating)
{
- foreach (var readout in section.ReadoutModules)
+ foreach (ReadoutModule readout in section.ReadoutModules)
{
if (readout.ResizeRequested)
{
@@ -203,7 +203,7 @@
}
else
{
- foreach (var readout in section.ReadoutModules)
+ foreach (ReadoutModule readout in section.ReadoutModules)
{
if (readout.ResizeRequested)
{
@@ -218,13 +218,11 @@
NumberOfSections++;
}
}
-
#endregion
#endregion
#region Saving and Loading
-
/// <summary>
/// Loads the state of all stored sections.
/// </summary>
@@ -243,11 +241,11 @@
}
});
- var handler = SettingHandler.Load("SectionLibrary.xml", new[] {typeof(List<SectionModule>)});
+ SettingHandler handler = SettingHandler.Load("SectionLibrary.xml", new[] { typeof(List<SectionModule>) });
StockSections = handler.Get("StockSections", StockSections);
CustomSections = handler.Get("CustomSections", CustomSections);
- foreach (var section in GetAllSections())
+ foreach (SectionModule section in GetAllSections())
{
section.ClearNullReadouts();
}
@@ -258,22 +256,20 @@
/// </summary>
public static void Save()
{
- var handler = new SettingHandler();
+ SettingHandler handler = new SettingHandler();
handler.Set("StockSections", StockSections);
handler.Set("CustomSections", CustomSections);
handler.Save("SectionLibrary.xml");
}
-
#endregion
#region Methods
-
/// <summary>
/// Gets a list containing all section modules.
/// </summary>
public static List<SectionModule> GetAllSections()
{
- var sections = new List<SectionModule>();
+ List<SectionModule> sections = new List<SectionModule>();
sections.AddRange(StockSections);
sections.AddRange(CustomSections);
return sections;
@@ -326,7 +322,6 @@
{
return StockSections.Remove(GetStockSection(name));
}
-
#endregion
}
}
--- a/KerbalEngineer/Flight/Sections/SectionWindow.cs
+++ b/KerbalEngineer/Flight/Sections/SectionWindow.cs
@@ -134,7 +134,11 @@
(!this.ParentSection.IsHud || this.ParentSection.IsEditorVisible) ? this.windowStyle
: this.ParentSection.IsHudBackground && this.ParentSection.LineCount > 0
? this.hudWindowBgStyle
- : this.hudWindowStyle).ClampToScreen();
+ : this.hudWindowStyle);
+
+ windowPosition = (ParentSection.IsHud) ? windowPosition.ClampInsideScreen() : windowPosition.ClampToScreen();
+
+
this.ParentSection.FloatingPositionX = this.windowPosition.x;
this.ParentSection.FloatingPositionY = this.windowPosition.y;
}
--- a/KerbalEngineer/Helpers/TimeFormatter.cs
+++ b/KerbalEngineer/Helpers/TimeFormatter.cs
@@ -1,7 +1,5 @@
//
-// Kerbal Engineer Redux
-//
-// Copyright (C) 2014 CYBUTEK
+// Copyright (C) 2015 CYBUTEK
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -17,147 +15,46 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
-#region Using Directives
-
-using System;
-
-using KerbalEngineer.Settings;
-
-#endregion
-
namespace KerbalEngineer.Helpers
{
public static class TimeFormatter
{
- #region Constructors
-
- static TimeFormatter()
- {
- SetReference(false);
- Load();
- }
-
- #endregion
-
- #region Properties
-
- public static string Reference { get; set; }
-
- public static double SecondsPerDay { get; set; }
-
- public static double SecondsPerHour { get; set; }
-
- public static double SecondsPerMinute { get; set; }
-
- public static double SecondsPerYear { get; set; }
-
- #endregion
-
- #region Methods: public
-
public static string ConvertToString(double seconds, string format = "F1")
{
- var years = 0;
- while (seconds >= SecondsPerYear)
+ int years = 0;
+ int days = 0;
+ int hours = 0;
+ int minutes = 0;
+
+ if (seconds > 0.0)
{
- years++;
- seconds -= SecondsPerYear;
- }
+ years = (int)(seconds / KSPUtil.Year);
+ seconds -= years * KSPUtil.Year;
- var days = 0;
- while (seconds >= SecondsPerDay)
- {
- days++;
- seconds -= SecondsPerDay;
- }
+ days = (int)(seconds / KSPUtil.Day);
+ seconds -= days * KSPUtil.Day;
- var hours = 0;
- while (seconds >= SecondsPerHour)
- {
- hours++;
- seconds -= SecondsPerHour;
- }
+ hours = (int)(seconds / 3600.0);
+ seconds -= hours * 3600.0;
- var minutes = 0;
- while (seconds >= SecondsPerMinute)
- {
- minutes++;
- seconds -= SecondsPerMinute;
+ minutes = (int)(seconds / 60.0);
+ seconds -= minutes * 60.0;
}
if (years > 0)
{
- return String.Format("{0}y {1}d {2}h {3}m {4}s", years, days, hours, minutes, seconds.ToString(format));
+ return string.Format("{0}y {1}d {2}h {3}m {4}s", years, days, hours, minutes, seconds.ToString(format));
}
if (days > 0)
{
- return String.Format("{0}d {1}h {2}m {3}s", days, hours, minutes, seconds.ToString(format));
+ return string.Format("{0}d {1}h {2}m {3}s", days, hours, minutes, seconds.ToString(format));
}
if (hours > 0)
{
- return String.Format("{0}h {1}m {2}s", hours, minutes, seconds.ToString(format));
+ return string.Format("{0}h {1}m {2}s", hours, minutes, seconds.ToString(format));
}
- return minutes > 0 ? String.Format("{0}m {1}s", minutes, seconds.ToString(format)) : String.Format("{0}s", seconds.ToString(format));
+ return minutes > 0 ? string.Format("{0}m {1}s", minutes, seconds.ToString(format)) : string.Format("{0}s", seconds.ToString(format));
}
-
- public static void Load()
- {
- var handler = SettingHandler.Load("TimeFormatter.xml");
- SecondsPerMinute = handler.Get("SecondsPerMinute", SecondsPerMinute);
- SecondsPerHour = handler.Get("SecondsPerHour", SecondsPerHour);
- SecondsPerDay = handler.Get("SecondsPerDay", SecondsPerDay);
- SecondsPerYear = handler.Get("SecondsPerYear", SecondsPerYear);
- Reference = handler.Get("Reference", Reference);
- }
-
- public static void Save()
- {
- var handler = SettingHandler.Load("TimeFormatter.xml");
- handler.Set("SecondsPerMinute", SecondsPerMinute);
- handler.Set("SecondsPerHour", SecondsPerHour);
- handler.Set("SecondsPerDay", SecondsPerDay);
- handler.Set("SecondsPerYear", SecondsPerYear);
- handler.Set("Reference", Reference);
- handler.Save("TimeFormatter.xml");
- }
-
- public static void SetReference(bool save = true)
- {
- const double minute = 60.0;
- const double hour = minute * 60.0;
- const double day = hour * 24.0;
- const double year = day * 365.0;
- SetReference(minute, hour, day, year, "Earth", save);
- }
-
- public static void SetReference(CelestialBody body, bool save = true)
- {
- SetReference(SecondsPerMinute, SecondsPerHour, body.rotationPeriod, body.orbit.period, body.bodyName, save);
- }
-
- public static void SetReference(double minute, double hour, double day, double year, string reference, bool save = true)
- {
- SecondsPerMinute = minute;
- SecondsPerHour = hour;
- SecondsPerDay = day;
- SecondsPerYear = year;
- Reference = reference;
-
- if (save)
- {
- Save();
- }
- }
-
- public new static string ToString()
- {
- return String.Format("SecondsPerMinute: {0}", SecondsPerMinute) + Environment.NewLine +
- String.Format("SecondsPerHour: {0}", SecondsPerHour) + Environment.NewLine +
- String.Format("SecondsPerDay: {0}", SecondsPerDay) + Environment.NewLine +
- String.Format("SecondsPerYear: {0}", SecondsPerYear) + Environment.NewLine;
- }
-
- #endregion
}
}
--- a/KerbalEngineer/Helpers/Units.cs
+++ b/KerbalEngineer/Helpers/Units.cs
@@ -1,7 +1,7 @@
//
// Kerbal Engineer Redux
//
-// Copyright (C) 2014 CYBUTEK
+// Copyright (C) 2015 CYBUTEK
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -19,15 +19,13 @@
namespace KerbalEngineer.Helpers
{
- #region Using Directives
using System;
-
- #endregion
public static class Units
{
- #region Methods
public const double GRAVITY = 9.80665;
+ public const double RAD_TO_DEG = 180.0 / Math.PI;
+ public const double DEG_TO_RAD = Math.PI / 180.0;
public static string Concat(int value1, int value2)
{
@@ -95,7 +93,7 @@
int min = (int)Math.Floor(rem * 60);
rem -= ((double)min / 60);
int sec = (int)Math.Floor(rem * 3600);
- return String.Format("{0:0}° {1:00}' {2:00}\"", deg, min, sec);
+ return string.Format("{0:0}° {1:00}' {2:00}\"", deg, min, sec);
}
public static string ToDistance(double value, int decimals = 1)
@@ -127,16 +125,26 @@
return value.ToString("N" + decimals) + "Mm";
}
+ public static string ToFlux(double value)
+ {
+ return value.ToString("#,0.00") + "W";
+ }
+
public static string ToForce(double value)
{
- return value.ToString((value < 100000.0) ? (value < 10000.0) ? (value < 100.0) ? (Math.Abs(value) < Double.Epsilon) ? "N0" : "N3" : "N2" : "N1" : "N0") + "kN";
+ return value.ToString((value < 100000.0) ? (value < 10000.0) ? (value < 100.0) ? (Math.Abs(value) < double.Epsilon) ? "N0" : "N3" : "N2" : "N1" : "N0") + "kN";
}
public static string ToForce(double value1, double value2)
{
- string format1 = (value1 < 100000.0) ? (value1 < 10000.0) ? (value1 < 100.0) ? (Math.Abs(value1) < Double.Epsilon) ? "N0" : "N3" : "N2" : "N1" : "N0";
- string format2 = (value2 < 100000.0) ? (value2 < 10000.0) ? (value2 < 100.0) ? (Math.Abs(value2) < Double.Epsilon) ? "N0" : "N3" : "N2" : "N1" : "N0";
+ string format1 = (value1 < 100000.0) ? (value1 < 10000.0) ? (value1 < 100.0) ? (Math.Abs(value1) < double.Epsilon) ? "N0" : "N3" : "N2" : "N1" : "N0";
+ string format2 = (value2 < 100000.0) ? (value2 < 10000.0) ? (value2 < 100.0) ? (Math.Abs(value2) < double.Epsilon) ? "N0" : "N3" : "N2" : "N1" : "N0";
return value1.ToString(format1) + " / " + value2.ToString(format2) + "kN";
+ }
+
+ public static string ToMach(double value)
+ {
+ return value.ToString("0.00") + "Ma";
}
public static string ToMass(double value, int decimals = 0)
@@ -182,6 +190,16 @@
return value.ToString("N" + decimals) + "m/s";
}
+ public static string ToTemperature(double value)
+ {
+ return value.ToString("#,0") + "K";
+ }
+
+ public static string ToTemperature(double value1, double value2)
+ {
+ return value1.ToString("#,0") + " / " + value2.ToString("#,0") + "K";
+ }
+
public static string ToTime(double value)
{
return TimeFormatter.ConvertToString(value);
@@ -189,8 +207,7 @@
public static string ToTorque(double value)
{
- return value.ToString((value < 100.0) ? (Math.Abs(value) < Double.Epsilon) ? "N0" : "N1" : "N0") + "kNm";
- }
- #endregion
+ return value.ToString((value < 100.0) ? (Math.Abs(value) < double.Epsilon) ? "N0" : "N2" : "N0") + "kNm";
+ }
}
}
--- /dev/null
+++ b/KerbalEngineer/Helpers/XmlHelper.cs
@@ -1,1 +1,67 @@
+namespace KerbalEngineer.Helpers
+{
+ using System;
+ using System.IO;
+ using System.Text;
+ using System.Xml.Serialization;
+ public static class XmlHelper
+ {
+ /// <summary>
+ /// Loads an object from disk.
+ /// </summary>
+ public static T LoadObject<T>(string path)
+ {
+ T obj = default(T);
+
+ if (File.Exists(path))
+ {
+ try
+ {
+ using (StreamReader stream = new StreamReader(path, Encoding.UTF8))
+ {
+ obj = (T)new XmlSerializer(typeof(T)).Deserialize(stream);
+ }
+ }
+ catch (Exception ex)
+ {
+ Logger.Exception(ex);
+ }
+ }
+
+ return obj;
+ }
+
+ /// <summary>
+ /// Loads and object from disk.
+ /// </summary>
+ public static bool LoadObject<T>(string path, out T obj)
+ {
+ obj = LoadObject<T>(path);
+ return (obj != null);
+ }
+
+ /// <summary>
+ /// Saves an object to disk.
+ /// </summary>
+ public static void SaveObject<T>(string path, T obj)
+ {
+ if (obj == null || string.IsNullOrEmpty(path))
+ {
+ return;
+ }
+
+ try
+ {
+ using (StreamWriter stream = new StreamWriter(path, false, Encoding.UTF8))
+ {
+ new XmlSerializer(typeof(T)).Serialize(stream, obj);
+ }
+ }
+ catch (Exception ex)
+ {
+ Logger.Exception(ex);
+ }
+ }
+ }
+}
--- a/KerbalEngineer/KerbalEngineer.csproj
+++ b/KerbalEngineer/KerbalEngineer.csproj
@@ -48,11 +48,11 @@
<Compile Include="Editor\ResourceInfoItem.cs" />
<Compile Include="Extensions\FloatExtensions.cs" />
<Compile Include="Extensions\OrbitExtensions.cs" />
+ <Compile Include="Extensions\StringExtensions.cs" />
<Compile Include="Flight\ActionMenuGui.cs" />
<Compile Include="Flight\Presets\Preset.cs" />
<Compile Include="Flight\Readouts\Miscellaneous\SystemTime.cs" />
<Compile Include="Flight\Readouts\Miscellaneous\VectoredThrustToggle.cs" />
- <Compile Include="Flight\Readouts\Miscellaneous\TimeReference.cs" />
<Compile Include="Flight\Readouts\Miscellaneous\Separator.cs" />
<Compile Include="Flight\Readouts\Miscellaneous\GuiSizeAdjustor.cs" />
<Compile Include="Flight\Readouts\Orbital\AngleToEquatorialDescendingNode.cs" />
@@ -70,11 +70,21 @@
<Compile Include="Flight\Readouts\Orbital\ManoeuvreNode\NodeAngleToPrograde.cs" />
<Compile Include="Flight\Readouts\Orbital\ManoeuvreNode\NodeTotalDeltaV.cs" />
<Compile Include="Flight\Readouts\Orbital\ManoeuvreNode\NodeProgradeDeltaV.cs" />
+ <Compile Include="Flight\Readouts\Orbital\ManoeuvreNode\PostBurnApoapsis.cs" />
+ <Compile Include="Flight\Readouts\Orbital\ManoeuvreNode\PostBurnPeriapsis.cs" />
<Compile Include="Flight\Readouts\Orbital\MeanAnomalyAtEpoc.cs" />
<Compile Include="Flight\Readouts\Orbital\MeanAnomaly.cs" />
<Compile Include="Flight\Readouts\Orbital\EccentricAnomaly.cs" />
<Compile Include="Flight\Readouts\Orbital\ArgumentOfPeriapsis.cs" />
<Compile Include="Flight\Readouts\Orbital\CurrentSoi.cs" />
+ <Compile Include="Flight\Readouts\Orbital\SemiMajorAxis.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="Flight\Readouts\Orbital\SpeedAtApoapsis.cs" />
+ <Compile Include="Flight\Readouts\Orbital\SpeedAtPeriapsis.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="Flight\Readouts\Orbital\TimeToAtmosphere.cs" />
<Compile Include="Flight\Readouts\Orbital\TrueAnomaly.cs" />
<Compile Include="Flight\Readouts\Orbital\TimeToEquatorialAscendingNode.cs" />
<Compile Include="Flight\Readouts\Orbital\TimeToEquatorialDescendingNode.cs" />
@@ -89,6 +99,22 @@
<Compile Include="Flight\Readouts\Surface\Biome.cs" />
<Compile Include="Flight\Readouts\Surface\HorizontalAcceleration.cs" />
<Compile Include="Flight\Readouts\Surface\VerticalAcceleration.cs" />
+ <Compile Include="Flight\Readouts\Surface\MachNumber.cs" />
+ <Compile Include="Flight\Readouts\Thermal\CoolestSkinTemperature.cs" />
+ <Compile Include="Flight\Readouts\Thermal\CriticalPart.cs" />
+ <Compile Include="Flight\Readouts\Thermal\CoolestPart.cs" />
+ <Compile Include="Flight\Readouts\Thermal\CoolestTemperature.cs" />
+ <Compile Include="Flight\Readouts\Thermal\CriticalThermalPercentage.cs" />
+ <Compile Include="Flight\Readouts\Thermal\CriticalSkinTemperature.cs" />
+ <Compile Include="Flight\Readouts\Thermal\CriticalTemperature.cs" />
+ <Compile Include="Flight\Readouts\Thermal\HottestSkinTemperature.cs" />
+ <Compile Include="Flight\Readouts\Thermal\InternalFlux.cs" />
+ <Compile Include="Flight\Readouts\Thermal\RadiationFlux.cs" />
+ <Compile Include="Flight\Readouts\Thermal\ConvectionFlux.cs" />
+ <Compile Include="Flight\Readouts\Thermal\HottestTemperature.cs" />
+ <Compile Include="Flight\Readouts\Thermal\HottestPart.cs" />
+ <Compile Include="Flight\Readouts\Thermal\ThermalProcessor.cs" />
+ <Compile Include="Flight\Readouts\Vessel\Name.cs" />
<Compile Include="Flight\Readouts\Vessel\AttitudeProcessor.cs" />
<Compile Include="Flight\Readouts\Vessel\DeltaVCurrentTotal.cs" />
<Compile Include="Flight\Readouts\Vessel\PitchRate.cs" />
@@ -122,8 +148,10 @@
<Compile Include="Helpers\TextureHelper.cs" />
<Compile Include="Helpers\Units.cs" />
<Compile Include="Helpers\TimeFormatter.cs" />
- <Compile Include="KeyBinder.cs" />
+ <Compile Include="Helpers\XmlHelper.cs" />
+ <Compile Include="KeyBinding\KeyBinder.cs" />
<Compile Include="Control\ControlCentre.cs" />
+ <Compile Include="KeyBinding\KeyBindingsObject.cs" />
<Compile Include="UIControls\DropDown.cs" />
<Compile Include="Logger.cs" />
<Compile Include="EngineerGlobals.cs" />
@@ -145,7 +173,6 @@
<Compile Include="Flight\Readouts\Orbital\OrbitalPeriod.cs" />
<Compile Include="Flight\Readouts\Orbital\OrbitalSpeed.cs" />
<Compile Include="Flight\Readouts\Orbital\PeriapsisHeight.cs" />
- <Compile Include="Flight\Readouts\Orbital\SemiMajorAxis.cs" />
<Compile Include="Flight\Readouts\Orbital\SemiMinorAxis.cs" />
<Compile Include="Flight\Readouts\Orbital\TimeToApoapsis.cs" />
<Compile Include="Flight\Readouts\Orbital\TimeToPeriapsis.cs" />
@@ -196,6 +223,7 @@
<Compile Include="Settings\SettingHandler.cs" />
<Compile Include="Settings\SettingItem.cs" />
<Compile Include="TapeDriveAnimator.cs" />
+ <Compile Include="KeyBinding\KeyBindPopup.cs" />
<Compile Include="UIControls\WindowObject.cs" />
<Compile Include="VesselSimulator\AttachNodeSim.cs" />
<Compile Include="VesselSimulator\EngineSim.cs" />
@@ -205,10 +233,13 @@
<Compile Include="VesselSimulator\SimManager.cs" />
<Compile Include="VesselSimulator\Simulation.cs" />
<Compile Include="VesselSimulator\Stage.cs" />
+ <Compile Include="Flight\Readouts\Rendezvous\RelativeRadialVelocity.cs" />
+ <Compile Include="Flight\Readouts\Rendezvous\TimeToRendezvous.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="Assembly-CSharp">
- <HintPath>..\Game\KSP_Data\Managed\Assembly-CSharp.dll</HintPath>
+ <HintPath>..\..\Game\KSP_Data\Managed\Assembly-CSharp.dll</HintPath>
+ <Private>False</Private>
</Reference>
<Reference Include="System">
<HintPath>..\Game\KSP_Data\Managed\System.dll</HintPath>
@@ -219,7 +250,8 @@
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine">
- <HintPath>..\Game\KSP_Data\Managed\UnityEngine.dll</HintPath>
+ <HintPath>..\..\Game\KSP_Data\Managed\UnityEngine.dll</HintPath>
+ <Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup />
@@ -237,7 +269,7 @@
$(PostBuildEventDependsOn);
PostBuildMacros;
</PostBuildEventDependsOn>
- <PostBuildEvent>xcopy "$(SolutionDir)Output\*" "$(SolutionDir)Game\GameData\*" /E /Y
+ <PostBuildEvent>xcopy "$(SolutionDir)Output\*" "$(SolutionDir)..\Game\GameData\*" /E /Y
del "$(SolutionDir)Release\*" /Q
xcopy "$(SolutionDir)Documents\*" "$(SolutionDir)Release\Documents\*" /E /Y
7z.exe a -tzip -mx3 "$(SolutionDir)Release\$(ProjectName)-@(VersionNumber).zip" "$(SolutionDir)Output\*"
--- a/KerbalEngineer/KeyBinder.cs
+++ /dev/null
@@ -1,35 +1,1 @@
-//
-// Kerbal Engineer Redux
-//
-// Copyright (C) 2014 CYBUTEK
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-//
-using UnityEngine;
-
-namespace KerbalEngineer
-{
- public class KeyBinder
- {
- public static KeyCode EditorShowHide { get; set; }
-
- public static KeyCode FlightShowHide { get; set; }
-
- static KeyBinder()
- {
- EditorShowHide = FlightShowHide = KeyCode.Backslash;
- }
- }
-}
--- /dev/null
+++ b/KerbalEngineer/KeyBinding/KeyBindPopup.cs
@@ -1,1 +1,243 @@
-
+//
+// Kerbal Engineer Redux
+//
+// Copyright (C) 2015 CYBUTEK
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+
+namespace KerbalEngineer.KeyBinding
+{
+ using System;
+ using Extensions;
+ using UnityEngine;
+
+ public class KeyBindPopup : MonoBehaviour
+ {
+ private const string LOCK_ID = "KER_KeyBindPopup";
+ private static Rect position = new Rect(Screen.width, Screen.height, 250.0f, 0.0f);
+ private static bool hasCentred;
+ private static KeyBindPopup instance;
+ private readonly Array availableBindings = Enum.GetValues(typeof(KeyCode));
+
+ /// <summary>
+ /// Gets the delegate to be invoked when accepted button is clicked.
+ /// </summary>
+ public Action<KeyCode> AcceptClicked { get; private set; }
+
+ /// <summary>
+ /// Gets the name of the binding to change.
+ /// </summary>
+ public string Name { get; private set; }
+
+ /// <summary>
+ /// Gets the selected binding.
+ /// </summary>
+ public KeyCode Binding { get; private set; }
+
+ /// <summary>
+ /// Gets whether a key bind popup is already open.
+ /// </summary>
+ public static bool IsOpen
+ {
+ get
+ {
+ return (instance != null);
+ }
+ }
+
+ /// <summary>
+ /// Gets and sets the input lock state.
+ /// </summary>
+ public bool InputLock
+ {
+ get
+ {
+ return InputLockManager.GetControlLock(LOCK_ID) != ControlTypes.None;
+ }
+ set
+ {
+ if (value)
+ {
+ InputLockManager.SetControlLock(ControlTypes.All, LOCK_ID);
+ }
+ else
+ {
+ InputLockManager.SetControlLock(ControlTypes.None, LOCK_ID);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Shows a key bind popup allowing the user to select a key for binding.
+ /// </summary>
+ public static void Show(string name, KeyCode currentBinding, Action<KeyCode> acceptClicked)
+ {
+ if (instance == null)
+ {
+ instance = new GameObject("SelectKeyBind").AddComponent<KeyBindPopup>();
+ }
+
+ instance.Name = name;
+ instance.Binding = currentBinding;
+ instance.AcceptClicked = acceptClicked;
+ }
+
+ /// <summary>
+ /// Handles the accept button click event.
+ /// </summary>
+ public void OnAccept()
+ {
+ if (AcceptClicked != null)
+ {
+ AcceptClicked.Invoke(Binding);
+ }
+ Destroy(gameObject);
+ }
+
+ /// <summary>
+ /// Handles the cancel button click event.
+ /// </summary>
+ public void OnCancel()
+ {
+ Destroy(gameObject);
+ }
+
+ /// <summary>
+ /// Called by unity when the component is created.
+ /// </summary>
+ protected virtual void Awake()
+ {
+ if (instance == null)
+ {
+ instance = this;
+ }
+ else if (instance != this)
+ {
+ OnCancel();
+ }
+ }
+
+ /// <summary>
+ /// Called by unity when the component is destroyed.
+ /// </summary>
+ protected virtual void OnDestroy()
+ {
+ InputLock = false;
+ }
+
+ /// <summary>
+ /// Called by unity each frame to render the GUI.
+ /// </summary>
+ protected virtual void OnGUI()
+ {
+ position = GUILayout.Window(GetInstanceID(), position, RenderWindow, "Select Key Bind", HighLogic.Skin.window).ClampToScreen();
+ CentreWindow();
+ }
+
+ /// <summary>
+ /// Called by unity every frame.
+ /// </summary>
+ protected virtual void Update()
+ {
+ CentreWindow();
+ UpdateBinding();
+ UpdateInputLock();
+ }
+
+ /// <summary>
+ /// Centres the window on the screen.
+ /// </summary>
+ private static void CentreWindow()
+ {
+ if (hasCentred == false && position.width > 0.0f && position.height > 0.0f)
+ {
+ hasCentred = true;
+ position.center = new Vector2(Screen.width * 0.5f, Screen.height * 0.5f);
+ }
+ }
+
+ /// <summary>
+ /// Renders the window content.
+ /// </summary>
+ private void RenderWindow(int id)
+ {
+ GUILayout.Label("Press the desired key to change it.");
+
+ // Binding labels.
+ GUILayout.BeginVertical(HighLogic.Skin.textArea);
+ GUILayout.Label("Key Bind: " + Name);
+ GUILayout.Label("Selected: " + Binding);
+ GUILayout.EndVertical();
+
+ // Window buttons.
+ GUILayout.BeginHorizontal();
+ if (GUILayout.Button("Cancel", HighLogic.Skin.button))
+ {
+ OnCancel();
+ }
+
+ if (GUILayout.Button("Accept", HighLogic.Skin.button))
+ {
+ OnAccept();
+ }
+ GUILayout.EndHorizontal();
+
+ // Make the window to be draggable.
+ GUI.DragWindow();
+ }
+
+ /// <summary>
+ /// Updates the binding selected by the user.
+ /// </summary>
+ private void UpdateBinding()
+ {
+ for (int i = 0; i < availableBindings.Length; ++i)
+ {
+ KeyCode keyCode = (KeyCode)availableBindings.GetValue(i);
+
+ if (keyCode == KeyCode.Mouse0)
+ {
+ continue;
+ }
+
+ if (Input.GetKeyDown(keyCode))
+ {
+ if (Input.GetKeyDown(keyCode))
+ {
+ Binding = keyCode;
+ }
+ }
+ }
+ }
+
+ /// <summary>
+ /// Updates the input lock.
+ /// </summary>
+ private void UpdateInputLock()
+ {
+ bool mouseOver = position.MouseIsOver();
+ bool inputLock = InputLock;
+
+ if (mouseOver && inputLock == false)
+ {
+ InputLock = true;
+ }
+ else if (mouseOver == false && inputLock)
+ {
+ InputLock = false;
+ }
+ }
+ }
+}
--- /dev/null
+++ b/KerbalEngineer/KeyBinding/KeyBinder.cs
@@ -1,1 +1,255 @@
-
+//
+// Kerbal Engineer Redux
+//
+// Copyright (C) 2015 CYBUTEK
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+
+namespace KerbalEngineer.KeyBinding
+{
+ using System;
+ using System.IO;
+ using Extensions;
+ using Helpers;
+ using UnityEngine;
+
+ public class KeyBinder : MonoBehaviour
+ {
+ private const string LOCK_ID = "KER_KeyBinder";
+ private static readonly string filePath = Path.Combine(EngineerGlobals.SettingsPath, "KeyBinds.xml");
+ private static KeyBindingsObject bindings;
+ private static Rect position = new Rect(Screen.width, Screen.height, 500.0f, 0.0f);
+ private static bool hasCentred;
+
+ static KeyBinder()
+ {
+ Load();
+ }
+
+ /// <summary>
+ /// Gets whether the key binder window is open.
+ /// </summary>
+ public static bool IsOpen { get; private set; }
+
+ /// <summary>
+ /// Gets and sets the key bindings object.
+ /// </summary>
+ public static KeyBindingsObject Bindings
+ {
+ get
+ {
+ if (bindings == null)
+ {
+ bindings = new KeyBindingsObject();
+ }
+ return bindings;
+ }
+ private set
+ {
+ if (value != null)
+ {
+ bindings = value;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Gets and sets the editor show/hide binding.
+ /// </summary>
+ public static KeyCode EditorShowHide
+ {
+ get
+ {
+ return Bindings.EditorShowHide;
+ }
+ set
+ {
+ Bindings.EditorShowHide = value;
+ Save();
+ }
+ }
+
+ /// <summary>
+ /// Gets and sets the flight show/hide binding.
+ /// </summary>
+ public static KeyCode FlightShowHide
+ {
+ get
+ {
+ return Bindings.FlightShowHide;
+ }
+ set
+ {
+ Bindings.FlightShowHide = value;
+ Save();
+ }
+ }
+
+ /// <summary>
+ /// Gets and sets the input lock state.
+ /// </summary>
+ public bool InputLock
+ {
+ get
+ {
+ return InputLockManager.GetControlLock(LOCK_ID) != ControlTypes.None;
+ }
+ set
+ {
+ if (value)
+ {
+ InputLockManager.SetControlLock(ControlTypes.All, LOCK_ID);
+ }
+ else
+ {
+ InputLockManager.SetControlLock(ControlTypes.None, LOCK_ID);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Loads the key bindings from disk.
+ /// </summary>
+ public static void Load()
+ {
+ Bindings = XmlHelper.LoadObject<KeyBindingsObject>(filePath);
+ }
+
+ /// <summary>
+ /// Saves the key bindings to disk.
+ /// </summary>
+ public static void Save()
+ {
+ XmlHelper.SaveObject(filePath, Bindings);
+ }
+
+ /// <summary>
+ /// Shows the key binding window.
+ /// </summary>
+ public static void Show()
+ {
+ if (IsOpen)
+ {
+ return;
+ }
+
+ new GameObject("KeyBinder").AddComponent<KeyBinder>();
+ }
+
+ /// <summary>
+ /// Called by unity when component is created.
+ /// </summary>
+ protected virtual void Awake()
+ {
+ if (IsOpen)
+ {
+ Destroy(gameObject);
+ }
+ else
+ {
+ IsOpen = true;
+ position.height = 0.0f;
+ }
+ }
+
+ /// <summary>
+ /// Called by unity when component is destroyed.
+ /// </summary>
+ protected virtual void OnDestroy()
+ {
+ IsOpen = false;
+ InputLock = false;
+ }
+
+ /// <summary>
+ /// Called by unity to draw the GUI.
+ /// </summary>
+ protected virtual void OnGUI()
+ {
+ position = GUILayout.Window(GetInstanceID(), position, RenderWindow, "Kerbal Engineer Redux - Key Bindings", HighLogic.Skin.window).ClampToScreen();
+ CentreWindow();
+ }
+
+ /// <summary>
+ /// Called by unity every frame.
+ /// </summary>
+ protected virtual void Update()
+ {
+ UpdateInputLock();
+ }
+
+ /// <summary>
+ /// Renders a key bind option.
+ /// </summary>
+ private static void RenderKeyBind(string name, KeyCode currentBinding, Action<KeyCode> acceptClicked)
+ {
+ GUILayout.BeginHorizontal();
+ GUILayout.Label(name);
+ if (GUILayout.Button(currentBinding.ToString(), HighLogic.Skin.button, GUILayout.Width(100.0f)))
+ {
+ KeyBindPopup.Show(name, currentBinding, acceptClicked);
+ }
+ GUILayout.EndHorizontal();
+ }
+
+ /// <summary>
+ /// Centres the window on screen.
+ /// </summary>
+ private void CentreWindow()
+ {
+ if (hasCentred == false && position.width > 0.0f && position.height > 0.0f)
+ {
+ hasCentred = true;
+ position.center = new Vector2(Screen.width * 0.5f, Screen.height * 0.5f);
+ }
+ }
+
+ /// <summary>
+ /// Renders the GUI window contents.
+ /// </summary>
+ private void RenderWindow(int id)
+ {
+ GUILayout.BeginVertical(HighLogic.Skin.textArea);
+ RenderKeyBind("Editor Show/Hide", EditorShowHide, binding => EditorShowHide = binding);
+ RenderKeyBind("Flight Show/Hide", FlightShowHide, binding => FlightShowHide = binding);
+ GUILayout.EndVertical();
+
+ if (GUILayout.Button("Close", HighLogic.Skin.button))
+ {
+ Destroy(gameObject);
+ }
+
+ GUI.DragWindow();
+ }
+
+ /// <summary>
+ /// Updates the input lock.
+ /// </summary>
+ private void UpdateInputLock()
+ {
+ bool mouseOver = position.MouseIsOver();
+ bool inputLock = InputLock;
+
+ if (mouseOver && inputLock == false)
+ {
+ InputLock = true;
+ }
+ else if (mouseOver == false && inputLock)
+ {
+ InputLock = false;
+ }
+ }
+ }
+}
--- /dev/null
+++ b/KerbalEngineer/KeyBinding/KeyBindingsObject.cs
@@ -1,1 +1,31 @@
+//
+// Kerbal Engineer Redux
+//
+// Copyright (C) 2015 CYBUTEK
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+namespace KerbalEngineer.KeyBinding
+{
+ using System.Xml.Serialization;
+ using UnityEngine;
+
+ public class KeyBindingsObject
+ {
+ public KeyCode EditorShowHide { get; set; }
+
+ public KeyCode FlightShowHide { get; set; }
+ }
+}
--- a/KerbalEngineer/LogMsg.cs
+++ b/KerbalEngineer/LogMsg.cs
@@ -15,7 +15,8 @@
public void Flush()
{
- MonoBehaviour.print(this.buf);
+ if (this.buf.Length > 0)
+ MonoBehaviour.print(this.buf);
this.buf.Length = 0;
}
}
--- a/KerbalEngineer/Properties/AssemblyInfo.cs
+++ b/KerbalEngineer/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion(KerbalEngineer.EngineerGlobals.AssemblyVersion)]
+[assembly: AssemblyVersion(KerbalEngineer.EngineerGlobals.ASSEMBLY_VERSION)]
--- a/KerbalEngineer/VesselSimulator/EngineSim.cs
+++ b/KerbalEngineer/VesselSimulator/EngineSim.cs
@@ -273,14 +273,36 @@
HashSet<PartSim> visited = new HashSet<PartSim>();
+ public void DumpSourcePartSets(String msg)
+ {
+ MonoBehaviour.print("DumpSourcePartSets " + msg);
+ foreach (int type in sourcePartSets.Keys)
+ {
+ MonoBehaviour.print("SourcePartSet for " + ResourceContainer.GetResourceName(type));
+ HashSet<PartSim> sourcePartSet = sourcePartSets[type];
+ if (sourcePartSet.Count > 0)
+ {
+ foreach (PartSim partSim in sourcePartSet)
+ {
+ MonoBehaviour.print("Part " + partSim.name + ":" + partSim.partId);
+ }
+ }
+ else
+ {
+ MonoBehaviour.print("No parts");
+ }
+ }
+ }
+
public bool SetResourceDrains(List<PartSim> allParts, List<PartSim> allFuelLines, HashSet<PartSim> drainingParts)
{
LogMsg log = null;
-
+ //DumpSourcePartSets("before clear");
foreach (HashSet<PartSim> sourcePartSet in sourcePartSets.Values)
{
sourcePartSet.Clear();
}
+ //DumpSourcePartSets("after clear");
for (int index = 0; index < this.resourceConsumptions.Types.Count; index++)
{
@@ -305,6 +327,7 @@
break;
case ResourceFlowMode.ALL_VESSEL:
+ case ResourceFlowMode.ALL_VESSEL_BALANCE:
for (int i = 0; i < allParts.Count; i++)
{
PartSim aPartSim = allParts[i];
@@ -316,6 +339,7 @@
break;
case ResourceFlowMode.STAGE_PRIORITY_FLOW:
+ case ResourceFlowMode.STAGE_PRIORITY_FLOW_BALANCE:
foreach (HashSet<PartSim> stagePartSet in stagePartSets.Values)
{
@@ -338,25 +362,34 @@
maxStage = stage;
}
- if (!stagePartSets.TryGetValue(stage, out sourcePartSet))
+ HashSet<PartSim> tempPartSet;
+ if (!stagePartSets.TryGetValue(stage, out tempPartSet))
{
- sourcePartSet = new HashSet<PartSim>();
- stagePartSets.Add(stage, sourcePartSet);
+ tempPartSet = new HashSet<PartSim>();
+ stagePartSets.Add(stage, tempPartSet);
}
- sourcePartSet.Add(aPartSim);
- }
-
- for (int j = 0; j <= maxStage; j++)
+ tempPartSet.Add(aPartSim);
+ }
+
+ for (int j = maxStage; j >= 0; j--)
{
HashSet<PartSim> stagePartSet;
if (stagePartSets.TryGetValue(j, out stagePartSet) && stagePartSet.Count > 0)
{
- sourcePartSet = stagePartSet;
+ // We have to copy the contents of the set here rather than copying the set reference or
+ // bad things (tm) happen
+ foreach (PartSim aPartSim in stagePartSet)
+ {
+ sourcePartSet.Add(aPartSim);
+ }
+ break;
}
}
break;
case ResourceFlowMode.STACK_PRIORITY_SEARCH:
+ case ResourceFlowMode.STAGE_STACK_FLOW:
+ case ResourceFlowMode.STAGE_STACK_FLOW_BALANCE:
visited.Clear();
if (SimManager.logOutput)
@@ -376,11 +409,9 @@
break;
}
-
- if (sourcePartSet.Count > 0)
- {
- sourcePartSets[type] = sourcePartSet;
- if (SimManager.logOutput)
+ if (SimManager.logOutput)
+ {
+ if (sourcePartSet.Count > 0)
{
log = new LogMsg();
log.buf.AppendLine("Source parts for " + ResourceContainer.GetResourceName(type) + ":");
@@ -391,6 +422,8 @@
MonoBehaviour.print(log.buf);
}
}
+
+ //DumpSourcePartSets("after " + ResourceContainer.GetResourceName(type));
}
// If we don't have sources for all the needed resources then return false without setting up any drains
@@ -409,6 +442,7 @@
return false;
}
}
+
// Now we set the drains on the members of the sets and update the draining parts set
for (int i = 0; i < this.resourceConsumptions.Types.Count; i++)
{
--- a/KerbalEngineer/VesselSimulator/PartSim.cs
+++ b/KerbalEngineer/VesselSimulator/PartSim.cs
@@ -43,7 +43,6 @@
public bool fuelCrossFeed;
public List<PartSim> fuelTargets = new List<PartSim>();
public bool hasModuleEngines;
- public bool hasModuleEnginesFX;
public bool hasMultiModeEngine;
public bool hasVessel;
@@ -57,8 +56,7 @@
public bool isNoPhysics;
public bool isSepratron;
public bool isFairing;
- public bool localCorrectThrust;
- public float moduleMass;
+ public float fairingMass;
public int stageIndex;
public String name;
public String noCrossFeedNodeKey;
@@ -120,6 +118,7 @@
partSim.isFuelLine = partSim.part.HasModule<CModuleFuelLine>();
partSim.isFuelTank = partSim.part is FuelTank;
partSim.isSepratron = partSim.IsSepratron();
+ partSim.isFairing = partSim.IsFairing(partSim.part);
partSim.inverseStage = partSim.part.inverseStage;
//MonoBehaviour.print("inverseStage = " + inverseStage);
@@ -148,7 +147,10 @@
if (log != null) log.buf.AppendLine("Using part.mass of " + partSim.part.mass);
}
- partSim.moduleMass = partSim.part.GetModuleMass((float)partSim.realMass);
+ if (partSim.isFairing)
+ {
+ partSim.fairingMass = partSim.part.GetModuleMass((float)partSim.realMass);
+ }
for (int i = 0; i < partSim.part.Resources.Count; i++)
{
@@ -180,10 +182,9 @@
partSim.initialVesselName = partSim.part.initialVesselName;
partSim.hasMultiModeEngine = partSim.part.HasModule<MultiModeEngine>();
- partSim.hasModuleEnginesFX = partSim.part.HasModule<ModuleEnginesFX>();
partSim.hasModuleEngines = partSim.part.HasModule<ModuleEngines>();
- partSim.isEngine = partSim.hasMultiModeEngine || partSim.hasModuleEnginesFX || partSim.hasModuleEngines;
+ partSim.isEngine = partSim.hasMultiModeEngine || partSim.hasModuleEngines;
if (log != null) log.buf.AppendLine("Created " + partSim.name + ". Decoupled in stage " + partSim.decoupledInStage);
@@ -208,7 +209,6 @@
public void CreateEngineSims(List<EngineSim> allEngines, double atmosphere, double mach, bool vectoredThrust, bool fullThrust, LogMsg log)
{
- bool correctThrust = SimManager.DoesEngineUseCorrectedThrust(part);
if (log != null)
{
log.buf.AppendLine("CreateEngineSims for " + this.name);
@@ -217,20 +217,18 @@
PartModule partMod = this.part.Modules[i];
log.buf.AppendLine("Module: " + partMod.moduleName);
}
-
- log.buf.AppendLine("correctThrust = " + correctThrust);
}
if (hasMultiModeEngine)
{
- // A multi-mode engine has multiple ModuleEnginesFX but only one is active at any point
- // The mode of the engine is the engineID of the ModuleEnginesFX that is active
+ // A multi-mode engine has multiple ModuleEngines but only one is active at any point
+ // The mode of the engine is the engineID of the ModuleEngines that is active
string mode = part.GetModule<MultiModeEngine>().mode;
- List<ModuleEnginesFX> engines = part.GetModules<ModuleEnginesFX>();
+ List<ModuleEngines> engines = part.GetModules<ModuleEngines>();
for (int i = 0; i < engines.Count; ++i)
{
- ModuleEnginesFX engine = engines[i];
+ ModuleEngines engine = engines[i];
if (engine.engineID == mode)
{
if (log != null) log.buf.AppendLine("Module: " + engine.moduleName);
@@ -261,40 +259,37 @@
}
}
}
- else
- {
- if (hasModuleEngines)
- {
- List<ModuleEngines> engines = part.GetModules<ModuleEngines>();
- for (int i = 0; i < engines.Count; ++i)
- {
- ModuleEngines engine = engines[i];
- if (log != null) log.buf.AppendLine("Module: " + engine.moduleName);
-
- Vector3 thrustvec = this.CalculateThrustVector(vectoredThrust ? engine.thrustTransforms : null, log);
-
- EngineSim engineSim = EngineSim.New(
- this,
- atmosphere,
- (float)mach,
- engine.maxFuelFlow,
- engine.minFuelFlow,
- engine.thrustPercentage,
- thrustvec,
- engine.atmosphereCurve,
- engine.atmChangeFlow,
- engine.useAtmCurve ? engine.atmCurve : null,
- engine.useVelCurve ? engine.velCurve : null,
- engine.currentThrottle,
- engine.g,
- engine.throttleLocked || fullThrust,
- engine.propellants,
- engine.isOperational,
- engine.resultingThrust,
- engine.thrustTransforms,
- log);
- allEngines.Add(engineSim);
- }
+ else if (hasModuleEngines)
+ {
+ List<ModuleEngines> engines = part.GetModules<ModuleEngines>();
+ for (int i = 0; i < engines.Count; ++i)
+ {
+ ModuleEngines engine = engines[i];
+ if (log != null) log.buf.AppendLine("Module: " + engine.moduleName);
+
+ Vector3 thrustvec = this.CalculateThrustVector(vectoredThrust ? engine.thrustTransforms : null, log);
+
+ EngineSim engineSim = EngineSim.New(
+ this,
+ atmosphere,
+ (float)mach,
+ engine.maxFuelFlow,
+ engine.minFuelFlow,
+ engine.thrustPercentage,
+ thrustvec,
+ engine.atmosphereCurve,
+ engine.atmChangeFlow,
+ engine.useAtmCurve ? engine.atmCurve : null,
+ engine.useVelCurve ? engine.velCurve : null,
+ engine.currentThrottle,
+ engine.g,
+ engine.throttleLocked || fullThrust,
+ engine.propellants,
+ engine.isOperational,
+ engine.resultingThrust,
+ engine.thrustTransforms,
+ log);
+ allEngines.Add(engineSim);
}
}
@@ -421,9 +416,13 @@
mass += resources.GetResourceMass(resources.Types[i]);
}
- if (hasVessel == false && isFairing && inverseStage < currentStage)
- {
- mass = mass + moduleMass;
+ if (hasVessel == false && isFairing && currentStage > inverseStage)
+ {
+ mass += fairingMass;
+ }
+ else if (hasVessel && isFairing && currentStage <= inverseStage)
+ {
+ mass -= fairingMass;
}
return mass;
@@ -520,9 +519,7 @@
{
if (attachSim.nodeType == AttachNode.NodeType.Stack)
{
- if (
- !(this.noCrossFeedNodeKey != null && this.noCrossFeedNodeKey.Length > 0 &&
- attachSim.id.Contains(this.noCrossFeedNodeKey)))
+ if ((string.IsNullOrEmpty(noCrossFeedNodeKey) == false && attachSim.id.Contains(noCrossFeedNodeKey)) == false)
{
if (visited.Contains(attachSim.attachedPartSim))
{
@@ -550,7 +547,7 @@
// type was not disabled [Experiment]) and it contains fuel, it returns itself.
// Rule 6: If the part is fuel container for searched type of fuel (i.e. it has capability to contain that type of fuel and the fuel
// type was not disabled) but it does not contain the requested fuel, it returns empty list. [Experiment]
- if (resources.HasType(type) && resourceFlowStates[type] != 0)
+ if (resources.HasType(type) && resourceFlowStates[type] > 0.0)
{
if (resources[type] > SimManager.RESOURCE_MIN)
{
@@ -682,6 +679,11 @@
if (partSimLookup.TryGetValue(part.parent, out parent))
{
if (log != null) log.buf.AppendLine("Parent part is " + parent.name + ":" + parent.partId);
+ if (part.attachMode == AttachModes.SRF_ATTACH && part.attachRules.srfAttach && part.fuelCrossFeed && parent.fuelCrossFeed)
+ {
+ if (log != null) log.buf.AppendLine("Added " + name + " to " + parent.name + " fuel targets. (srf_attach with crossfeed)");
+ parent.fuelTargets.Add(this);
+ }
}
else
{
--- a/KerbalEngineer/VesselSimulator/Simulation.cs
+++ b/KerbalEngineer/VesselSimulator/Simulation.cs
@@ -30,6 +30,7 @@
namespace KerbalEngineer.VesselSimulator
{
+ using System.ComponentModel;
using CompoundParts;
using Extensions;
using Helpers;
@@ -75,7 +76,6 @@
public String vesselName;
public VesselType vesselType;
private WeightedVectorAverager vectorAverager = new WeightedVectorAverager();
- private static ModuleProceduralFairing moduleProceduralFairing;
public Simulation()
{
@@ -676,21 +676,28 @@
for (int i = 0; i < this.allParts.Count; i++)
{
PartSim part = this.allParts[i];
- // If the part has a parent
- if (part.parent != null)
- {
- if (part.isNoPhysics)
- {
- if (part.parent.isNoPhysics && part.parent.parent != null)
- {
- part.baseMass = 0d;
- part.baseMassForCoM = 0d;
- }
- else
- {
- part.parent.baseMassForCoM += part.baseMassForCoM;
- part.baseMassForCoM = 0d;
- }
+
+ // Check if part should pass it's mass onto its parent.
+ if (part.isNoPhysics && part.parent != null)
+ {
+ PartSim partParent = part.parent;
+
+ // Loop through all parents until a physically significant parent is found.
+ while (partParent != null)
+ {
+ // Check if parent is physically significant.
+ if (partParent.isNoPhysics == false)
+ {
+ // Apply the mass to the parent and remove it from the originating part.
+ partParent.baseMassForCoM += part.baseMassForCoM;
+ part.baseMassForCoM = 0.0;
+
+ // Break out of the recursive loop.
+ break;
+ }
+
+ // Recursively loop through the parent parts.
+ partParent = partParent.parent;
}
}
}
Binary files a/Output/KerbalEngineer/KerbalEngineer.dll and b/Output/KerbalEngineer/KerbalEngineer.dll differ
--- a/Output/KerbalEngineer/KerbalEngineer.version
+++ b/Output/KerbalEngineer/KerbalEngineer.version
@@ -1,17 +1,18 @@
{
- "NAME":"Kerbal Engineer Redux 1.0",
+ "NAME":"Kerbal Engineer Redux",
"URL":"http://ksp-avc.cybutek.net/version.php?id=6",
"VERSION":
{
"MAJOR":1,
"MINOR":0,
- "PATCH":16,
- "BUILD":6
+ "PATCH":19,
+ "BUILD":3
},
"KSP_VERSION":
{
"MAJOR":1,
"MINOR":0,
- "PATCH":2
+ "PATCH":5
}
}
+