Quick change to use an async callback for gathering SimManager results.
Quick change to use an async callback for gathering SimManager results.

--- a/API/VOID_Module.cs
+++ b/API/VOID_Module.cs
@@ -519,7 +519,7 @@
 			}
 		}
 
-		public static Action<int> DecorateWindow(Action<int> func, Rect windowRect, Callback<bool> callBack)
+		public static Action<int> DecorateWindow(Action<int> func, Rect windowRect, Callback<bool> callBack, bool useCache)
 		{
 			if (DecoratedWindows == null)
 			{
@@ -528,7 +528,7 @@
 
 			int hashCode = func.GetHashCode();
 
-			if (!DecoratedWindows.ContainsKey(hashCode))
+			if (!useCache || !DecoratedWindows.ContainsKey(hashCode))
 			{
 				DecoratedWindows[hashCode] = delegate(int id)
 				{
@@ -563,6 +563,11 @@
 			return DecoratedWindows[hashCode];
 		}
 
+		public static Action<int> DecorateWindow(Action<int> func, Rect windowRect, Callback<bool> callBack)
+		{
+			return DecorateWindow(func, windowRect, callBack, true);
+		}
+
 		public static void UncacheWindow(Action<int> func)
 		{
 			if (DecoratedWindows != null)

--- a/VOIDCore_Generic.cs
+++ b/VOIDCore_Generic.cs
@@ -727,15 +727,6 @@
 		{
 			if (SimManager.ResultsReady())
 			{
-				Tools.PostDebugMessage(this, "VesselSimulator results ready, setting Stages.");
-
-				this.Stages = SimManager.Stages;
-
-				if (this.Stages != null)
-				{
-					this.LastStage = this.Stages.Last();
-				}
-
 				if (HighLogic.LoadedSceneIsEditor)
 				{
 					SimManager.Gravity = VOID_Data.KerbinGee;
@@ -756,6 +747,18 @@
 				Tools.PostDebugMessage(this, "VesselSimulator results not ready.");
 			}
 			#endif
+		}
+
+		protected void GetSimManagerResults()
+		{
+			Tools.PostDebugMessage(this, "VesselSimulator results ready, setting Stages.");
+
+			this.Stages = SimManager.Stages;
+
+			if (this.Stages != null)
+			{
+				this.LastStage = this.Stages.Last();
+			}
 		}
 
 		protected void LoadModulesOfType<U>()
@@ -1147,6 +1150,8 @@
 			this.updateTimer = 0f;
 
 			this.vesselSimActive = true;
+			SimManager.Atmosphere = 0d;
+			SimManager.OnReady += this.GetSimManagerResults;
 
 			this.UseToolbarManager = ToolbarManager.ToolbarAvailable;