Merge branch 'master' into kspexp
Merge branch 'master' into kspexp

--- a/KerbalEngineer/Flight/Readouts/Orbital/Eccentricity.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/Eccentricity.cs
@@ -43,7 +43,7 @@
 
         public override void Draw(SectionModule section)
         {
-            this.DrawLine(FlightGlobals.ship_orbit.eccentricity.ToString("F3"), section.IsHud);
+            this.DrawLine(FlightGlobals.ship_orbit.eccentricity.ToString("F5"), section.IsHud);
         }
 
         #endregion

--- a/KerbalEngineer/VesselSimulator/PartSim.cs
+++ b/KerbalEngineer/VesselSimulator/PartSim.cs
@@ -108,9 +108,7 @@
             partSim.name = partSim.part.partInfo.name;
 
             if (log != null)
-            {
                 log.buf.AppendLine("Create PartSim for " + partSim.name);
-            }
 
             partSim.parent = null;
             partSim.parentAttach = partSim.part.attachMode;
@@ -126,18 +124,19 @@
             partSim.cost = partSim.part.GetCostWet();
 
             // Work out if the part should have no physical significance
-            partSim.isNoPhysics = partSim.part.HasModule<LaunchClamp>() ||
-                               partSim.part.physicalSignificance == Part.PhysicalSignificance.NONE ||
+            partSim.isNoPhysics = partSim.part.physicalSignificance == Part.PhysicalSignificance.NONE ||
                                partSim.part.PhysicsSignificance == 1;
 
-            if (!partSim.isNoPhysics)
+            if (partSim.part.HasModule<LaunchClamp>())
+            {
+                if (log != null)
+                  log.buf.AppendLine("Ignoring mass of launch clamp");
+            }
+            else
             {
                 partSim.baseMass = partSim.part.mass;
-            }
-
-            if (SimManager.logOutput)
-            {
-                MonoBehaviour.print((partSim.isNoPhysics ? "Ignoring" : "Using") + " part.mass of " + partSim.part.mass);
+                if (log != null)
+                    log.buf.AppendLine("Using part.mass of " + partSim.part.mass);
             }
 
             for (int i = 0; i < partSim.part.Resources.Count; i++)
@@ -148,17 +147,16 @@
                 // This can happen if a resource capacity is 0 and tweakable
                 if (!Double.IsNaN(resource.amount))
                 {
-                    if (SimManager.logOutput)
-                    {
-                        MonoBehaviour.print(resource.resourceName + " = " + resource.amount);
-                    }
+                    if (log != null)
+                        log.buf.AppendLine(resource.resourceName + " = " + resource.amount);
 
                     partSim.resources.Add(resource.info.id, resource.amount);
                     partSim.resourceFlowStates.Add(resource.info.id, resource.flowState ? 1 : 0);
                 }
                 else
                 {
-                    MonoBehaviour.print(resource.resourceName + " is NaN. Skipping.");
+                    if (log != null)
+                        log.buf.AppendLine(resource.resourceName + " is NaN. Skipping.");
                 }
             }
 
@@ -179,10 +177,9 @@
 
             partSim.isEngine = partSim.hasMultiModeEngine || partSim.hasModuleEnginesFX || partSim.hasModuleEngines;
 
-            if (SimManager.logOutput)
-            {
-                MonoBehaviour.print("Created " + partSim.name + ". Decoupled in stage " + partSim.decoupledInStage);
-            }
+            if (log != null)
+                log.buf.AppendLine("Created " + partSim.name + ". Decoupled in stage " + partSim.decoupledInStage);
+
             return partSim;
         }
 
@@ -689,6 +686,19 @@
                     }
                 }
             }
+
+            if (isNoPhysics)
+            {
+                if (log != null)
+                    log.buf.AppendLine("Moving NoPhysics part mass of " + this.baseMass + " to parent part");
+
+                // Apply this part's mass to the part we have found
+                if (parent != null && !parent.isNoPhysics)
+                    parent.baseMass += this.baseMass;
+
+                // And zero out this part's mass regardless of whether the mass was added to the parent
+                this.baseMass = 0;
+            }
         }
 
         public void SetupParent(Dictionary<Part, PartSim> partSimLookup, LogMsg log)
@@ -699,16 +709,12 @@
                 if (partSimLookup.TryGetValue(part.parent, out parent))
                 {
                     if (log != null)
-                    {
                         log.buf.AppendLine("Parent part is " + parent.name + ":" + parent.partId);
-                    }
                 }
                 else
                 {
                     if (log != null)
-                    {
                         log.buf.AppendLine("No PartSim for parent part (" + part.parent.partInfo.name + ")");
-                    }
                 }
             }
         }