Merge pull request #12 from Gerry1135/nodefix
Merge pull request #12 from Gerry1135/nodefix

Fix for low level tracking station not supporting patched conics

--- a/Documents/CHANGES.txt
+++ b/Documents/CHANGES.txt
@@ -1,10 +1,15 @@
-1.0.12.1
+1.0.13, 16-12-2014
+	Updated for KSP version 0.90
+
     Added: New readouts to the vessel category:
         - Heading Rate
         - Pitch Rate
         - Roll Rate
 
+    Changed: Simulation to look for fuel lines that use CModuleFuelLine module.
 	Fixed: Editor Overlay now loads the saved visibility value properly.
+    Fixed: Altitude (Terrain) will no longer give a reading below sea level.
+    Fixed: Suicide burn now uses radar altitude that clamps to sea level.
 
 1.0.12.0, 01-12-2014
 	Added: Setting in Build Engineer to enable/disable vectored thrust calculations.

--- a/KerbalEngineer/Editor/BuildAdvanced.cs
+++ b/KerbalEngineer/Editor/BuildAdvanced.cs
@@ -177,7 +177,7 @@
         {
             try
             {
-                if (!this.visible || EditorLogic.fetch == null || EditorLogic.fetch.ship.parts.Count == 0 || EditorLogic.fetch.editorScreen != EditorLogic.EditorScreen.Parts)
+                if (!this.visible || EditorLogic.fetch == null || EditorLogic.fetch.ship.parts.Count == 0 || EditorLogic.fetch.editorScreen != EditorScreen.Parts)
                 {
                     return;
                 }

--- a/KerbalEngineer/Editor/BuildOverlayPartInfo.cs
+++ b/KerbalEngineer/Editor/BuildOverlayPartInfo.cs
@@ -97,7 +97,7 @@
         {
             try
             {
-                if (!Visible || Hidden || EditorLogic.startPod == null || EditorLogic.fetch.editorScreen != EditorLogic.EditorScreen.Parts)
+                if (!Visible || Hidden || EditorLogic.RootPart == null || EditorLogic.fetch.editorScreen != EditorScreen.Parts)
                 {
                     return;
                 }

--- a/KerbalEngineer/Editor/BuildOverlayResources.cs
+++ b/KerbalEngineer/Editor/BuildOverlayResources.cs
@@ -70,7 +70,7 @@
         {
             try
             {
-                if (!Visible || this.resources.Count == 0 || EditorLogic.fetch.editorScreen != EditorLogic.EditorScreen.Parts)
+                if (!Visible || this.resources.Count == 0 || EditorLogic.fetch.editorScreen != EditorScreen.Parts)
                 {
                     return;
                 }

--- a/KerbalEngineer/Editor/BuildOverlayVessel.cs
+++ b/KerbalEngineer/Editor/BuildOverlayVessel.cs
@@ -82,7 +82,7 @@
         {
             try
             {
-                if (!Visible || EditorLogic.startPod == null || EditorLogic.fetch.editorScreen != EditorLogic.EditorScreen.Parts)
+                if (!Visible || EditorLogic.RootPart == null || EditorLogic.fetch.editorScreen != EditorScreen.Parts)
                 {
                     return;
                 }
@@ -129,7 +129,7 @@
         {
             try
             {
-                if (!Visible || EditorLogic.startPod == null)
+                if (!Visible || EditorLogic.RootPart == null)
                 {
                     return;
                 }

--- a/KerbalEngineer/EngineerGlobals.cs
+++ b/KerbalEngineer/EngineerGlobals.cs
@@ -33,7 +33,7 @@
         /// <summary>
         ///     Current version of the Kerbal Engineer assembly.
         /// </summary>
-        public const string AssemblyVersion = "1.0.12.1";
+        public const string AssemblyVersion = "1.0.13";
 
         #endregion
 

--- a/KerbalEngineer/Extensions/PartExtensions.cs
+++ b/KerbalEngineer/Extensions/PartExtensions.cs
@@ -27,6 +27,8 @@
 
 namespace KerbalEngineer.Extensions
 {
+    using CompoundParts;
+
     public static class PartExtensions
     {
         #region Methods: public
@@ -69,7 +71,7 @@
         /// </summary>
         public static double GetCostDry(this Part part)
         {
-            return part.partInfo.cost - GetResourceCostMax(part) + part.GetModuleCosts();
+            return part.partInfo.cost - GetResourceCostMax(part) + part.GetModuleCosts(0.0f);
         }
 
         /// <summary>
@@ -77,7 +79,7 @@
         /// </summary>
         public static double GetCostMax(this Part part)
         {
-            return part.partInfo.cost + part.GetModuleCosts();
+            return part.partInfo.cost + part.GetModuleCosts(0.0f);
         }
 
         /// <summary>
@@ -85,7 +87,7 @@
         /// </summary>
         public static double GetCostWet(this Part part)
         {
-            return part.partInfo.cost - GetResourceCostInverted(part) + part.GetModuleCosts();
+            return part.partInfo.cost - GetResourceCostInverted(part) + part.GetModuleCosts(0.0f);
         }
 
         /// <summary>
@@ -387,7 +389,7 @@
         /// </summary>
         public static bool IsFuelLine(this Part part)
         {
-            return (part is FuelLine);
+            return (HasModule<CModuleFuelLine>(part));
         }
 
         /// <summary>

--- a/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/ManoeuvreProcessor.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/ManoeuvreProcessor.cs
@@ -91,7 +91,11 @@
 
         public void Update()
         {
-            if (FlightGlobals.ActiveVessel.patchedConicSolver.maneuverNodes.Count == 0 || !SimulationProcessor.ShowDetails)
+            // Extra tests for low level tracking station not supporting patched conics and maneuver nodes
+            if (FlightGlobals.ActiveVessel.patchedConicSolver == null ||
+                FlightGlobals.ActiveVessel.patchedConicSolver.maneuverNodes == null ||
+                FlightGlobals.ActiveVessel.patchedConicSolver.maneuverNodes.Count == 0 ||
+                !SimulationProcessor.ShowDetails)
             {
                 ShowDetails = false;
                 return;

--- a/KerbalEngineer/Flight/Readouts/Surface/AltitudeTerrain.cs
+++ b/KerbalEngineer/Flight/Readouts/Surface/AltitudeTerrain.cs
@@ -19,13 +19,17 @@
 
 #region Using Directives
 
-using KerbalEngineer.Extensions;
-using KerbalEngineer.Flight.Sections;
-
 #endregion
 
 namespace KerbalEngineer.Flight.Readouts.Surface
 {
+    #region Using Directives
+
+    using Extensions;
+    using Sections;
+
+    #endregion
+
     public class AltitudeTerrain : ReadoutModule
     {
         #region Constructors
@@ -40,11 +44,18 @@
 
         #endregion
 
-        #region Methods: public
+        #region Methods
 
         public override void Draw(SectionModule section)
         {
-            this.DrawLine((FlightGlobals.ship_altitude - FlightGlobals.ActiveVessel.terrainAltitude).ToDistance(), section.IsHud);
+            if (FlightGlobals.ActiveVessel.terrainAltitude > 0.0)
+            {
+                this.DrawLine((FlightGlobals.ship_altitude - FlightGlobals.ActiveVessel.terrainAltitude).ToDistance(), section.IsHud);
+            }
+            else
+            {
+                this.DrawLine((FlightGlobals.ship_altitude).ToDistance(), section.IsHud);
+            }
         }
 
         #endregion

--- a/KerbalEngineer/Flight/Readouts/Vessel/SuicideBurnProcessor.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/SuicideBurnProcessor.cs
@@ -19,12 +19,18 @@
 
 #region Using Directives
 
-using System;
+
 
 #endregion
 
 namespace KerbalEngineer.Flight.Readouts.Vessel
 {
+    #region Using Directives
+
+    using System;
+
+    #endregion
+
     public class SuicideBurnProcessor : IUpdatable, IUpdateRequest
     {
         #region Fields
@@ -55,7 +61,7 @@
 
         #endregion
 
-        #region Methods: public
+        #region Methods
 
         public static void RequestUpdate()
         {
@@ -79,7 +85,9 @@
 
             this.gravity = FlightGlobals.currentMainBody.gravParameter / Math.Pow(FlightGlobals.currentMainBody.Radius, 2.0);
             this.acceleration = SimulationProcessor.LastStage.thrust / SimulationProcessor.LastStage.totalMass;
-            this.radarAltitude = FlightGlobals.ship_altitude - FlightGlobals.ActiveVessel.terrainAltitude;
+            this.radarAltitude = FlightGlobals.ActiveVessel.terrainAltitude > 0.0
+                ? FlightGlobals.ship_altitude - FlightGlobals.ActiveVessel.terrainAltitude
+                : FlightGlobals.ship_altitude;
 
             DeltaV = Math.Sqrt((2 * this.gravity * this.radarAltitude) + Math.Pow(FlightGlobals.ship_verticalSpeed, 2.0));
             Altitude = Math.Pow(DeltaV, 2.0) / (2.0 * this.acceleration);

--- a/KerbalEngineer/VesselSimulator/PartSim.cs
+++ b/KerbalEngineer/VesselSimulator/PartSim.cs
@@ -32,6 +32,8 @@
 
 namespace KerbalEngineer.VesselSimulator
 {
+    using CompoundParts;
+
     public class PartSim
     {
         private readonly List<AttachNodeSim> attachNodes = new List<AttachNodeSim>();
@@ -86,7 +88,7 @@
             this.fuelCrossFeed = this.part.fuelCrossFeed;
             this.noCrossFeedNodeKey = this.part.NoCrossFeedNodeKey;
             this.decoupledInStage = this.DecoupledInStage(this.part);
-            this.isFuelLine = this.part is FuelLine;
+            this.isFuelLine = this.part.HasModule<CModuleFuelLine>();
             this.isFuelTank = this.part is FuelTank;
             this.isSepratron = this.IsSepratron();
             this.inverseStage = this.part.inverseStage;

--- a/KerbalEngineer/VesselSimulator/Simulation.cs
+++ b/KerbalEngineer/VesselSimulator/Simulation.cs
@@ -30,6 +30,9 @@
 
 namespace KerbalEngineer.VesselSimulator
 {
+    using CompoundParts;
+    using Extensions;
+
     public class Simulation
     {
         private const double STD_GRAVITY = 9.82;
@@ -192,10 +195,11 @@
             {
                 foreach (PartSim partSim in this.allFuelLines)
                 {
-                    if ((partSim.part as FuelLine).target != null)
+                    CModuleFuelLine fuelLine = partSim.part.GetModule<CModuleFuelLine>();
+                    if (fuelLine.target != null)
                     {
                         PartSim targetSim;
-                        if (partSimLookup.TryGetValue((partSim.part as FuelLine).target, out targetSim))
+                        if (partSimLookup.TryGetValue(fuelLine.target, out targetSim))
                         {
                             if (log != null)
                             {

 Binary files a/Output/KerbalEngineer/KerbalEngineer.dll and b/Output/KerbalEngineer/KerbalEngineer.dll differ
--- a/Output/KerbalEngineer/KerbalEngineer.version
+++ b/Output/KerbalEngineer/KerbalEngineer.version
@@ -5,13 +5,13 @@
 	{
 		"MAJOR":1,
 		"MINOR":0,
-		"PATCH":12,
+		"PATCH":13,
 		"BUILD":0
 	},
 	"KSP_VERSION":
 	{
 		"MAJOR":0,
-		"MINOR":25,
+		"MINOR":90,
 		"PATCH":0
 	}
 }