VOID_StageInfo: Added a toggle to use sea level conditions in VesselSimulator calcs.
VOID_StageInfo: Added a toggle to use sea level conditions in VesselSimulator calcs.

--- 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;
 

--- a/VOID_StageInfo.cs
+++ b/VOID_StageInfo.cs
@@ -40,6 +40,12 @@
 		private VOID_SaveValue<int> bodyIdx;
 		private int lastIdx;
 
+		private bool showAdvanced;
+
+		[AVOID_SaveValue("UseSealLevel")]
+		private VOID_SaveValue<bool> useSeaLevel;
+		private GUIContent seaLevelToggle;
+
 		public VOID_StageInfo() : base()
 		{
 			this.Name = "Stage Information";
@@ -87,6 +93,15 @@
 
 			this.stageTimeCol = new Table.Column<string>("Burn Time", 20f);
 			this.stageTable.Add(this.stageTimeCol);
+
+			this.showAdvanced = false;
+
+			this.useSeaLevel = false;
+
+			seaLevelToggle = new GUIContent(
+				"Use Sea Level",
+				"Use 'sea' level atmospheric conditions on bodies with atmospheres."
+			);
 		}
 
 		public override void DrawGUI()
@@ -101,6 +116,11 @@
 
 		public override void ModuleWindow(int _)
 		{
+			if (this.selectedBody == null)
+			{
+				this.selectedBody = core.HomeBody;
+			}
+
 			if (
 				!HighLogic.LoadedSceneIsFlight ||
 				(TimeWarp.WarpMode == TimeWarp.Modes.LOW) ||
@@ -129,6 +149,15 @@
 				return;
 			}
 
+			if (HighLogic.LoadedSceneIsEditor && this.selectedBody.atmosphere && this.useSeaLevel)
+			{
+				SimManager.Atmosphere = this.selectedBody.atmosphereMultiplier * 101.325d;
+			}
+			else
+			{
+				SimManager.Atmosphere = 0d;
+			}
+
 			foreach (Stage stage in core.Stages)
 			{
 				if (stage.deltaV == 0 && stage.mass == 0)
@@ -195,6 +224,28 @@
 					this.selectedBody = core.sortedBodyList[this.bodyIdx];
 				}
 
+				if (HighLogic.LoadedSceneIsEditor)
+				{
+					if (
+						GUILayout.Button(
+							this.showAdvanced ? "▲" : "▼",
+							GUILayout.ExpandWidth(false)
+						)
+					)
+					{
+						this.showAdvanced = !this.showAdvanced;
+					}
+				}
+
+				GUILayout.EndHorizontal();
+			}
+
+			if (this.showAdvanced && HighLogic.LoadedSceneIsEditor)
+			{
+				GUILayout.BeginHorizontal();
+
+				this.useSeaLevel.value = GUITools.Toggle(this.useSeaLevel, this.seaLevelToggle, false);
+
 				GUILayout.EndHorizontal();
 			}