Fixed errors and made compilable for KSP v1.1 (runs but contains bugs).
Fixed errors and made compilable for KSP v1.1 (runs but contains bugs).

--- a/Documents/CHANGES.txt
+++ b/Documents/CHANGES.txt
@@ -1,4 +1,17 @@
-1.0.19.0
+    Changed: Thermal flux is now correctly indicated in kilowatts.
+
+1.0.19.4, 12-02-16
+    Fixed: Only 'STAGE_STACK_FLOW' and 'STAGE_STACK_FLOW_BALANCE' resources include surface mounted parts as fuel targets.
+    Fixed: Fairing mass being doubled in the VAB (removed workaround for a KSP bug which has been fixed).
+
+1.0.19.3, 09-02-16
+    Fixed: Fuel cross-feed from surface attached parts.
+
+1.0.19.2, 19-11-15
+    Rebuild for KSP 1.0.5.1028 silent update.
+    
+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)

--- a/KerbalEngineer/Editor/BuildOverlayPartInfo.cs
+++ b/KerbalEngineer/Editor/BuildOverlayPartInfo.cs
@@ -28,7 +28,7 @@
     public class BuildOverlayPartInfo : MonoBehaviour
     {
         private static bool clickToOpen = true;
-        private static ModuleGenerator.GeneratorResource generatorResource;
+        private static ModuleResource generatorResource;
         private static ModuleAlternator moduleAlternator;
         private static ModuleDataTransmitter moduleDataTransmitter;
         private static ModuleDeployableSolarPanel moduleDeployableSolarPanel;
@@ -131,7 +131,7 @@
                     position.x = Input.mousePosition.x - 3 - position.width;
                 }
 
-                part = EditorLogic.fetch.ship.parts.Find(p => p.stackIcon.highlightIcon) ?? EditorLogic.SelectedPart;
+                part = EditorLogic.fetch.ship.parts.Find(p => p.stackIcon.Highlighted) ?? EditorLogic.SelectedPart;
                 if (part != null)
                 {
                     if (!part.Equals(selectedPart))

--- a/KerbalEngineer/Editor/BuildToolbar.cs
+++ b/KerbalEngineer/Editor/BuildToolbar.cs
@@ -27,6 +27,9 @@
 
 namespace KerbalEngineer.Editor
 {
+    using KSP.UI;
+    using KSP.UI.Screens;
+
     [KSPAddon(KSPAddon.Startup.EditorAny, false)]
     public class BuildToolbar : MonoBehaviour
     {
@@ -95,16 +98,16 @@
 
                 if (EditorLogic.fetch != null && EditorLogic.fetch.ship.parts.Count > 0)
                 {
-                    if (BuildAdvanced.Instance.Visible && this.button.State != RUIToggleButton.ButtonState.TRUE)
+                    if (BuildAdvanced.Instance.Visible && this.button.toggleButton.CurrentState != UIRadioButton.State.True)
                     {
                         this.button.SetTrue();
                     }
-                    else if (!BuildAdvanced.Instance.Visible && this.button.State != RUIToggleButton.ButtonState.FALSE)
+                    else if (!BuildAdvanced.Instance.Visible && this.button.toggleButton.CurrentState != UIRadioButton.State.False)
                     {
                         this.button.SetFalse();
                     }
                 }
-                else if (this.button.State != RUIToggleButton.ButtonState.DISABLED)
+                else if (this.button.toggleButton.Interactable)
                 {
                     this.button.Disable();
                 }

--- a/KerbalEngineer/EngineerGlobals.cs
+++ b/KerbalEngineer/EngineerGlobals.cs
@@ -25,7 +25,7 @@
         /// <summary>
         ///     Current version of the Kerbal Engineer assembly.
         /// </summary>
-        public const string ASSEMBLY_VERSION = "1.0.18.1";
+        public const string ASSEMBLY_VERSION = "1.0.19.4";
 
         private static string assemblyFile;
         private static string assemblyName;

--- a/KerbalEngineer/Flight/ActionMenu.cs
+++ b/KerbalEngineer/Flight/ActionMenu.cs
@@ -27,6 +27,8 @@
 
 namespace KerbalEngineer.Flight
 {
+    using KSP.UI.Screens;
+
     /// <summary>
     ///     Graphical controller for section interaction in the form of a menu system.
     /// </summary>
@@ -90,11 +92,11 @@
                 {
                     return;
                 }
-                if (FlightEngineerCore.IsDisplayable && this.button.State == RUIToggleButton.ButtonState.DISABLED)
+                if (FlightEngineerCore.IsDisplayable && this.button.toggleButton.Interactable == false)
                 {
                     this.button.Enable();
                 }
-                else if (!FlightEngineerCore.IsDisplayable && this.button.State != RUIToggleButton.ButtonState.DISABLED)
+                else if (!FlightEngineerCore.IsDisplayable && this.button.toggleButton.Interactable)
                 {
                     this.button.Disable();
                 }

--- a/KerbalEngineer/Helpers/TimeFormatter.cs
+++ b/KerbalEngineer/Helpers/TimeFormatter.cs
@@ -28,11 +28,11 @@
 
             if (seconds > 0.0)
             {
-                years = (int)(seconds / KSPUtil.Year);
-                seconds -= years * KSPUtil.Year;
+                years = (int)(seconds / KSPUtil.dateTimeFormatter.Year);
+                seconds -= years * KSPUtil.dateTimeFormatter.Year;
 
-                days = (int)(seconds / KSPUtil.Day);
-                seconds -= days * KSPUtil.Day;
+                days = (int)(seconds / KSPUtil.dateTimeFormatter.Day);
+                seconds -= days * KSPUtil.dateTimeFormatter.Day;
 
                 hours = (int)(seconds / 3600.0);
                 seconds -= hours * 3600.0;

--- a/KerbalEngineer/Helpers/Units.cs
+++ b/KerbalEngineer/Helpers/Units.cs
@@ -127,7 +127,7 @@
 
         public static string ToFlux(double value)
         {
-            return value.ToString("#,0.00") + "W";
+            return value.ToString("#,0.00") + "kW";
         }
 
         public static string ToForce(double value)

--- a/KerbalEngineer/KerbalEngineer.csproj
+++ b/KerbalEngineer/KerbalEngineer.csproj
@@ -238,7 +238,23 @@
   </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="Assembly-CSharp-firstpass">
+      <HintPath>..\..\game\KSP_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="KSPAssets">
+      <HintPath>..\..\game\KSP_Data\Managed\KSPAssets.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="KSPCore">
+      <HintPath>..\..\game\KSP_Data\Managed\KSPCore.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="KSPUtil">
+      <HintPath>..\..\game\KSP_Data\Managed\KSPUtil.dll</HintPath>
       <Private>False</Private>
     </Reference>
     <Reference Include="System">
@@ -250,7 +266,11 @@
       <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>
+    <Reference Include="UnityEngine.UI">
+      <HintPath>..\..\game\KSP_Data\Managed\UnityEngine.UI.dll</HintPath>
       <Private>False</Private>
     </Reference>
   </ItemGroup>
@@ -269,7 +289,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/KeyBinding/KeyBindPopup.cs
+++ b/KerbalEngineer/KeyBinding/KeyBindPopup.cs
@@ -179,6 +179,10 @@
             GUILayout.BeginVertical(HighLogic.Skin.textArea);
             GUILayout.Label("Key Bind: " + Name);
             GUILayout.Label("Selected: " + Binding);
+            if (GUILayout.Button("Clear", HighLogic.Skin.button))
+            {
+                Binding = KeyCode.None;
+            }
             GUILayout.EndVertical();
 
             // Window buttons.

--- a/KerbalEngineer/TapeDriveAnimator.cs
+++ b/KerbalEngineer/TapeDriveAnimator.cs
@@ -83,6 +83,8 @@
         private bool sceneIsEditor;
         private float speed;
         private float targetSpeed;
+        private Renderer renderer;
+        private Light light;
 
         #endregion
 
@@ -120,6 +122,8 @@
 
         public override void OnStart(StartState state)
         {
+            renderer = GetComponent<Renderer>();
+
             this.random = new Random();
 
             this.StopBakedAnimation();
@@ -167,37 +171,37 @@
             if (this.Lights1 != "")
             {
                 this.lights1Transform = this.part.FindModelTransform(this.Lights1);
-                this.lights1ShaderOff = this.lights1Transform.renderer.material.shader;
+                this.lights1ShaderOff = renderer.material.shader;
             }
 
             if (this.Lights2 != "")
             {
                 this.lights2Transform = this.part.FindModelTransform(this.Lights2);
-                this.lights2ShaderOff = this.lights2Transform.renderer.material.shader;
+                this.lights2ShaderOff = renderer.material.shader;
             }
 
             if (this.Lights3 != "")
             {
                 this.lights3Transform = this.part.FindModelTransform(this.Lights3);
-                this.lights3ShaderOff = this.lights3Transform.renderer.material.shader;
+                this.lights3ShaderOff = renderer.material.shader;
             }
 
             if (this.Lights4 != "")
             {
                 this.lights4Transform = this.part.FindModelTransform(this.Lights4);
-                this.lights4ShaderOff = this.lights4Transform.renderer.material.shader;
+                this.lights4ShaderOff = renderer.material.shader;
             }
 
             if (this.Lights5 != "")
             {
                 this.lights5Transform = this.part.FindModelTransform(this.Lights5);
-                this.lights5ShaderOff = this.lights5Transform.renderer.material.shader;
+                this.lights5ShaderOff = renderer.material.shader;
             }
 
             if (this.Lights6 != "")
             {
                 this.lights6Transform = this.part.FindModelTransform(this.Lights6);
-                this.lights6ShaderOff = this.lights6Transform.renderer.material.shader;
+                this.lights6ShaderOff = renderer.material.shader;
             }
 
             this.lightsShaderOn = Shader.Find("Unlit/Texture");
@@ -381,7 +385,7 @@
                 lightsOn = (this.speed == 0);
             }
 
-            lights.renderer.material.shader = lightsOn ? @on : off;
+            lights.GetComponent<Renderer>().material.shader = lightsOn ? @on : off;
         }
 
         #endregion

--- a/KerbalEngineer/VesselSimulator/EngineSim.cs
+++ b/KerbalEngineer/VesselSimulator/EngineSim.cs
@@ -327,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];
@@ -338,6 +339,7 @@
                         break;
 
                     case ResourceFlowMode.STAGE_PRIORITY_FLOW:
+                    case ResourceFlowMode.STAGE_PRIORITY_FLOW_BALANCE:
 
                         foreach (HashSet<PartSim> stagePartSet in stagePartSets.Values)
                         {
@@ -393,8 +395,24 @@
                             log = new LogMsg();
                             log.buf.AppendLine("Find " + ResourceContainer.GetResourceName(type) + " sources for " + partSim.name + ":" + partSim.partId);
                         }
-                        partSim.GetSourceSet(type, allParts, visited, sourcePartSet, log, "");
+                        partSim.GetSourceSet(type, PhysicsGlobals.Stack_PriUsesSurf, allParts, visited, sourcePartSet, log, "");
+                        if (SimManager.logOutput && log != null)
+                        {
+                            MonoBehaviour.print(log.buf);
+                        }
+                        break;
+
+                    case ResourceFlowMode.STAGE_STACK_FLOW:
+                    case ResourceFlowMode.STAGE_STACK_FLOW_BALANCE:
+                        visited.Clear();
+
                         if (SimManager.logOutput)
+                        {
+                            log = new LogMsg();
+                            log.buf.AppendLine("Find " + ResourceContainer.GetResourceName(type) + " sources for " + partSim.name + ":" + partSim.partId);
+                        }
+                        partSim.GetSourceSet(type, true, allParts, visited, sourcePartSet, log, "");
+                        if (SimManager.logOutput && log != null)
                         {
                             MonoBehaviour.print(log.buf);
                         }

--- a/KerbalEngineer/VesselSimulator/PartSim.cs
+++ b/KerbalEngineer/VesselSimulator/PartSim.cs
@@ -42,6 +42,7 @@
         public int decoupledInStage;
         public bool fuelCrossFeed;
         public List<PartSim> fuelTargets = new List<PartSim>();
+        public List<PartSim> surfaceMountFuelTargets = new List<PartSim>();
         public bool hasModuleEngines;
         public bool hasMultiModeEngine;
 
@@ -416,11 +417,7 @@
                 mass += resources.GetResourceMass(resources.Types[i]);
             }
 
-            if (hasVessel == false && isFairing && currentStage > inverseStage)
-            {
-                mass += fairingMass;
-            }
-            else if (hasVessel && isFairing && currentStage <= inverseStage)
+            if (isFairing && currentStage <= inverseStage)
             {
                 mass -= fairingMass;
             }
@@ -451,7 +448,7 @@
         // All functions below this point must not rely on the part member (it may be null)
         //
 
-        public void GetSourceSet(int type, List<PartSim> allParts, HashSet<PartSim> visited, HashSet<PartSim> allSources, LogMsg log, String indent)
+        public void GetSourceSet(int type, bool includeSurfaceMountedParts, List<PartSim> allParts, HashSet<PartSim> visited, HashSet<PartSim> allSources, LogMsg log, String indent)
         {
             if (log != null)
             {
@@ -489,7 +486,29 @@
                     {
                         if (log != null) log.buf.AppendLine(indent + "Adding fuel target as source (" + partSim.name + ":" + partSim.partId + ")");
 
-                        partSim.GetSourceSet(type, allParts, visited, allSources, log, indent);
+                        partSim.GetSourceSet(type, includeSurfaceMountedParts, allParts, visited, allSources, log, indent);
+                    }
+                }
+            }
+
+            // check surface mounted fuel targets
+            if (includeSurfaceMountedParts)
+            {
+                for (int i = 0; i < surfaceMountFuelTargets.Count; i++)
+                {
+                    PartSim partSim = this.surfaceMountFuelTargets[i];
+                    if (partSim != null)
+                    {
+                        if (visited.Contains(partSim))
+                        {
+                            if (log != null) log.buf.AppendLine(indent + "Fuel target already visited, skipping (" + partSim.name + ":" + partSim.partId + ")");
+                        }
+                        else
+                        {
+                            if (log != null) log.buf.AppendLine(indent + "Adding fuel target as source (" + partSim.name + ":" + partSim.partId + ")");
+
+                            partSim.GetSourceSet(type, true, allParts, visited, allSources, log, indent);
+                        }
                     }
                 }
             }
@@ -519,9 +538,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))
                                 {
@@ -531,7 +548,7 @@
                                 {
                                     if (log != null) log.buf.AppendLine(indent + "Adding attached part as source (" + attachSim.attachedPartSim.name + ":" + attachSim.attachedPartSim.partId + ")");
 
-                                    attachSim.attachedPartSim.GetSourceSet(type, allParts, visited, allSources, log, indent);
+                                    attachSim.attachedPartSim.GetSourceSet(type, includeSurfaceMountedParts, allParts, visited, allSources, log, indent);
                                 }
                             }
                         }
@@ -549,7 +566,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)
                 {
@@ -578,7 +595,7 @@
                     else
                     {
                         lastCount = allSources.Count;
-                        this.parent.GetSourceSet(type, allParts, visited, allSources, log, indent);
+                        this.parent.GetSourceSet(type, includeSurfaceMountedParts, allParts, visited, allSources, log, indent);
                         if (allSources.Count > lastCount)
                         {
                             if (log != null) log.buf.AppendLine(indent + "Returning " + (allSources.Count  - lastCount) + " parent sources (" + this.name + ":" + this.partId + ")");
@@ -681,6 +698,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 && part.parent.fuelCrossFeed)
+                    {
+                        if (log != null) log.buf.AppendLine("Added " + name + " to " + parent.name + " surface mounted fuel targets.");
+                        parent.surfaceMountFuelTargets.Add(this);
+                    }
                 }
                 else
                 {

 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,14 +5,14 @@
 	{
 		"MAJOR":1,
 		"MINOR":0,
-		"PATCH":18,
-		"BUILD":0
+		"PATCH":19,
+		"BUILD":4
 	},
 	"KSP_VERSION":
 	{
 		"MAJOR":1,
 		"MINOR":0,
-		"PATCH":4
+		"PATCH":5
 	}
 }