Merge branch 'exp' of ssh://toad.homelinux.net:22222/VOID into exp exp
Merge branch 'exp' of ssh://toad.homelinux.net:22222/VOID into exp

--- a/VOIDCore_Generic.cs
+++ b/VOIDCore_Generic.cs
@@ -432,32 +432,59 @@
 				}
 			}
 
-			if (this.useToolbarManager)
-			{
+			if (ToolbarManager.ToolbarAvailable && this.useToolbarManager)
+			{
+				if (this.ToolbarButton == null)
+				{
+					this.ToolbarButton = ToolbarManager.Instance.add(this.VoidName, "coreToggle");
+					this.ToolbarButton.Text = this.VoidName;
+					this.SetIconTexture(this.powerState | this.activeState);
+
+					this.ToolbarButton.Visible = true;
+
+					this.ToolbarButton.OnClick += 
+						(e) =>
+						{
+							this.ToggleMainWindow();
+						};
+
+					Logging.PostDebugMessage(string.Format("{0}: Toolbar Button initialized.", this.GetType().Name));
+				}
+
 				if (this.AppLauncherButton != null)
 				{
 					ApplicationLauncher.Instance.RemoveModApplication(this.AppLauncherButton);
 					this.AppLauncherButton = null;
 				}
-
-				if (this.ToolbarButton == null)
-				{
-					this.InitializeToolbarButton();
-				}
 			}
 			else
 			{
+				if (this.AppLauncherButton == null)
+				{
+					if (ApplicationLauncher.Instance != null)
+					{
+						this.AppLauncherButton = ApplicationLauncher.Instance.AddModApplication(
+							this.ToggleMainWindow, this.ToggleMainWindow,
+							this.appIconVisibleScenes,
+							this.VOIDIconTexture
+						);
+
+						Logging.PostDebugMessage(
+							this,
+							"AppLauncherButton initialized in {0}",
+							Enum.GetName(
+								typeof(GameScenes),
+								HighLogic.LoadedScene
+							)
+						);
+					}
+				}
+
 				if (this.ToolbarButton != null)
 				{
 					this.ToolbarButton.Destroy();
 					this.ToolbarButton = null;
 				}
-
-				if (this.AppLauncherButton == null)
-				{
-					this.InitializeAppLauncherButton();
-				}
-
 			}
 
 			this.saveTimer += Time.deltaTime;
@@ -1011,51 +1038,6 @@
 				SimManager.OnReady += this.GetSimManagerResults;
 
 				this.simManagerLoaded = true;
-			}
-		}
-
-		protected void InitializeToolbarButton()
-		{
-			// Do nothing if (the Toolbar is not available.
-			if (!ToolbarManager.ToolbarAvailable)
-			{
-				Logging.PostDebugMessage(this, "Refusing to make a ToolbarButton: ToolbarAvailable = false");
-				return;
-			}
-
-			this.ToolbarButton = ToolbarManager.Instance.add(this.VoidName, "coreToggle");
-			this.ToolbarButton.Text = this.VoidName;
-			this.SetIconTexture(this.powerState | this.activeState);
-
-			this.ToolbarButton.Visible = true;
-
-			this.ToolbarButton.OnClick += 
-				(e) =>
-			{
-				this.ToggleMainWindow();
-			};
-
-			Logging.PostDebugMessage(string.Format("{0}: Toolbar Button initialized.", this.GetType().Name));
-		}
-
-		protected void InitializeAppLauncherButton()
-		{
-			if (ApplicationLauncher.Ready)
-			{
-				this.AppLauncherButton = ApplicationLauncher.Instance.AddModApplication(
-					this.ToggleMainWindow, this.ToggleMainWindow,
-					this.appIconVisibleScenes,
-					this.VOIDIconTexture
-				);
-
-				Logging.PostDebugMessage(
-					this,
-					"AppLauncherButton initialized in {0}",
-					Enum.GetName(
-						typeof(GameScenes),
-						HighLogic.LoadedScene
-					)
-				);
 			}
 		}
 

--- a/VOID_Data.cs
+++ b/VOID_Data.cs
@@ -502,55 +502,66 @@
 					Vector3 thrustDir = Vector3.zero;
 					float thrust = 0;
 
-					PartModule engine;
-					for (int idx = 0; idx < engineModules.Count; idx++)
-					{
-						engine = engineModules[idx];
-						float moduleThrust = 0;
-
-						switch (engine.moduleName)
-						{
-							case "ModuleEngines":
-							case "ModuleEnginesFX":
-								break;
-							default:
-								continue;
-						}
-
-						if (!engine.isEnabled)
+					Part part;
+					for (int partIdx = 0; partIdx < Core.Vessel.parts.Count; partIdx++)
+					{
+						part = Core.Vessel.parts[partIdx];
+
+						if (part == null || part.Modules == null)
 						{
 							continue;
 						}
 
-						CenterOfThrustQuery cotQuery = new CenterOfThrustQuery();
-
-						if (engine is ModuleEngines)
+						PartModule module;
+						for (int idx = 0; idx < part.Modules.Count; idx++)
 						{
-							ModuleEngines engineModule = engine as ModuleEngines;
-
-							moduleThrust = engineModule.finalThrust;
-
-							engineModule.OnCenterOfThrustQuery(cotQuery);
+							module = part.Modules[idx];
+
+							float moduleThrust = 0;
+
+							switch (module.moduleName)
+							{
+								case "ModuleEngines":
+								case "ModuleEnginesFX":
+									break;
+								default:
+									continue;
+							}
+
+							if (!module.isEnabled)
+							{
+								continue;
+							}
+
+							CenterOfThrustQuery cotQuery = new CenterOfThrustQuery();
+
+							if (module is ModuleEngines)
+							{
+								ModuleEngines engineModule = module as ModuleEngines;
+
+								moduleThrust = engineModule.finalThrust;
+
+								engineModule.OnCenterOfThrustQuery(cotQuery);
+							}
+							else // engine is ModuleEnginesFX
+							{
+								ModuleEnginesFX engineFXModule = module as ModuleEnginesFX;
+
+								moduleThrust = engineFXModule.finalThrust;
+
+								engineFXModule.OnCenterOfThrustQuery(cotQuery);
+							}
+
+							if (moduleThrust != 0d)
+							{
+								cotQuery.thrust = moduleThrust;
+							}
+
+							thrustPos += cotQuery.pos * cotQuery.thrust;
+							thrustDir += cotQuery.dir * cotQuery.thrust;
+							thrust += cotQuery.thrust;
 						}
-						else // engine is ModuleEnginesFX
-						{
-							ModuleEnginesFX engineFXModule = engine as ModuleEnginesFX;
-
-							moduleThrust = engineFXModule.finalThrust;
-
-							engineFXModule.OnCenterOfThrustQuery(cotQuery);
-						}
-
-						if (moduleThrust != 0d)
-						{
-							cotQuery.thrust = moduleThrust;
-						}
-
-						thrustPos += cotQuery.pos * cotQuery.thrust;
-						thrustDir += cotQuery.dir * cotQuery.thrust;
-						thrust += cotQuery.thrust;
-					}
-
+					}
 					if (thrust != 0)
 					{
 						thrustPos /= thrust;

--- a/VOID_EditorHUD.cs
+++ b/VOID_EditorHUD.cs
@@ -201,17 +201,29 @@
 		{
 			float hudLeft;
 
-			switch (EditorLogic.fetch.editorScreen)
-			{
-				case EditorScreen.Parts:
-					hudLeft = 16f + EditorPanels.Instance.partsEditor.panelTransform.rect.width +
-						EditorPanels.Instance.partcategorizerModes.transform.localPosition.x;
-					break;
-				case EditorScreen.Actions:
-					hudLeft = EditorPanels.Instance.actions.transform.localPosition.x + 464f;
-					break;
-				default:
-					return;
+			try
+			{
+				switch (EditorLogic.fetch.editorScreen)
+				{
+					case EditorScreen.Parts:
+						hudLeft = 16f + EditorPanels.Instance.partsEditor.panelTransform.rect.width +
+							EditorPanels.Instance.partcategorizerModes.transform.localPosition.x;
+						break;
+					case EditorScreen.Actions:
+						hudLeft = EditorPanels.Instance.actions.transform.localPosition.x + 464f;
+						break;
+					default:
+						return;
+				}
+			}
+			catch (NullReferenceException)
+			{
+				Logging.PostErrorMessage(
+					"[{0}]: Something was null when fetching panel geometry; skipping frame.",
+					this.GetType().FullName
+				);
+
+				return;
 			}
 
 			base.DrawGUI(this);

--- a/VOID_HUDAdvanced.cs
+++ b/VOID_HUDAdvanced.cs
@@ -80,7 +80,7 @@
 			this.leftHUD = new HUDWindow("leftHUD",
 				this.leftHUDWindow,
 				new Rect(
-					Screen.width * .5f - (float)GameSettings.UI_SCALE * .25f - 300f,
+					Screen.width * .5f - 300f - 220f * GameSettings.UI_SCALE,
 					Screen.height - 200f,
 					300f, 90f)
 			);
@@ -90,7 +90,7 @@
 				"rightHUD",
 				this.rightHUDWindow,
 				new Rect(
-					Screen.width * .5f + (float)GameSettings.UI_SCALE * .25f,
+					Screen.width * .5f + 180f * GameSettings.UI_SCALE,
 					Screen.height - 200f,
 					300f, 90f)
 			);
@@ -257,8 +257,6 @@
 
 		public override void DrawConfigurables()
 		{
-			base.DrawConfigurables();
-
 			if (GUILayout.Button(string.Intern("Reset Advanced HUD Positions"), GUILayout.ExpandWidth(false)))
 			{
 				HUDWindow window;

--- a/VOID_Orbital.cs
+++ b/VOID_Orbital.cs
@@ -113,7 +113,7 @@
             }
 
             GUILayout.EndVertical();
-            
+
 			base.ModuleWindow(id);
 		}
 
@@ -133,4 +133,3 @@
 	}
 }
 
-

--- a/VOID_StageInfo.cs
+++ b/VOID_StageInfo.cs
@@ -281,11 +281,11 @@
 
 		public override void DrawConfigurables()
 		{
-			this.showColumnSelection = GUILayout.Toggle(
+			/*this.showColumnSelection = GUILayout.Toggle(
 				this.showColumnSelection,
 				"Select StageInfo Columns",
 				GUI.skin.button
-			);
+			);*/
 		}
 
 		private void BodyPickerWindow(int _)