Merge branch 'master' into dev_1.2
Merge branch 'master' into dev_1.2

--- a/API/VOIDCore.cs
+++ b/API/VOIDCore.cs
@@ -40,6 +40,25 @@
 		public const double Constant_G = 6.674e-11;
 		public const int CONFIG_VERSION = 2;
 
+		public static event VOIDEventHandler onModulesLoaded;
+		public static event VOIDEventHandler onModulesDestroyed;
+
+		protected static void FireOnModulesLoaded(object sender)
+		{
+			if (onModulesLoaded != null)
+			{
+				onModulesLoaded(sender);
+			}
+		}
+
+		protected static void FireOnModulesDestroyed(object sender)
+		{
+			if (onModulesDestroyed != null)
+			{
+				onModulesDestroyed(sender);
+			}
+		}
+
 		public abstract int ConfigVersion { get; }
 		public virtual bool configNeedsUpdate { get; set; }
 
@@ -52,6 +71,8 @@
 		public abstract bool configDirty { get; set; }
 		public abstract bool powerAvailable	{ get; protected set; }
 
+		public virtual bool gameUIHidden { get; protected set; }
+
 		public abstract IList<IVOID_Module> Modules { get; }
 
 		public abstract float UpdateTimer { get; protected set; }
@@ -59,7 +80,7 @@
 
 		public virtual float saveTimer { get; protected set; }
 
-		public abstract GUISkin Skin { get; }
+		public virtual GUISkin Skin { get; protected set; }
 
 		public abstract CelestialBody HomeBody { get; }
 		public abstract List<CelestialBody> SortedBodyList { get; protected set; }
@@ -73,6 +94,12 @@
 		public abstract event VOIDEventHandler onApplicationQuit;
 		public abstract event VOIDEventHandler onSkinChanged;
 		public abstract event VOIDEventHandler onUpdate;
+
+		public abstract event VOIDEventHandler onPreForEach;
+		public abstract event VOIDForEachPartHandler onForEachPart;
+		public abstract event VOIDForEachPartModuleHandler onForEachModule;
+		public abstract event VOIDEventHandler onPostForEach;
+
 		public virtual event VOIDEventHandler onPreRender;
 		public virtual event VOIDEventHandler onPostRender;
 
@@ -86,7 +113,7 @@
 				{
 					ToadicusTools.Logging.PostDebugMessage(this, "Checking invoker {0}", invoker);
 
-					if (invoker == method)
+					if (System.Object.Equals(invoker, method))
 					{
 						ToadicusTools.Logging.PostDebugMessage(this, "Found match.");
 						return true;
@@ -114,7 +141,7 @@
 				{
 					ToadicusTools.Logging.PostDebugMessage(this, "Checking invoker {0}", invoker);
 
-					if (invoker == method)
+					if (System.Object.Equals(invoker, method))
 					{
 						ToadicusTools.Logging.PostDebugMessage(this, "Found match.");
 						return true;
@@ -134,6 +161,11 @@
 
 		public void OnGUI()
 		{
+			if (this.gameUIHidden)
+			{
+				return;
+			}
+
 			if (Event.current.type == EventType.Repaint || Event.current.isMouse)
 			{
 				if (this.onPreRender != null)
@@ -155,10 +187,32 @@
 		public override void Save(KSP.IO.PluginConfiguration config, string sceneKey)
 		{
 			base.Save(config, sceneKey);
+
 		}
 	}
 
 	public delegate void VOIDEventHandler(object sender);
+	public delegate void VOIDForEachPartHandler(object sender, VOIDForEachPartArgs args);
+	public delegate void VOIDForEachPartModuleHandler(object sender, VOIDForEachPartModuleArgs args);
+
+	public abstract class VOIDForEachEventArgs<T> : EventArgs where T : class
+	{
+		public T Data;
+
+		public VOIDForEachEventArgs(T data)
+		{
+			this.Data = data;
+		}
+	}
+
+	public class VOIDForEachPartArgs : VOIDForEachEventArgs<Part>
+	{
+		public VOIDForEachPartArgs(Part data) : base(data) {}
+	}
+	public class VOIDForEachPartModuleArgs : VOIDForEachEventArgs<PartModule>
+	{
+		public VOIDForEachPartModuleArgs(PartModule data) : base(data) {}
+	}
 }
 
 

--- a/API/VOID_Module.cs
+++ b/API/VOID_Module.cs
@@ -70,25 +70,6 @@
 		{
 			get
 			{
-				/*if (
-					RenderingManager.fetch == null ||
-					RenderingManager.fetch.postDrawQueue == null ||
-					RenderingManager.fetch.postDrawQueue.Length < 4
-				)
-				{
-					return false;
-				}
-				else
-				{
-					Delegate callback = RenderingManager.fetch.postDrawQueue[3];
-					if (callback == null)
-					{
-						return false;
-					}
-
-					return callback.GetInvocationList().Contains((Callback)this.DrawGUI);
-				}*/
-
 				using (var log = ToadicusTools.DebugTools.PooledDebugLogger.New(this))
 				{
 					log.AppendFormat("this.core: {0}\n", this.core != null ? this.core.ToString() : "null");
@@ -249,7 +230,6 @@
 			}
 
 			ToadicusTools.Logging.PostDebugMessage (string.Format("Adding {0} to the draw queue.", this.GetType().Name));
-			// RenderingManager.AddToPostDrawQueue (3, this.DrawGUI);
 			this.core.onPostRender += this.DrawGUI;
 		}
 
@@ -580,6 +560,7 @@
 			{
 				case GameScenes.EDITOR:
 					InputLockManager.SetControlLock(
+					ControlTypes.EDITOR_LOCK |
 						ControlTypes.EDITOR_ICON_HOVER | ControlTypes.EDITOR_ICON_PICK |
 						ControlTypes.EDITOR_PAD_PICK_COPY | ControlTypes.EDITOR_PAD_PICK_COPY,
 						this.inputLockName

--- a/Properties/AssemblyInfo.cs
+++ b/Properties/AssemblyInfo.cs
@@ -39,7 +39,7 @@
 // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
 // The form "{Major}.{Minor}.*" will automatically update the build and revision,
 // and "{Major}.{Minor}.{Build}.*" will update just the revision.
-[assembly: AssemblyVersion("0.18.5.*")]
+[assembly: AssemblyVersion("0.19.1.*")]
 // The following attributes are used to specify the signing key for the assembly,
 // if desired. See the Mono documentation for more information about signing.
 //[assembly: AssemblyDelaySign(false)]

--- a/VOID.csproj
+++ b/VOID.csproj
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
 <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <PropertyGroup>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug_win</Configuration>
@@ -26,7 +26,10 @@
     <ConsolePause>false</ConsolePause>
     <CustomCommands>
       <CustomCommands>
-        <Command type="AfterBuild" command="xcopy /Y ${TargetFile} ${ProjectDir}\GameData\VOID\Plugins\" />
+        <Command>
+          <type>AfterBuild</type>
+          <command>xcopy /Y ${TargetFile} ${ProjectDir}\GameData\VOID\Plugins\</command>
+        </Command>
       </CustomCommands>
     </CustomCommands>
   </PropertyGroup>
@@ -36,10 +39,14 @@
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <ConsolePause>false</ConsolePause>
-    <DefineConstants>TRACE</DefineConstants>
+    <DefineConstants>
+    </DefineConstants>
     <CustomCommands>
       <CustomCommands>
-        <Command type="AfterBuild" command="xcopy /Y ${TargetFile} ${ProjectDir}\GameData\VOID\Plugins\" />
+        <Command>
+          <type>AfterBuild</type>
+          <command>xcopy /Y ${TargetFile} ${ProjectDir}\GameData\VOID\Plugins\</command>
+        </Command>
       </CustomCommands>
     </CustomCommands>
   </PropertyGroup>
@@ -54,7 +61,10 @@
     <ConsolePause>false</ConsolePause>
     <CustomCommands>
       <CustomCommands>
-        <Command type="AfterBuild" command="cp -afv ${TargetFile} ${ProjectDir}/GameData/${ProjectName}/Plugins/" />
+        <Command>
+          <type>AfterBuild</type>
+          <command>cp -afv ${TargetFile} ${ProjectDir}/GameData/${ProjectName}/Plugins/</command>
+        </Command>
       </CustomCommands>
     </CustomCommands>
   </PropertyGroup>
@@ -67,7 +77,10 @@
     <ConsolePause>false</ConsolePause>
     <CustomCommands>
       <CustomCommands>
-        <Command type="AfterBuild" command="cp -afv ${TargetFile} ${ProjectDir}/GameData/${ProjectName}/Plugins/" />
+        <Command>
+          <type>AfterBuild</type>
+          <command>cp -afv ${TargetFile} ${ProjectDir}/GameData/${ProjectName}/Plugins/</command>
+        </Command>
       </CustomCommands>
     </CustomCommands>
   </PropertyGroup>
@@ -121,23 +134,18 @@
     <MonoDevelop>
       <Properties>
         <Policies>
-          <TextStylePolicy FileWidth="120" TabsToSpaces="False" EolMarker="Unix" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="text/plain" />
+          <TextStylePolicy TabWidth="4" IndentWidth="4" RemoveTrailingWhitespace="True" NoTabsAfterNonTabs="False" FileWidth="120" TabsToSpaces="False" EolMarker="Unix" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="text/plain" />
         </Policies>
       </Properties>
     </MonoDevelop>
   </ProjectExtensions>
   <ItemGroup>
-    <Reference Include="System">
-      <HintPath>..\_KSPAssemblies\System.dll</HintPath>
-    </Reference>
     <Reference Include="Assembly-CSharp">
       <HintPath>..\_KSPAssemblies\Assembly-CSharp.dll</HintPath>
     </Reference>
+    <Reference Include="System" />
     <Reference Include="UnityEngine">
       <HintPath>..\_KSPAssemblies\UnityEngine.dll</HintPath>
-    </Reference>
-    <Reference Include="KSPUtil">
-      <HintPath>..\_KSPAssemblies\KSPUtil.dll</HintPath>
     </Reference>
     <Reference Include="UnityEngine.UI">
       <HintPath>..\_KSPAssemblies\UnityEngine.UI.dll</HintPath>
@@ -159,10 +167,8 @@
   <ItemGroup>
     <None Include="GameData\VOID\Textures\ATM_VOID.cfg" />
   </ItemGroup>
-  <ItemGroup>
-    <Folder Include="API\" />
-    <Folder Include="Tools\" />
-    <Folder Include="API\Attributes\" />
-  </ItemGroup>
+  <ItemGroup />
+  <PropertyGroup>
+    <PostBuildEvent>xcopy /Y $(TargetPath) $(ProjectDir)GameData\$(ProjectName)\Plugins\</PostBuildEvent>
+  </PropertyGroup>
 </Project>
-

--- a/VOIDCore_Generic.cs
+++ b/VOIDCore_Generic.cs
@@ -104,7 +104,7 @@
 		protected bool vesselTypesLoaded = false;
 		protected bool simManagerLoaded = false;
 
-		protected string defaultSkin = "KSP window 2";
+		protected string defaultSkin = "KSPSkin";
 
 		[AVOID_SaveValue("defaultSkin")]
 		protected VOID_SaveValue<string> skinName;
@@ -198,25 +198,6 @@
 			}
 		}
 
-		public override GUISkin Skin
-		{
-			get
-			{
-				if (this.skinsLoaded)
-				{
-					try
-					{
-						return this.validSkins[this.skinName];
-					}
-					catch
-					{
-					}
-				}
-
-				return AssetBase.GetGUISkin(this.defaultSkin);
-			}
-		}
-
 		public override List<CelestialBody> SortedBodyList
 		{
 			get;
@@ -321,6 +302,11 @@
 		public override event VOIDEventHandler onSkinChanged;
 		public override event VOIDEventHandler onUpdate;
 
+		public override event VOIDEventHandler onPreForEach;
+		public override event VOIDForEachPartHandler onForEachPart;
+		public override event VOIDForEachPartModuleHandler onForEachModule;
+		public override event VOIDEventHandler onPostForEach;
+
 		/*
 		 * Methods
 		 * */
@@ -331,14 +317,18 @@
 			if (!this.modulesLoaded)
 			{
 				this.LoadModulesOfType<IVOID_Module>();
+
+				FireOnModulesLoaded(this);
 			}
 
 			if (!this.skinsLoaded)
 			{
 				this.LoadSkins();
 			}
-
-			GUI.skin = this.Skin;
+			else
+			{
+				GUI.skin = this.Skin;
+			}
 
 			if (!this.GUIStylesLoaded)
 			{
@@ -385,9 +375,61 @@
 			{
 				Logging.PostDebugMessage(this, "Updating SimManager.");
 				this.UpdateSimManager();
-			}
-
-			if (!this.GUIRunning)
+
+				VOIDForEachPartArgs partArgs;
+				VOIDForEachPartModuleArgs moduleArgs;
+
+				Part part;
+				PartModule partModule;
+
+				bool doForEachPart = this.onForEachPart != null;
+				bool doForEachModule = this.onForEachModule != null;
+
+				if (
+					(doForEachPart || doForEachModule) &&
+					(this.Vessel != null) &&
+					(this.Vessel.parts != null) &&
+					this.timeToUpdate
+				)
+				{
+					if (this.onPreForEach != null)
+					{
+						this.onPreForEach(this);
+					}
+
+					for (int pIdx = 0; pIdx < this.Vessel.parts.Count; pIdx++)
+					{
+						part = this.Vessel.parts[pIdx];
+						partArgs = new VOIDForEachPartArgs(part);
+
+						if (doForEachPart)
+						{
+							this.onForEachPart(this, partArgs);
+						}
+
+						if (doForEachModule && part.Modules != null)
+						{
+							for (int mIdx = 0; mIdx < part.Modules.Count; mIdx++)
+							{
+								partModule = part.Modules[mIdx];
+								moduleArgs = new VOIDForEachPartModuleArgs(partModule);
+
+								if (doForEachModule)
+								{
+									this.onForEachModule(this, moduleArgs);
+								}
+							}
+						}
+					}
+
+					if (this.onPostForEach!= null)
+					{
+						this.onPostForEach(this);
+					}
+				}
+			}
+
+			if (!this.GUIRunning && !this.gameUIHidden)
 			{
 				this.StartGUI();
 			}
@@ -432,32 +474,64 @@
 				}
 			}
 
-			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();
-				}
-
+			}
+
+			if (this.onUpdate != null)
+			{
+				this.onUpdate(this);
 			}
 
 			this.saveTimer += Time.deltaTime;
@@ -479,11 +553,6 @@
 			}
 
 			this.UpdateTimer += Time.deltaTime;
-
-			if (this.onUpdate != null)
-			{
-				this.onUpdate(this);
-			}
 		}
 
 		public virtual void FixedUpdate()
@@ -539,6 +608,8 @@
 				}
 			}
 
+			FireOnModulesDestroyed(this);
+
 			this.Dispose();
 		}
 
@@ -556,7 +627,6 @@
 		{
 			if (!this.GUIRunning)
 			{
-				// RenderingManager.AddToPostDrawQueue(3, this.DrawGUI);
 				Logging.PostDebugMessage(this, "Adding DrawGUI to onGui");
 				this.onPostRender += this.DrawGUI;
 			}
@@ -688,6 +758,7 @@
 
 			GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
 
+			int oldSkinIdx = this.skinIdx;
 			GUILayout.Label("Skin:", GUILayout.ExpandWidth(false));
 
 			_content = new GUIContent();
@@ -726,6 +797,11 @@
 			if (this.skinIdx < 0)
 			{
 				this.skinIdx += this.skinNames.Count;
+			}
+
+			if (this.skinIdx != oldSkinIdx)
+			{
+				this.Skin = this.validSkins [this.skinNames [this.skinIdx]];
 			}
 
 			if (this.skinName != skinNames[this.skinIdx])
@@ -922,12 +998,13 @@
 
 				if (!this.forbiddenSkins.Contains(skin.name))
 				{
+					Logging.PostLogMessage ("[{0}]: Found skin: {1}", this.GetType().Name, skin.name);
 					this.validSkins[skin.name] = skin;
 					this.skinNames.Add(skin.name);
 				}
 			}
 
-			Logging.PostDebugMessage(string.Format(
+			Logging.PostLogMessage(string.Format(
 				"{0}: loaded {1} GUISkins.",
 				this.GetType().Name,
 				this.validSkins.Count
@@ -958,7 +1035,9 @@
 				this.skinIdx = defaultIdx;
 			}
 
-			Logging.PostDebugMessage(string.Format(
+			this.Skin = this.validSkins [this.skinNames [this.skinIdx]];
+
+			Logging.PostLogMessage(string.Format(
 				"{0}: _skinIdx = {1}.",
 				this.GetType().Name,
 				this.skinName.ToString()
@@ -1012,51 +1091,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
-					)
-				);
 			}
 		}
 
@@ -1197,6 +1231,20 @@
 			this.VOIDSettingsPath = string.Format("{0}/VOIDConfig.xml", this.SaveGamePath);
 
 			this.FactoryReset = false;
+
+			GameEvents.onHideUI.Add(() =>
+				{
+					this.gameUIHidden = true;
+					this.StopGUI();
+				}
+			);
+
+			GameEvents.onShowUI.Add(() =>
+				{
+					this.gameUIHidden = false;
+					this.StartGUI();
+				}
+			);
 		}
 
 		public override void Dispose()

--- a/VOID_Data.cs
+++ b/VOID_Data.cs
@@ -486,94 +486,97 @@
 				""
 			);
 
+		private static Vector3 thrustPos;
+		private static Vector3 thrustDir;
+		private static float thrust;
+
+		private static void thrustOffsetPreForEach(object sender)
+		{
+			thrustPos = Vector3.zero;
+			thrustDir = Vector3.zero;
+			thrust = 0;
+		}
+
+		private static void thrustOffSetPerModule(object sender, VOIDForEachPartModuleArgs args)
+		{
+			PartModule module = args.Data;
+
+			float moduleThrust = 0;
+
+			switch (module.moduleName)
+			{
+				case "ModuleEngines":
+				case "ModuleEnginesFX":
+					break;
+				default:
+					return;
+			}
+
+			if (!module.isEnabled)
+			{
+				return;
+			}
+
+			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;
+		}
+
 		public static readonly VOID_Vector3Value vesselThrustOffset =
 			new VOID_Vector3Value(
 				"Thrust Offset",
 				delegate()
 				{
-					if (Core.Vessel == null)
-					{
-						return Vector3.zero;
-					}
-
-					IList<PartModule> engineModules = Core.Vessel.getModulesOfType<PartModule>();
-
-					Vector3 thrustPos = Vector3.zero;
-					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)
-						{
-							continue;
-						}
-
-						CenterOfThrustQuery cotQuery = new CenterOfThrustQuery();
-
-						if (engine is ModuleEngines)
-						{
-							ModuleEngines engineModule = engine as ModuleEngines;
-
-							moduleThrust = engineModule.finalThrust;
-
-							engineModule.OnCenterOfThrustQuery(cotQuery);
-						}
-						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;
-					}
+					Vector3 pos = thrustPos;
+					Vector3 dir = thrustDir;
 
 					if (thrust != 0)
 					{
-						thrustPos /= thrust;
-						thrustDir /= thrust;
+						pos /= thrust;
+						dir /= thrust;
 					}
 
 					Transform vesselTransform = Core.Vessel.transform;
 
-					thrustPos = vesselTransform.InverseTransformPoint(thrustPos);
-					thrustDir = vesselTransform.InverseTransformDirection(thrustDir);
+					pos = vesselTransform.InverseTransformPoint(pos);
+					dir = vesselTransform.InverseTransformDirection(dir);
 
 					Vector3 thrustOffset = VectorTools.PointDistanceToLine(
-						                        thrustPos, thrustDir.normalized, Core.Vessel.findLocalCenterOfMass());
+						pos, dir.normalized, Core.Vessel.CoM);
 
 					Logging.PostDebugMessage(typeof(VOID_Data), "vesselThrustOffset:\n" +
 					"\tthrustPos: {0}\n" +
 					"\tthrustDir: {1}\n" +
 					"\tthrustOffset: {2}\n" +
 					"\tvessel.CoM: {3}",
-						thrustPos,
-						thrustDir.normalized,
+						pos,
+						dir.normalized,
 						thrustOffset,
-						Core.Vessel.findWorldCenterOfMass()
+						Core.Vessel.CoM
 					);
 
 					return thrustOffset;
@@ -585,90 +588,106 @@
 
 		#region Air Breathing
 
+		private static double airFlowCurrent;
+		private static double airFlowRequired;
+		private static string intakeAirString;
+
+		private static void intakeAirPreForEach(object sender)
+		{
+			airFlowCurrent = 0d;
+			airFlowRequired = 0d;
+			intakeAirString = string.Empty;
+		}
+
+		private static void intakeAirForEachModule(object sender, VOIDForEachPartModuleArgs args)
+		{
+			PartModule module = args.Data;
+			List<Propellant> propellantList = null;
+
+			if (!module.part.enabled)
+			{
+				return;
+			}
+
+			if (module is ModuleEngines)
+			{
+				propellantList = ((ModuleEngines)module).propellants;
+			}
+			else if (module is ModuleEnginesFX)
+			{
+				propellantList = ((ModuleEnginesFX)module).propellants;
+			}
+			else if (module is ModuleResourceIntake)
+			{
+				ModuleResourceIntake intakeModule = (ModuleResourceIntake)module;
+
+				if (intakeModule.resourceName == "IntakeAir")
+				{
+					airFlowCurrent += intakeModule.airFlow;
+				}
+			}
+
+			if (propellantList != null)
+			{
+				Propellant propellant;
+				for (int propIdx = 0; propIdx < propellantList.Count; propIdx++)
+				{
+					propellant = propellantList[propIdx];
+
+					if (propellant.name == "IntakeAir")
+					{
+						airFlowRequired += propellant.currentRequirement / TimeWarp.fixedDeltaTime;
+						break;
+					}
+				}
+			}
+		}
+
 		public static readonly VOID_StrValue intakeAirStatus =
 			new VOID_StrValue(
 				"Intake Air (Curr / Req)",
 				delegate()
 				{
-					double currentAmount;
-					double currentRequirement;
-
-					currentAmount = 0d;
-					currentRequirement = 0d;
-
-					Part part;
-					for (int idx = 0; idx < Core.Vessel.Parts.Count; idx++)
-					{
-						part = Core.Vessel.Parts[idx];
-
-						if (part.enabled)
-						{
-							ModuleEngines engineModule;
-							ModuleEnginesFX enginesFXModule;
-							List<Propellant> propellantList = null;
-
-							if (part.tryGetFirstModuleOfType<ModuleEngines>(out engineModule))
-							{
-								propellantList = engineModule.propellants;
-							}
-							else if (part.tryGetFirstModuleOfType<ModuleEnginesFX>(out enginesFXModule))
-							{
-								propellantList = enginesFXModule.propellants;
-							}
-
-							if (propellantList != null)
-							{
-								Propellant propellant;
-								for (int propIdx = 0; propIdx < propellantList.Count; propIdx++)
-								{
-									propellant = propellantList[propIdx];
-
-									if (propellant.name == "IntakeAir")
-									{
-										currentRequirement += propellant.currentRequirement / TimeWarp.fixedDeltaTime;
-										break;
-									}
-								}
-							}
-						}
-
-						ModuleResourceIntake intakeModule;
-
-						if (part.enabled && part.tryGetFirstModuleOfType<ModuleResourceIntake>(out intakeModule))
-						{
-							if (intakeModule.resourceName == "IntakeAir")
-							{
-								currentAmount += intakeModule.airFlow;
-							}
-						}
-					}
-
-					if (currentAmount == 0 && currentRequirement == 0)
-					{
-						return "N/A";
-					}
-
-					return string.Format("{0:F3} / {1:F3}", currentAmount, currentRequirement);
+					if (airFlowCurrent == 0 && airFlowRequired == 0)
+					{
+						intakeAirString = "N/A";
+					}
+					else
+					{
+						intakeAirString = string.Format("{0:F3} / {1:F3}", airFlowCurrent, airFlowRequired);
+					}
+
+					return intakeAirString;
 				}
 			);
 
 		#endregion
 
 		#region Crew
+
+		private static int crewCount;
+		private static int crewCapacity;
+
+		private static void crewCountPreForEach(object sender)
+		{
+			crewCount = 0;
+			crewCapacity = 0;
+		}
+
+		private static void crewCountPerPart(object sender, VOIDForEachPartArgs args)
+		{
+			Part part = args.Data;
+
+			crewCount += part.protoModuleCrew.Count;
+			crewCapacity += part.CrewCapacity;
+		}
 
 		public static readonly VOID_IntValue vesselCrewCount =
 			new VOID_IntValue(
 				"Crew Onboard",
 				delegate()
 				{
-					if (Core.Vessel != null)
-					{
-						return Core.Vessel.GetCrewCount();
-					}
-					else
-					{
-						return 0;
-					}
+					return crewCount;
 				},
 				""
 			);
@@ -678,14 +697,7 @@
 				"Crew Capacity",
 				delegate()
 				{
-					if (Core.Vessel != null)
-					{
-						return Core.Vessel.GetCrewCapacity();
-					}
-					else
-					{
-						return 0;
-					}
+					return crewCapacity;
 				},
 				""
 			);
@@ -1134,7 +1146,7 @@
 				delegate()
 				{
 					double orbitRadius = Core.Vessel.mainBody.Radius +
-					                     Core.Vessel.mainBody.GetAltitude(Core.Vessel.findWorldCenterOfMass());
+					                     Core.Vessel.mainBody.GetAltitude(Core.Vessel.CoM);
 					return (VOIDCore.Constant_G * Core.Vessel.mainBody.Mass) /
 					(orbitRadius * orbitRadius);
 				},
@@ -1171,7 +1183,7 @@
 		public static readonly VOID_DoubleValue trueAnomaly = 
 			new VOID_DoubleValue(
 				"True Anomaly",
-				new Func<double>(() => Core.Vessel.orbit.trueAnomaly),
+				new Func<double>(() => Core.Vessel.orbit.trueAnomaly * 180d / Math.PI),
 				"°"
 			);
 
@@ -1341,6 +1353,46 @@
 
 			return burntime;
 		}
+
+		private static void onFlightModulesLoaded(object sender)
+		{
+			if (sender is VOIDCore_Flight)
+			{
+				VOIDCore_Flight flightCore = sender as VOIDCore_Flight;
+
+				flightCore.onPreForEach += thrustOffsetPreForEach;
+				flightCore.onForEachModule += thrustOffSetPerModule;
+
+				flightCore.onPreForEach += intakeAirPreForEach;
+				flightCore.onForEachModule += intakeAirForEachModule;
+
+				flightCore.onPreForEach += crewCountPreForEach;
+				flightCore.onForEachPart += crewCountPerPart;
+			}
+		}
+
+		private static void onFlightModulesDestroyed(object sender)
+		{
+			if (sender is VOIDCore_Flight)
+			{
+				VOIDCore_Flight flightCore = sender as VOIDCore_Flight;
+
+				flightCore.onPreForEach -= thrustOffsetPreForEach;
+				flightCore.onForEachModule -= thrustOffSetPerModule;
+
+				flightCore.onPreForEach -= intakeAirPreForEach;
+				flightCore.onForEachModule -= intakeAirForEachModule;
+
+				flightCore.onPreForEach -= crewCountPreForEach;
+				flightCore.onForEachPart -= crewCountPerPart;
+			}
+		}
+
+		static VOID_Data()
+		{
+			VOIDCore_Flight.onModulesLoaded += onFlightModulesLoaded;
+			VOIDCore_Flight.onModulesDestroyed += onFlightModulesDestroyed;
+		}
 	}
 }
 

--- a/VOID_EditorHUD.cs
+++ b/VOID_EditorHUD.cs
@@ -28,6 +28,7 @@
 
 using KerbalEngineer.VesselSimulator;
 using KSP;
+using KSP.UI.Screens;
 using System;
 using System.Collections.Generic;
 using System.Text;
@@ -110,7 +111,7 @@
 			this.ehudWindow = new HUDWindow(
 				"editorHUD",
 				this.ehudWindowFunc,
-				new Rect(/*EditorPanels.Instance.partsPanelWidth + */10f, 125f, 300f, 64f)
+				new Rect(10f, 125f, 300f, 64f)
 			);
 			this.Windows.Add(this.ehudWindow);
 
@@ -200,32 +201,30 @@
 		{
 			float hudLeft;
 
-			if (EditorLogic.fetch.editorScreen == EditorScreen.Parts)
-			{
-				hudLeft = /*EditorPanels.Instance.partsPanelWidth + */10f;
-				hudLeft += /*EditorPartList.Instance.transformTopLeft.position.x -*/
-					/*EditorPartList.Instance.transformTopLeft.parent.parent.position.x -*/
-					72f;
-			}
-			else if (EditorLogic.fetch.editorScreen == EditorScreen.Actions)
-			{
-				hudLeft = /*EditorPanels.Instance.actionsPanelWidth +*/ 10f;
-			}
-			else
-			{
+			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;
 			}
-
-			/*Logging.PostDebugMessage(this,
-				"EditorPartList topLeft.parent.parent.position: {0}\n" +
-				"EditorPartList topLeft.parent.position: {1}\n" +
-				"EditorPartList topLeft.position: {2}\n" +
-				"snapToEdge: {3} (pos.Xmin: {4}; hudLeft: {5})",
-				EditorPartList.Instance.transformTopLeft.parent.parent.position,
-				EditorPartList.Instance.transformTopLeft.parent.position,
-				EditorPartList.Instance.transformTopLeft.position,
-				this.snapToLeft, this.ehudWindow.WindowPos.xMin, hudLeft
-			);*/
 
 			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_Rendezvous.cs
+++ b/VOID_Rendezvous.cs
@@ -202,7 +202,7 @@
 
 					GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
 					GUILayout.Label("Distance:");
-					GUILayout.Label(SIFormatProvider.ToSI((Vessel.findWorldCenterOfMass() - v.findWorldCenterOfMass()).magnitude, 3) + "m", GUILayout.ExpandWidth(false));
+					GUILayout.Label(SIFormatProvider.ToSI((Vessel.CoM - v.CoM).magnitude, 3) + "m", GUILayout.ExpandWidth(false));
 					GUILayout.EndHorizontal();
 
 					// Toadicus edit: added local sidereal longitude.
@@ -272,7 +272,7 @@
 
 					GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
 					GUILayout.Label("Distance:");
-					GUILayout.Label(SIFormatProvider.ToSI((Vessel.findWorldCenterOfMass() - v.findWorldCenterOfMass()).magnitude, 3) + "m", GUILayout.ExpandWidth(false));
+					GUILayout.Label(SIFormatProvider.ToSI((Vessel.CoM - v.CoM).magnitude, 3) + "m", GUILayout.ExpandWidth(false));
 					GUILayout.EndHorizontal();
 				}
 			}

--- a/VOID_StageInfo.cs
+++ b/VOID_StageInfo.cs
@@ -32,8 +32,6 @@
 		private bool showBodyList;
 		private Rect bodyListPos;
 
-		private bool showColumnSelection;
-
 		private CelestialBody _selectedBody;
 		[AVOID_SaveValue("bodyIdx")]
 		private VOID_SaveValue<int> bodyIdx;
@@ -66,7 +64,6 @@
 
 			this.stylesApplied = false;
 			this.showBodyList = false;
-			this.showColumnSelection = false;
 
 			this.bodyListPos = new Rect();
 
@@ -281,11 +278,7 @@
 
 		public override void DrawConfigurables()
 		{
-			this.showColumnSelection = GUILayout.Toggle(
-				this.showColumnSelection,
-				"Select StageInfo Columns",
-				GUI.skin.button
-			);
+			
 		}
 
 		private void BodyPickerWindow(int _)

--- a/VOID_Styles.cs
+++ b/VOID_Styles.cs
@@ -33,12 +33,6 @@
 {
 	public static class VOID_Styles
 	{
-		public static bool Ready
-		{
-			get;
-			private set;
-		}
-
 		public static GUIStyle labelDefault
 		{
 			get;
@@ -115,17 +109,12 @@
 
 			labelGreen = new GUIStyle(GUI.skin.label);
 			labelGreen.normal.textColor = Color.green;
-
-			Ready = true;
 		}
 
 		static VOID_Styles()
 		{
 			OnSkinChanged();
-
-			Ready = false;
 		}
 	}
 }
 
-