VOID_Data: Optimizations in thrust offset calcs.
VOID_Data: Optimizations in thrust offset calcs.

--- 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_Orbital.cs
+++ b/VOID_Orbital.cs
@@ -113,7 +113,7 @@
             }
 
             GUILayout.EndVertical();
-            
+
 			base.ModuleWindow(id);
 		}
 
@@ -133,4 +133,3 @@
 	}
 }
 
-