Changed up the window modules to inherit the generic stuff. Adding more and more modules. CBInfoBrowser in progress.
--- a/IVOID_Module.cs
+++ b/IVOID_Module.cs
@@ -36,7 +36,7 @@
void LoadConfig();
- void SaveConfig();
+ void _SaveToConfig(KSP.IO.PluginConfiguration config);
}
}
--- a/Tools.cs
+++ b/Tools.cs
@@ -586,20 +586,6 @@
else if (heading > 326.25 && heading <= 348.75) return "NNW";
else return "";
}
-
- public static double[] ParseXYString(string s)
- {
- string[] xy = s.Split (',');
- if (xy.Length != 2)
- {
- throw new ArgumentException ("Argument must be of the format 'x,y'.");
- }
-
- double x = double.Parse (xy [0].Trim ());
- double y = double.Parse (xy [1].Trim ());
-
- return new double[] { x, y };
- }
private static ScreenMessage debugmsg = new ScreenMessage("", 2f, ScreenMessageStyle.UPPER_RIGHT);
--- a/VOIDFlightMaster.cs
+++ b/VOIDFlightMaster.cs
@@ -60,6 +60,12 @@
}
this.Core.Update ();
+
+ if (this.Core.vessel != null)
+ {
+ SimManager.Instance.Gravity = VOID_Core.Instance.vessel.mainBody.gravParameter / Math.Pow(VOID_Core.Instance.vessel.mainBody.Radius, 2);
+ SimManager.Instance.TryStartSimulation();
+ }
}
public void FixedUpdate()
@@ -338,491 +344,6 @@
// }
// }
//
-// private void load_old_settings()
-// {
-// if (KSP.IO.File.Exists<VOIDFlightMaster>("VOID.cfg", null))
-// {
-// string[] data = KSP.IO.File.ReadAllLines<VOIDFlightMaster>("VOID.cfg", null);
-// string[] name_val;
-// string[] temp;
-// string name = "";
-// string val = "";
-//
-// foreach (string s in data)
-// {
-// name_val = s.Split('=');
-// name = name_val[0].Trim();
-// val = name_val[1].Trim();
-//
-// if (val != "")
-// {
-// if (name == "MAIN WINDOW POS")
-// {
-// temp = val.Split(',');
-// //window_0_pos = new Rect(Convert.ToSingle(temp[0].Trim()), Convert.ToSingle(temp[1].Trim()), 10, 10);
-// main_window_pos.x = Convert.ToSingle(temp[0].Trim());
-// main_window_pos.y = Convert.ToSingle(temp[1].Trim());
-// }
-// if (name == "VOID WINDOW POS")
-// {
-// temp = val.Split(',');
-// void_window_pos = new Rect(Convert.ToSingle(temp[0].Trim()), Convert.ToSingle(temp[1].Trim()), 10f, 10f);
-// }
-// if (name == "ATMO WINDOW POS")
-// {
-// temp = val.Split(',');
-// atmo_window_pos = new Rect(Convert.ToSingle(temp[0].Trim()), Convert.ToSingle(temp[1].Trim()), 10f, 10f);
-// }
-// if (name == "TAD WINDOW POS")
-// {
-// temp = val.Split(',');
-// transfer_window_pos = new Rect(Convert.ToSingle(temp[0].Trim()), Convert.ToSingle(temp[1].Trim()), 10f, 10f);
-// }
-// if (name == "VESREG WINDOW POS")
-// {
-// temp = val.Split(',');
-// vessel_register_window_pos = new Rect(Convert.ToSingle(temp[0].Trim()), Convert.ToSingle(temp[1].Trim()), 10f, 10f);
-// }
-// if (name == "DATATIME WINDOW POS")
-// {
-// temp = val.Split(',');
-// data_logging_window_pos = new Rect(Convert.ToSingle(temp[0].Trim()), Convert.ToSingle(temp[1].Trim()), 10f, 10f);
-// }
-// if (name == "VESINFO WINDOW POS")
-// {
-// temp = val.Split(',');
-// vessel_info_window_pos = new Rect(Convert.ToSingle(temp[0].Trim()), Convert.ToSingle(temp[1].Trim()), 10f, 10f);
-// }
-// if (name == "MISC WINDOW POS")
-// {
-// temp = val.Split(',');
-// misc_window_pos = new Rect(Convert.ToSingle(temp[0].Trim()), Convert.ToSingle(temp[1].Trim()), 10f, 10f);
-// }
-// if (name == "CELINFO WINDOW POS")
-// {
-// temp = val.Split(',');
-// body_op_window_pos = new Rect(Convert.ToSingle(temp[0].Trim()), Convert.ToSingle(temp[1].Trim()), 10f, 10f);
-// }
-// if (name == "RENDEZVOUS WINDOW POS")
-// {
-// temp = val.Split(',');
-// rendezvous_info_window_pos = new Rect(Convert.ToSingle(temp[0].Trim()), Convert.ToSingle(temp[1].Trim()), 10f, 10f);
-// }
-// if (name == "ICON POS")
-// {
-// temp = val.Split(',');
-// main_icon_pos = new Rect(Convert.ToSingle(temp[0].Trim()), Convert.ToSingle(temp[1].Trim()), 30f, 30f);
-// }
-// if (name == "HUD MODULE") toggleHUDModule = Boolean.Parse(val);
-// if (name == "VOID MODULE") void_module = Boolean.Parse(val);
-// if (name == "ATMO MODULE") atmo_module = Boolean.Parse(val);
-// if (name == "TAD MODULE") tad_module = Boolean.Parse(val);
-// if (name == "VESREG MODULE") vessel_register_module = Boolean.Parse(val);
-// if (name == "DATATIME MODULE") data_time_module = Boolean.Parse(val);
-// if (name == "VESINFO MODULE") vessel_info_module = Boolean.Parse(val);
-// if (name == "MISC MODULE") misc_module = Boolean.Parse(val);
-// if (name == "CELINFO MODULE") celestial_body_info_module = Boolean.Parse(val);
-// if (name == "CELINFO SHOW OBTL") body_op_show_orbital = Boolean.Parse(val);
-// if (name == "CELINFO SHOW PHYS") body_op_show_physical = Boolean.Parse(val);
-// if (name == "MAIN GUI MINIMIZED") main_gui_minimized = Boolean.Parse(val);
-// if (name == "HIDE ON PAUSE") hide_on_pause = Boolean.Parse(val);
-// if (name == "SKIN INDEX") skin_index = Int32.Parse(val);
-// if (name == "DISABLE POWER USAGE") disable_power_usage = Boolean.Parse(val);
-// if (name == "SHOW TOOLTIPS") show_tooltips = Boolean.Parse(val);
-// if (name == "SHOW RENDEZVOUS INFO") rendezvous_module = Boolean.Parse(val);
-// if (name == "USE KSP TARGET") hide_vesreg_info = Boolean.Parse(val);
-// if (name == "USER LANG") user_lang = (languages)Enum.Parse(typeof(languages), val);
-// }
-// }
-// }
-// }
-//
-// private void load_settings()
-// {
-// Tools.PostDebugMessage ("VOID: Loading settings.");
-// var config = KSP.IO.PluginConfiguration.CreateForType<VOIDFlightMaster> ();
-// config.load ();
-//
-// int loadedConfigVersion = config.GetValue ("ConfigVersion", 0);
-//
-// if (loadedConfigVersion < 1 || true)
-// {
-// this.load_old_settings ();
-// // this.write_settings ();
-// // TODO: Enable this when the config update works for sure.
-// // KSP.IO.File.Delete<VOID> ("VOID.cfg");
-// return;
-// }
-//
-// this.main_window_pos = config.GetValue("MAIN_WINDOW_POS", main_window_pos);
-// this.void_window_pos = config.GetValue("VOID_WINDOW_POS", void_window_pos);
-// this.atmo_window_pos = config.GetValue("ATMO_WINDOW_POS", atmo_window_pos);
-// this.transfer_window_pos = config.GetValue("TAD_WINDOW_POS", transfer_window_pos);
-// this.vessel_register_window_pos = config.GetValue("VESREG_WINDOW_POS", vessel_register_window_pos);
-// this.data_logging_window_pos = config.GetValue("DATATIME_WINDOW_POS", data_logging_window_pos);
-// this.vessel_info_window_pos = config.GetValue("VESINFO_WINDOW_POS", vessel_info_window_pos);
-// this.misc_window_pos = config.GetValue("MISC_WINDOW_POS", misc_window_pos);
-// this.body_op_window_pos = config.GetValue("CELINFO_WINDOW_POS", body_op_window_pos);
-// this.rendezvous_info_window_pos = config.GetValue("RENDEZVOUS_WINDOW_POS", rendezvous_info_window_pos);
-// this.main_icon_pos = config.GetValue("ICON_POS", main_icon_pos);
-//
-// this.toggleHUDModule = config.GetValue("HUD_MODULE", false);
-// this.void_module = config.GetValue("VOID_MODULE", false);
-// this.atmo_module = config.GetValue("ATMO_MODULE", false);
-// this.tad_module = config.GetValue("TAD_MODULE", false);
-// this.vessel_register_module = config.GetValue("VESREG_MODULE", false);
-// this.data_time_module = config.GetValue("DATATIME_MODULE", false);
-// this.vessel_info_module = config.GetValue("VESINFO_MODULE", false);
-// this.misc_module = config.GetValue("MISC_MODULE", false);
-// this.celestial_body_info_module = config.GetValue("CELINFO_MODULE", false);
-// this.body_op_show_orbital = config.GetValue("CELINFO_SHOW_OBTL", false);
-// this.body_op_show_physical = config.GetValue("CELINFO_SHOW_PHYS", false);
-// this.main_gui_minimized = config.GetValue("MAIN_GUI_MINIMIZED", false);
-// this.hide_on_pause = config.GetValue("HIDE_ON_PAUSE", false);
-// this.disable_power_usage = config.GetValue("DISABLE_POWER_USAGE", true);
-// this.show_tooltips = config.GetValue("SHOW_TOOLTIPS", false);
-// this.rendezvous_module = config.GetValue("SHOW_RENDEZVOUS_INFO", false);
-// this.hide_vesreg_info = config.GetValue("USE_KSP_TARGET", false);
-//
-// this.skin_index = config.GetValue ("SKIN_INDEX", 0);
-//
-// this.user_lang = (languages)Enum.Parse(typeof(languages), config.GetValue ("USER_LANG", "EN"));
-// }
-//
-// private void write_settings()
-// {
-// Tools.PostDebugMessage ("VOID: Writing settings.");
-// try
-// {
-// var config = KSP.IO.PluginConfiguration.CreateForType<VOIDFlightMaster> ();
-// config.load ();
-//
-// /*
-// config.SetValue ("ConfigVersion", this.configVersion);
-// config.SetValue("MAIN_WINDOW_POS", main_window_pos);
-// config.SetValue("VOID_WINDOW_POS", void_window_pos);
-// config.SetValue("ATMO_WINDOW_POS", atmo_window_pos);
-// config.SetValue("TAD_WINDOW_POS", transfer_window_pos);
-// config.SetValue("VESREG_WINDOW_POS", vessel_register_window_pos);
-// config.SetValue("DATATIME_WINDOW_POS", data_logging_window_pos);
-// config.SetValue("VESINFO_WINDOW_POS", vessel_info_window_pos);
-// config.SetValue("MISC_WINDOW_POS", misc_window_pos);
-// config.SetValue("CELINFO_WINDOW_POS", body_op_window_pos);
-// config.SetValue("RENDEZVOUS_WINDOW_POS", rendezvous_info_window_pos);
-// config.SetValue("ICON_POS", main_icon_pos);
-// config.SetValue("HUD_MODULE", toggleHUDModule);
-// config.SetValue("VOID_MODULE", void_module);
-// config.SetValue("ATMO_MODULE", atmo_module);
-// config.SetValue("TAD_MODULE", tad_module);
-// config.SetValue("VESREG_MODULE", vessel_register_module);
-// config.SetValue("DATATIME_MODULE", data_time_module);
-// config.SetValue("VESINFO_MODULE", vessel_info_module);
-// config.SetValue("MISC_MODULE", misc_module);
-// config.SetValue("CELINFO_MODULE", celestial_body_info_module);
-// config.SetValue("CELINFO_SHOW_OBTL", body_op_show_orbital);
-// config.SetValue("CELINFO_SHOW_PHYS", body_op_show_physical);
-// config.SetValue("MAIN_GUI_MINIMIZED", main_gui_minimized);
-// config.SetValue("HIDE_ON_PAUSE", hide_on_pause);
-// config.SetValue("SKIN_INDEX", skin_index);
-// config.SetValue("DISABLE_POWER_USAGE", disable_power_usage);
-// config.SetValue("SHOW_TOOLTIPS", show_tooltips);
-// config.SetValue("SHOW_RENDEZVOUS_INFO", rendezvous_module);
-// config.SetValue("USE_KSP_TARGET", hide_vesreg_info);
-// config.SetValue("USER_LANG", user_lang);
-// */
-//
-// try
-// {
-// config.SetValue ("ConfigVersion", this.configVersion);
-// }
-// catch (NullReferenceException)
-// {
-// UnityEngine.Debug.LogError("config.SetValue (\"ConfigVersion\", this.configVersion);");
-// }
-// try
-// {
-// config.SetValue("MAIN_WINDOW_POS", main_window_pos);
-// }
-// catch (NullReferenceException)
-// {
-// UnityEngine.Debug.LogError("config.SetValue(\"MAIN_WINDOW_POS\", main_window_pos);");
-// }
-// try
-// {
-// config.SetValue("VOID_WINDOW_POS", void_window_pos);
-// }
-// catch (NullReferenceException)
-// {
-// UnityEngine.Debug.LogError("config.SetValue(\"VOID_WINDOW_POS\", void_window_pos);");
-// }
-// try
-// {
-// config.SetValue("ATMO_WINDOW_POS", atmo_window_pos);
-// }
-// catch (NullReferenceException)
-// {
-// UnityEngine.Debug.LogError("config.SetValue(\"ATMO_WINDOW_POS\", atmo_window_pos);");
-// }
-// try
-// {
-// config.SetValue("TAD_WINDOW_POS", transfer_window_pos);
-// }
-// catch (NullReferenceException)
-// {
-// UnityEngine.Debug.LogError("config.SetValue(\"TAD_WINDOW_POS\", transfer_window_pos);");
-// }
-// try
-// {
-// config.SetValue("VESREG_WINDOW_POS", vessel_register_window_pos);
-// }
-// catch (NullReferenceException)
-// {
-// UnityEngine.Debug.LogError("config.SetValue(\"VESREG_WINDOW_POS\", vessel_register_window_pos);");
-// }
-// try
-// {
-// config.SetValue("DATATIME_WINDOW_POS", data_logging_window_pos);
-// }
-// catch (NullReferenceException)
-// {
-// UnityEngine.Debug.LogError("config.SetValue(\"DATATIME_WINDOW_POS\", data_logging_window_pos);");
-// }
-// try
-// {
-// config.SetValue("VESINFO_WINDOW_POS", vessel_info_window_pos);
-// }
-// catch (NullReferenceException)
-// {
-// UnityEngine.Debug.LogError("config.SetValue(\"VESINFO_WINDOW_POS\", vessel_info_window_pos);");
-// }
-// try
-// {
-// config.SetValue("MISC_WINDOW_POS", misc_window_pos);
-// }
-// catch (NullReferenceException)
-// {
-// UnityEngine.Debug.LogError("config.SetValue(\"MISC_WINDOW_POS\", misc_window_pos);");
-// }
-// try
-// {
-// config.SetValue("CELINFO_WINDOW_POS", body_op_window_pos);
-// }
-// catch (NullReferenceException)
-// {
-// UnityEngine.Debug.LogError("config.SetValue(\"CELINFO_WINDOW_POS\", body_op_window_pos);");
-// }
-// try
-// {
-// config.SetValue("RENDEZVOUS_WINDOW_POS", rendezvous_info_window_pos);
-// }
-// catch (NullReferenceException)
-// {
-// UnityEngine.Debug.LogError("config.SetValue(\"RENDEZVOUS_WINDOW_POS\", rendezvous_info_window_pos);");
-// }
-// try
-// {
-// config.SetValue("ICON_POS", main_icon_pos);
-// }
-// catch (NullReferenceException)
-// {
-// UnityEngine.Debug.LogError("config.SetValue(\"ICON_POS\", main_icon_pos);");
-// }
-// try
-// {
-// config.SetValue("HUD_MODULE", toggleHUDModule);
-// }
-// catch (NullReferenceException)
-// {
-// UnityEngine.Debug.LogError("config.SetValue(\"HUD_MODULE\", toggleHUDModule);");
-// }
-// try
-// {
-// config.SetValue("VOID_MODULE", void_module);
-// }
-// catch (NullReferenceException)
-// {
-// UnityEngine.Debug.LogError("config.SetValue(\"VOID_MODULE\", void_module);");
-// }
-// try
-// {
-// config.SetValue("ATMO_MODULE", atmo_module);
-// }
-// catch (NullReferenceException)
-// {
-// UnityEngine.Debug.LogError("config.SetValue(\"ATMO_MODULE\", atmo_module);");
-// }
-// try
-// {
-// config.SetValue("TAD_MODULE", tad_module);
-// }
-// catch (NullReferenceException)
-// {
-// UnityEngine.Debug.LogError("config.SetValue(\"TAD_MODULE\", tad_module);");
-// }
-// try
-// {
-// config.SetValue("VESREG_MODULE", vessel_register_module);
-// }
-// catch (NullReferenceException)
-// {
-// UnityEngine.Debug.LogError("config.SetValue(\"VESREG_MODULE\", vessel_register_module);");
-// }
-// try
-// {
-// config.SetValue("DATATIME_MODULE", data_time_module);
-// }
-// catch (NullReferenceException)
-// {
-// UnityEngine.Debug.LogError("config.SetValue(\"DATATIME_MODULE\", data_time_module);");
-// }
-// try
-// {
-// config.SetValue("VESINFO_MODULE", vessel_info_module);
-// }
-// catch (NullReferenceException)
-// {
-// UnityEngine.Debug.LogError("config.SetValue(\"VESINFO_MODULE\", vessel_info_module);");
-// }
-// try
-// {
-// config.SetValue("MISC_MODULE", misc_module);
-// }
-// catch (NullReferenceException)
-// {
-// UnityEngine.Debug.LogError("config.SetValue(\"MISC_MODULE\", misc_module);");
-// }
-// try
-// {
-// config.SetValue("CELINFO_MODULE", celestial_body_info_module);
-// }
-// catch (NullReferenceException)
-// {
-// UnityEngine.Debug.LogError("config.SetValue(\"CELINFO_MODULE\", celestial_body_info_module);");
-// }
-// try
-// {
-// config.SetValue("CELINFO_SHOW_OBTL", body_op_show_orbital);
-// }
-// catch (NullReferenceException)
-// {
-// UnityEngine.Debug.LogError("config.SetValue(\"CELINFO_SHOW_OBTL\", body_op_show_orbital);");
-// }
-// try
-// {
-// config.SetValue("CELINFO_SHOW_PHYS", body_op_show_physical);
-// }
-// catch (NullReferenceException)
-// {
-// UnityEngine.Debug.LogError("config.SetValue(\"CELINFO_SHOW_PHYS\", body_op_show_physical);");
-// }
-// try
-// {
-// config.SetValue("MAIN_GUI_MINIMIZED", main_gui_minimized);
-// }
-// catch (NullReferenceException)
-// {
-// UnityEngine.Debug.LogError("config.SetValue(\"MAIN_GUI_MINIMIZED\", main_gui_minimized);");
-// }
-// try
-// {
-// config.SetValue("HIDE_ON_PAUSE", hide_on_pause);
-// }
-// catch (NullReferenceException)
-// {
-// UnityEngine.Debug.LogError("config.SetValue(\"HIDE_ON_PAUSE\", hide_on_pause);");
-// }
-// try
-// {
-// config.SetValue("SKIN_INDEX", skin_index);
-// }
-// catch (NullReferenceException)
-// {
-// UnityEngine.Debug.LogError("config.SetValue(\"SKIN_INDEX\", skin_index);");
-// }
-// try
-// {
-// config.SetValue("DISABLE_POWER_USAGE", disable_power_usage);
-// }
-// catch (NullReferenceException)
-// {
-// UnityEngine.Debug.LogError("config.SetValue(\"DISABLE_POWER_USAGE\", disable_power_usage);");
-// }
-// try
-// {
-// config.SetValue("SHOW_TOOLTIPS", show_tooltips);
-// }
-// catch (NullReferenceException)
-// {
-// UnityEngine.Debug.LogError("config.SetValue(\"SHOW_TOOLTIPS\", show_tooltips);");
-// }
-// try
-// {
-// config.SetValue("SHOW_RENDEZVOUS_INFO", rendezvous_module);
-// }
-// catch (NullReferenceException)
-// {
-// UnityEngine.Debug.LogError("config.SetValue(\"SHOW_RENDEZVOUS_INFO\", rendezvous_module);");
-// }
-// try
-// {
-// config.SetValue("USE_KSP_TARGET", hide_vesreg_info);
-// }
-// catch (NullReferenceException)
-// {
-// UnityEngine.Debug.LogError("config.SetValue(\"USE_KSP_TARGET\", hide_vesreg_info);");
-// }
-// try
-// {
-// config.SetValue("USER_LANG", user_lang);
-// }
-// catch (NullReferenceException)
-// {
-// UnityEngine.Debug.LogError("config.SetValue(\"USER_LANG\", user_lang);");
-// }
-// config.save ();
-// }
-// catch (NullReferenceException)
-// {
-// return;
-// }
-//
-// /*
-// string settings = "";
-// settings += "MAIN WINDOW POS = " + main_window_pos.x + " , " + main_window_pos.y + "\n";
-// settings += "VOID WINDOW POS = " + void_window_pos.x + " , " + void_window_pos.y + "\n";
-// settings += "ATMO WINDOW POS = " + atmo_window_pos.x + " , " + atmo_window_pos.y + "\n";
-// settings += "TAD WINDOW POS = " + transfer_window_pos.x + " , " + transfer_window_pos.y + "\n";
-// settings += "VESREG WINDOW POS = " + vessel_register_window_pos.x + " , " + vessel_register_window_pos.y + "\n";
-// settings += "DATATIME WINDOW POS = " + data_logging_window_pos.x + " , " + data_logging_window_pos.y + "\n";
-// settings += "VESINFO WINDOW POS = " + vessel_info_window_pos.x + " , " + vessel_info_window_pos.y + "\n";
-// settings += "MISC WINDOW POS = " + misc_window_pos.x + " , " + misc_window_pos.y + "\n";
-// settings += "CELINFO WINDOW POS = " + body_op_window_pos.x + " , " + body_op_window_pos.y + "\n";
-// settings += "RENDEZVOUS WINDOW POS = " + rendezvous_info_window_pos.x + " , " + rendezvous_info_window_pos.y + "\n";
-// settings += "ICON POS = " + main_icon_pos.x + " , " + main_icon_pos.y + "\n";
-// settings += "HUD MODULE = " + toggleHUDModule + "\n";
-// settings += "VOID MODULE = " + void_module + "\n";
-// settings += "ATMO MODULE = " + atmo_module + "\n";
-// settings += "TAD MODULE = " + tad_module + "\n";
-// settings += "VESREG MODULE = " + vessel_register_module + "\n";
-// settings += "DATATIME MODULE = " + data_time_module + "\n";
-// settings += "VESINFO MODULE = " + vessel_info_module + "\n";
-// settings += "MISC MODULE = " + misc_module + "\n";
-// settings += "CELINFO MODULE = " + celestial_body_info_module + "\n";
-// settings += "CELINFO SHOW OBTL = " + body_op_show_orbital + "\n";
-// settings += "CELINFO SHOW PHYS = " + body_op_show_physical + "\n";
-// settings += "MAIN GUI MINIMIZED = " + main_gui_minimized + "\n";
-// settings += "HIDE ON PAUSE = " + hide_on_pause + "\n";
-// settings += "HUD COLOR = " + moduleHUD.ColorIndex + "\n";
-// settings += "SKIN INDEX = " + skin_index + "\n";
-// settings += "DISABLE POWER USAGE = " + disable_power_usage + "\n";
-// settings += "SHOW TOOLTIPS = " + show_tooltips + "\n";
-// settings += "SHOW RENDEZVOUS INFO = " + rendezvous_module + "\n";
-// settings += "USE KSP TARGET = " + hide_vesreg_info + "\n";
-// settings += "USER LANG = " + user_lang + "\n";
-// KSP.IO.File.WriteAllText<VOID>(settings, "VOID.cfg", null);
-// */
-// }
-//
// private void start_GUI()
// {
// RenderingManager.AddToPostDrawQueue(3, new Callback(draw_GUI)); //start the GUI
@@ -877,162 +398,7 @@
// gui_styles_set = true;
// }
//
-// private void body_OP_show_orbital_info(CelestialBody body)
-// {
-// //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// if (body.bodyName == "Sun") GUILayout.Label("N/A", label_txt_right, GUILayout.ExpandWidth(true));
-// else GUILayout.Label((body.orbit.ApA / 1000).ToString("##,#") + "km", label_txt_right, GUILayout.ExpandWidth(true));
-// //GUILayout.EndHorizontal();
-//
-// //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// if (body.bodyName == "Sun") GUILayout.Label("N/A", label_txt_right, GUILayout.ExpandWidth(true));
-// else GUILayout.Label(Tools.ConvertInterval(body.orbit.timeToAp), label_txt_right, GUILayout.ExpandWidth(true));
-// //GUILayout.EndHorizontal();
-//
-// //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// if (body.bodyName == "Sun") GUILayout.Label("N/A", label_txt_right, GUILayout.ExpandWidth(true));
-// else GUILayout.Label((body.orbit.PeA / 1000).ToString("##,#") + "km", label_txt_right, GUILayout.ExpandWidth(true));
-// //GUILayout.EndHorizontal();
-//
-// //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// if (body.bodyName == "Sun") GUILayout.Label("N/A", label_txt_right, GUILayout.ExpandWidth(true));
-// else GUILayout.Label(Tools.ConvertInterval(body.orbit.timeToPe), label_txt_right, GUILayout.ExpandWidth(true));
-// //GUILayout.EndHorizontal();
-//
-// //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// if (body.bodyName == "Sun") GUILayout.Label("N/A", label_txt_right, GUILayout.ExpandWidth(true));
-// else GUILayout.Label((body.orbit.semiMajorAxis / 1000).ToString("##,#") + "km", label_txt_right, GUILayout.ExpandWidth(true));
-// //GUILayout.EndHorizontal();
-//
-// //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// if (body.bodyName == "Sun") GUILayout.Label("N/A", label_txt_right, GUILayout.ExpandWidth(true));
-// else GUILayout.Label(body.orbit.eccentricity.ToString("F4") + "", label_txt_right, GUILayout.ExpandWidth(true));
-// //GUILayout.EndHorizontal();
-//
-// //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// if (body.bodyName == "Sun") GUILayout.Label("N/A", label_txt_right, GUILayout.ExpandWidth(true));
-// else GUILayout.Label(Tools.ConvertInterval(body.orbit.period), label_txt_right, GUILayout.ExpandWidth(true));
-// //GUILayout.EndHorizontal();
-//
-// //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// if (body.bodyName == "Sun") GUILayout.Label("N/A", label_txt_right, GUILayout.ExpandWidth(true));
-// else GUILayout.Label(Tools.ConvertInterval(body.rotationPeriod), label_txt_right, GUILayout.ExpandWidth(true));
-// //GUILayout.EndHorizontal();
-//
-// //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// if (body.bodyName == "Sun") GUILayout.Label("N/A", label_txt_right, GUILayout.ExpandWidth(true));
-// else GUILayout.Label((body.orbit.orbitalSpeed / 1000).ToString("F2") + "km/s", label_txt_right, GUILayout.ExpandWidth(true));
-// //GUILayout.EndHorizontal();
-//
-// //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// // Toadicus edit: convert mean anomaly into degrees.
-// if (body.bodyName == "Sun") GUILayout.Label("N/A", label_txt_right, GUILayout.ExpandWidth(true));
-// else GUILayout.Label((body.orbit.meanAnomaly * 180d / Math.PI).ToString("F3") + "°", label_txt_right, GUILayout.ExpandWidth(true));
-// //GUILayout.EndHorizontal();
-//
-// //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// if (body.bodyName == "Sun") GUILayout.Label("N/A", label_txt_right, GUILayout.ExpandWidth(true));
-// else GUILayout.Label(body.orbit.trueAnomaly.ToString("F3") + "°", label_txt_right, GUILayout.ExpandWidth(true));
-// //GUILayout.EndHorizontal();
-//
-// //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// // Toadicus edit: convert eccentric anomaly into degrees.
-// if (body.bodyName == "Sun") GUILayout.Label("N/A", label_txt_right, GUILayout.ExpandWidth(true));
-// else GUILayout.Label((body.orbit.eccentricAnomaly * 180d / Math.PI).ToString("F3") + "°", label_txt_right, GUILayout.ExpandWidth(true));
-// //GUILayout.EndHorizontal();
-//
-// //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// if (body.bodyName == "Sun") GUILayout.Label("N/A", label_txt_right, GUILayout.ExpandWidth(true));
-// else GUILayout.Label(body.orbit.inclination.ToString("F3") + "°", label_txt_right, GUILayout.ExpandWidth(true));
-// //GUILayout.EndHorizontal();
-//
-// //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// if (body.bodyName == "Sun") GUILayout.Label("N/A", label_txt_right, GUILayout.ExpandWidth(true));
-// else GUILayout.Label(body.orbit.LAN.ToString("F3") + "°", label_txt_right, GUILayout.ExpandWidth(true));
-// //GUILayout.EndHorizontal();
-//
-// //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// if (body.bodyName == "Sun") GUILayout.Label("N/A", label_txt_right, GUILayout.ExpandWidth(true));
-// else GUILayout.Label(body.orbit.argumentOfPeriapsis.ToString("F3") + "°", label_txt_right, GUILayout.ExpandWidth(true));
-// //GUILayout.EndHorizontal();
-//
-// //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// if (body.bodyName == "Sun") GUILayout.Label("N/A", label_txt_right, GUILayout.ExpandWidth(true));
-// else
-// {
-// string body_tidally_locked = "No";
-// if (body.tidallyLocked) body_tidally_locked = "Yes";
-// GUILayout.Label(body_tidally_locked, label_txt_right, GUILayout.ExpandWidth(true));
-// }
-// //GUILayout.EndHorizontal();
-// }
-//
-// private void body_OP_show_physical_info(CelestialBody body)
-// {
-// //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// GUILayout.Label((body.Radius / 1000).ToString("##,#") + "km", label_txt_right, GUILayout.ExpandWidth(true));
-// //GUILayout.EndHorizontal();
-//
-// //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// GUILayout.Label(((Math.Pow((body.Radius), 2) * 4 * Math.PI) / 1000).ToString("0.00e+00") + "km²", label_txt_right, GUILayout.ExpandWidth(true));
-// //GUILayout.EndHorizontal();
-//
-// //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// // divide by 1000 to convert m to km
-// GUILayout.Label((((4d / 3) * Math.PI * Math.Pow(body.Radius, 3)) / 1000).ToString("0.00e+00") + "km³", label_txt_right, GUILayout.ExpandWidth(true));
-// //GUILayout.Label(((4 / 3) * Math.PI * Math.Pow((vessel.mainBody.Radius / 1000), 3)).ToString(), txt_right, GUILayout.ExpandWidth(true));
-// //GUILayout.EndHorizontal();
-//
-// //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// GUILayout.Label(body.Mass.ToString("0.00e+00") + "kg", label_txt_right, GUILayout.ExpandWidth(true));
-// //GUILayout.EndHorizontal();
-//
-// double p = body.Mass / (Math.Pow(body.Radius, 3) * (4d / 3) * Math.PI);
-// //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// GUILayout.Label(p.ToString("##,#") + "kg/m³", label_txt_right, GUILayout.ExpandWidth(true));
-// //GUILayout.EndHorizontal();
-//
-// //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// if (name == "Sun") GUILayout.Label(body.sphereOfInfluence.ToString(), label_txt_right, GUILayout.ExpandWidth(true));
-// else GUILayout.Label((body.sphereOfInfluence / 1000).ToString("##,#") + "km", label_txt_right, GUILayout.ExpandWidth(true));
-// //GUILayout.EndHorizontal();
-//
-// //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// GUILayout.Label(body.orbitingBodies.Count.ToString(), label_txt_right, GUILayout.ExpandWidth(true));
-// //GUILayout.EndHorizontal();
-//
-// //show # artificial satellites
-// int num_art_sats = 0;
-// foreach (Vessel v in FlightGlobals.Vessels)
-// {
-// if (v.mainBody == body && v.situation.ToString() == "ORBITING") num_art_sats++;
-// }
-//
-// //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// GUILayout.Label(num_art_sats.ToString(), label_txt_right, GUILayout.ExpandWidth(true));
-// //GUILayout.EndHorizontal();
-//
-// double g_ASL = (G_constant * body.Mass) / Math.Pow(body.Radius, 2);
-// //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// GUILayout.Label(Tools.MuMech_ToSI(g_ASL) + "m/s²", label_txt_right, GUILayout.ExpandWidth(true));
-// //GUILayout.EndHorizontal();
-//
-// //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// GUILayout.Label("≈ " + Tools.MuMech_ToSI(body.maxAtmosphereAltitude) + "m", label_txt_right, GUILayout.ExpandWidth(true));
-// //GUILayout.EndHorizontal();
-//
-// //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// string O2 = "No";
-// if (body.atmosphereContainsOxygen == true) O2 = "Yes";
-// GUILayout.Label(O2, label_txt_right, GUILayout.ExpandWidth(true));
-// //GUILayout.EndHorizontal();
-//
-// //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// string ocean = "No";
-// if (body.ocean == true) ocean = "Yes";
-// GUILayout.Label(ocean, label_txt_right, GUILayout.ExpandWidth(true));
-// //GUILayout.EndHorizontal();
-// }
+
//
// private void tad_targeting(CelestialBody body)
// {
@@ -1352,272 +718,6 @@
// GUILayout.Label("Biome:");
// GUILayout.Label(Tools.Toadicus_GetAtt(vessel).name, label_txt_right);
// GUILayout.EndHorizontal();
-//
-// GUILayout.EndVertical();
-// GUI.DragWindow();
-// }
-//
-// private void tad_gui(int window_id)
-// {
-// GUILayout.BeginVertical();
-//
-// if (vessel.mainBody.name == "Sun") //Vessel is orbiting the Sun
-// {
-// foreach (CelestialBody body in vessel.mainBody.orbitingBodies)
-// {
-// GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// if (GUILayout.Button(body.bodyName))
-// {
-// //add or remove this body to this list of bodies to display more info on
-// if (tad_selected_bodies.Contains(body)) tad_selected_bodies.Remove(body);
-// else tad_selected_bodies.Add(body);
-// }
-// GUILayout.Label("Inclined " + body.orbit.inclination.ToString("F3") + "°", GUILayout.ExpandWidth(false));
-// GUILayout.EndHorizontal();
-//
-// if (tad_selected_bodies.Contains(body))
-// {
-// display_transfer_angles_SUN2PLANET(body); //show phase angles for each selected body
-// tad_targeting(body); //display Set/Unset Target button for each selected body
-// }
-// }
-// }
-// else if (vessel.mainBody.referenceBody.name == "Sun") //Vessel is orbiting a planet
-// {
-// foreach (CelestialBody body in vessel.mainBody.referenceBody.orbitingBodies)
-// {
-// if (body.name != vessel.mainBody.name) // show other planets
-// {
-// GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// if (GUILayout.Button(body.bodyName))
-// {
-// //add or remove this body to this list of bodies to display more info on
-// if (tad_selected_bodies.Contains(body)) tad_selected_bodies.Remove(body);
-// else tad_selected_bodies.Add(body);
-// }
-// GUILayout.Label("Inclined " + body.orbit.inclination.ToString("F3") + "°", GUILayout.ExpandWidth(false));
-// GUILayout.EndHorizontal();
-//
-// if (tad_selected_bodies.Contains(body))
-// {
-// display_transfer_angles_PLANET2PLANET(body);
-// tad_targeting(body); //display Set/Unset Target button
-// }
-// }
-// }
-// foreach (CelestialBody body in vessel.mainBody.orbitingBodies) // show moons
-// {
-// GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// if (GUILayout.Button(body.bodyName))
-// {
-// //add or remove this body to this list of bodies to display more info on
-// if (tad_selected_bodies.Contains(body)) tad_selected_bodies.Remove(body);
-// else tad_selected_bodies.Add(body);
-// }
-// GUILayout.Label("Inclined " + body.orbit.inclination.ToString("F3") + "°", GUILayout.ExpandWidth(false));
-// GUILayout.EndHorizontal();
-//
-// if (tad_selected_bodies.Contains(body))
-// {
-// display_transfer_angles_PLANET2MOON(body);
-// tad_targeting(body); //display Set/Unset Target button
-// }
-// }
-// }
-// else if (vessel.mainBody.referenceBody.referenceBody.name == "Sun") // Vessel is orbiting a moon
-// {
-// foreach (CelestialBody body in vessel.mainBody.referenceBody.orbitingBodies)
-// {
-// if (body.name != vessel.mainBody.name) // show other moons
-// {
-// GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// if (GUILayout.Button(body.bodyName))
-// {
-// //add or remove this body to this list of bodies to display more info on
-// if (tad_selected_bodies.Contains(body)) tad_selected_bodies.Remove(body);
-// else tad_selected_bodies.Add(body);
-// }
-// GUILayout.Label("Inclined " + body.orbit.inclination.ToString("F3") + "°", GUILayout.ExpandWidth(false));
-// GUILayout.EndHorizontal();
-//
-// if (tad_selected_bodies.Contains(body))
-// {
-// display_transfer_angles_MOON2MOON(body);
-// tad_targeting(body); //display Set/Unset Target button
-// }
-// }
-// }
-// }
-// GUILayout.EndVertical();
-// GUI.DragWindow();
-// }
-//
-// private void test_gui(int window_id)
-// {
-// GUILayout.BeginVertical();
-//
-// GUILayout.Label("FlightGlobals.fetch.vesselTargetMode = " + FlightGlobals.fetch.vesselTargetMode.ToString());
-// //if (debugging) Debug.Log("[VOID] vesselTargetMode OK");
-// if (FlightGlobals.fetch.VesselTarget != null)
-// {
-// GUILayout.Label("VesselTarget == " + FlightGlobals.fetch.VesselTarget.ToString());
-// //if (debugging) Debug.Log("[VOID] VesselTarget OK");
-// GUILayout.Label("vesselTargetTransform == " + FlightGlobals.fetch.vesselTargetTransform.ToString());
-// //if (debugging) Debug.Log("[VOID] vesselTargetTransform OK");
-// GUILayout.Label("vesselTargetDirection == " + FlightGlobals.fetch.vesselTargetDirection.ToString());
-// //if (debugging) Debug.Log("[VOID] vesselTargetDirection OK");
-// GUILayout.Label("vesselTargetDelta == " + FlightGlobals.fetch.vesselTargetDelta.ToString());
-// //if (debugging) Debug.Log("[VOID] vesselTargetDelta OK");
-// }
-// else GUILayout.Label("VesselTarget == null");
-//
-//
-// //check whats in here
-// //GUI.skin.font.fontNames
-// //foreach (String f in GUI.skin.font.fontNames)
-// //{
-// // GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// // GUILayout.Label(f);
-// // GUILayout.EndHorizontal();
-// //}
-//
-//
-//
-//
-// //fail
-// //if (Event.current.keyCode == KeyCode.Z)
-// //{
-// // FlightCtrlState s = new FlightCtrlState();
-// // vessel.FeedInputFeed();
-// // s.mainThrottle = 1;
-// //}
-//
-//
-//
-// //MapView.MapIsEnabled = false;
-// //fail
-//
-//
-//
-// //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// //GUILayout.Label(DateTime.Now.ToString("d MMMM"));
-// //GUILayout.EndHorizontal();
-//
-// //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// //GUILayout.Label("situation:", GUILayout.ExpandWidth(true));
-// //GUILayout.Label(vessel.situation.ToString(), label_txt_right);
-// //GUILayout.EndHorizontal();
-//
-// //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// //GUILayout.Label("vessel.missionTime:", GUILayout.ExpandWidth(true));
-// //GUILayout.Label(vessel.missionTime.ToString(), label_txt_right);
-// //GUILayout.EndHorizontal();
-//
-// //Orbit target_orbit = new Orbit();
-// //target_orbit = FlightGlobals.fetch.VesselTarget.GetOrbit();
-//
-//
-// //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// //GUILayout.Label("target_orbit.altitude", GUILayout.ExpandWidth(true));
-// //GUILayout.Label(target_orbit.altitude.ToString("F2"), label_txt_right);
-// //GUILayout.EndHorizontal();
-//
-//
-// //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// //GUILayout.Label("vessel.packed", GUILayout.ExpandWidth(true));
-// //GUILayout.Label(vessel.packed.ToString(), label_txt_right);
-// //GUILayout.EndHorizontal();
-//
-//
-// //q = 1/2 p v^2
-// //p = local air density
-// //v = velocity
-// //part.dynamicPressureAtm
-// double q = .5 * vessel.atmDensity * Math.Pow(vessel.orbit.vel.magnitude, 2);
-// GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// GUILayout.Label("dynamic pressure q:", GUILayout.ExpandWidth(true));
-// GUILayout.Label(q.ToString("F4"), label_txt_right);
-// GUILayout.EndHorizontal();
-//
-// //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// //GUILayout.Label("part.dynamicPressureAtm:", GUILayout.ExpandWidth(true));
-// //GUILayout.Label(part.dynamicPressureAtm.ToString("F3"), label_txt_right);
-// //GUILayout.EndHorizontal();
-//
-// //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// //GUILayout.Label("part.staticPressureAtm:", GUILayout.ExpandWidth(true));
-// //GUILayout.Label(part.staticPressureAtm.ToString("F3"), label_txt_right);
-// //GUILayout.EndHorizontal();
-//
-// GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// GUILayout.Label("vessel.staticPressure:", GUILayout.ExpandWidth(true));
-// GUILayout.Label(vessel.staticPressure.ToString("F3"), label_txt_right);
-// GUILayout.EndHorizontal();
-//
-//
-//
-//
-//
-// GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// GUILayout.Label("FlightLogger.getMissionStats():", GUILayout.ExpandWidth(true));
-// GUILayout.Label(FlightLogger.getMissionStats(), label_txt_right);
-// GUILayout.EndHorizontal();
-//
-// //parse this out
-// //"Total Distance Traveled: 552m"
-// GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-//
-// string temp = FlightLogger.getMissionStats();
-// temp = temp.Substring(temp.IndexOf("Total Distance Traveled:"));
-// //GUILayout.Label(temp, GUILayout.ExpandWidth(true));
-// //int colon_pos = temp.IndexOf(":");
-// temp = temp.Substring(temp.IndexOf(":") + 1);
-// //GUILayout.Label(temp, GUILayout.ExpandWidth(true));
-// int m_pos = temp.IndexOf("m");
-// temp = temp.Substring(0, m_pos + 1);
-// temp = temp.Trim();
-//
-// GUILayout.Label("Distance traveled:", GUILayout.ExpandWidth(true));
-// GUILayout.Label(temp, label_txt_right);
-//
-// GUILayout.EndHorizontal();
-//
-// //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// //GUILayout.Label("power_request_interval:", GUILayout.ExpandWidth(true));
-// //GUILayout.Label(power_request_interval.ToString(), label_txt_right);
-// //GUILayout.EndHorizontal();
-//
-// //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// //GUILayout.Label("power_request_amount:", GUILayout.ExpandWidth(true));
-// //GUILayout.Label(power_request_amount.ToString(), label_txt_right);
-// //GUILayout.EndHorizontal();
-//
-// //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// //GUILayout.Label("Tools.MuMech_get_heading():", GUILayout.ExpandWidth(true));
-// //GUILayout.Label(Tools.MuMech_get_heading().ToString("F2"), label_txt_right);
-// //GUILayout.EndHorizontal();
-//
-// //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// //GUILayout.Label("num_fixedupdate_calls:", GUILayout.ExpandWidth(true));
-// //GUILayout.Label(num_fixedupdate_calls.ToString(), label_txt_right);
-// //GUILayout.EndHorizontal();
-//
-// GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// GUILayout.Label("vessel.flightIntegrator.currentDragForce:", GUILayout.ExpandWidth(true));
-// GUILayout.Label(vessel.flightIntegrator.currentDragForce.ToString(), label_txt_right);
-// GUILayout.EndHorizontal();
-//
-// GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// GUILayout.Label("vessel.flightIntegrator.drag:", GUILayout.ExpandWidth(true));
-// GUILayout.Label(vessel.flightIntegrator.drag.ToString(), label_txt_right);
-// GUILayout.EndHorizontal();
-//
-// GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-// GUILayout.Label("vessel.flightIntegrator.dragArea:", GUILayout.ExpandWidth(true));
-// GUILayout.Label(vessel.flightIntegrator.dragArea.ToString(), label_txt_right);
-// GUILayout.EndHorizontal();
-//
-// //
//
// GUILayout.EndVertical();
// GUI.DragWindow();
--- /dev/null
+++ b/VOID_CBInfoBrowser.cs
@@ -1,1 +1,373 @@
-
+//
+// VOID_Orbital.cs
+//
+// Author:
+// toadicus <>
+//
+// Copyright (c) 2013 toadicus
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+using KSP;
+using System;
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace VOID
+{
+ public class VOID_CBInfoBrowser : VOID_WindowModule
+ {
+ protected List<CelestialBody> allBodies;
+
+ protected bool bodiesLoaded = false;
+
+ [AVOID_SaveValue("selectedBodyIdx1")]
+ protected VOID_SaveValue<int> selectedBodyIdx1 = 1;
+
+ [AVOID_SaveValue("selectedBodyIdx2")]
+ protected VOID_SaveValue<int> selectedBodyIdx2 = 2;
+
+ protected CelestialBody selectedBody1;
+ protected CelestialBody selectedBody2;
+
+ [AVOID_SaveValue("toggleOrbital")]
+ protected VOID_SaveValue<bool> toggleOrbital = false;
+
+ public VOID_CBInfoBrowser()
+ {
+ this._Name = "Celestial Body Information Browser";
+ }
+
+ protected void LoadAllBodies()
+ {
+ allBodies.AddRange(FlightGlobals.Bodies);
+ this.bodiesLoaded = true;
+ }
+
+ public override void ModuleWindow(int _)
+ {
+ if (!this.bodiesLoaded)
+ {
+ this.LoadAllBodies();
+ }
+
+ GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+
+ GUILayout.BeginVertical(GUILayout.Width(150));
+ GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ GUILayout.Label("", GUILayout.ExpandWidth(true));
+ GUILayout.EndHorizontal();
+
+ GUILayout.EndVertical();
+
+ GUILayout.BeginVertical(GUILayout.Width(150));
+
+ selectedBody1 = allBodies[selectedBodyIdx1];
+ selectedBody2 = allBodies[selectedBodyIdx2];
+
+ GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ if (GUILayout.Button("<", GUILayout.ExpandWidth(false)))
+ {
+ selectedBodyIdx1--;
+ if (selectedBodyIdx1 < 0) selectedBodyIdx1 = allBodies.Count - 1;
+ }
+ GUILayout.Label(allBodies[selectedBodyIdx1].bodyName, VOID_Core.Instance.LabelStyles["center_bold"], GUILayout.ExpandWidth(true));
+ if (GUILayout.Button(">", GUILayout.ExpandWidth(false)))
+ {
+ selectedBodyIdx1++;
+ if (selectedBodyIdx1 > allBodies.Count - 1) selectedBodyIdx1 = 0;
+ }
+ GUILayout.EndHorizontal();
+ GUILayout.EndVertical();
+
+ GUILayout.BeginVertical(GUILayout.Width(150));
+ GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ if (GUILayout.Button("<", GUILayout.ExpandWidth(false)))
+ {
+ selectedBodyIdx2--;
+ if (selectedBodyIdx2 < 0) selectedBodyIdx2 = allBodies.Count - 1;
+ }
+ GUILayout.Label(allBodies[selectedBodyIdx2].bodyName, VOID_Core.Instance.LabelStyles["center_bold"], GUILayout.ExpandWidth(true));
+ if (GUILayout.Button(">", GUILayout.ExpandWidth(false)))
+ {
+ selectedBodyIdx2++;
+ if (selectedBodyIdx2 > allBodies.Count - 1) selectedBodyIdx2 = 0;
+ }
+ GUILayout.EndHorizontal();
+ GUILayout.EndVertical();
+
+ GUILayout.EndHorizontal();
+
+ //}
+
+ //toggle for orbital info chunk
+ if (GUILayout.Button("Orbital Characteristics", GUILayout.ExpandWidth(true))) toggleOrbital = !toggleOrbital;
+
+ if (toggleOrbital)
+ {
+ //begin orbital into horizontal chunk
+ //print("begin orbital info section...");
+ GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+
+ //begin orbital value labels column
+ GUILayout.BeginVertical(GUILayout.Width(150));
+
+ //print("printing row labels...");
+
+ GUILayout.Label("Apoapsis:");
+ GUILayout.Label("Time to Ap:");
+ GUILayout.Label("Periapsis:");
+ GUILayout.Label("Time to Pe:");
+ GUILayout.Label("Semi-major axis:");
+ GUILayout.Label("Eccentricity:");
+ GUILayout.Label("Orbital period:");
+ GUILayout.Label("Rotational period:");
+ GUILayout.Label("Velocity:");
+ GUILayout.Label("Mean anomaly:");
+ GUILayout.Label("True anomaly:");
+ GUILayout.Label("Eccentric anomaly:");
+ GUILayout.Label("Inclination:");
+ GUILayout.Label("Long. ascending node:");
+ GUILayout.Label("Arg. of periapsis:");
+ GUILayout.Label("Tidally locked:");
+
+ //end orbital value labels column
+ GUILayout.EndVertical();
+
+ //begin primary orbital values column
+ GUILayout.BeginVertical(GUILayout.Width(150));
+
+ body_OP_show_orbital_info(selectedBody1);
+
+ //end primary orbital values column
+ GUILayout.EndVertical();
+
+ //begin secondary orbital values column
+ GUILayout.BeginVertical(GUILayout.Width(150));
+
+ body_OP_show_orbital_info(selectedBody2);
+
+ //end secondary orbital values column
+ GUILayout.EndVertical();
+
+ //end orbital info horizontal chunk
+ GUILayout.EndHorizontal();
+ }
+
+ //toggle for physical info chunk
+ if (GUILayout.Button("Physical Characteristics", GUILayout.ExpandWidth(true))) body_op_show_physical = !body_op_show_physical;
+
+ if (body_op_show_physical)
+ {
+ GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+
+ //begin physical info value label column
+ GUILayout.BeginVertical(GUILayout.Width(150));
+
+ GUILayout.Label("Radius:");
+ GUILayout.Label("Surface area:");
+ GUILayout.Label("Volume:");
+ GUILayout.Label("Mass:");
+ GUILayout.Label("Density:");
+ GUILayout.Label("Sphere of influence:");
+ GUILayout.Label("Natural satellites:");
+ GUILayout.Label("Artificial satellites:");
+ GUILayout.Label("Surface gravity:");
+ GUILayout.Label("Atmosphere altitude:");
+ GUILayout.Label("Atmospheric O\u2082:");
+ GUILayout.Label("Has ocean:");
+
+ //end physical info value label column
+ GUILayout.EndVertical();
+
+ //begin primary physical values column
+ GUILayout.BeginVertical(GUILayout.Width(150));
+
+ body_OP_show_physical_info(selectedBody1);
+
+ //end primary physical column
+ GUILayout.EndVertical();
+
+ //begin secondary physical values column
+ GUILayout.BeginVertical(GUILayout.Width(150));
+
+ body_OP_show_physical_info(selectedBody2);
+
+ //end target physical values column
+ GUILayout.EndVertical();
+
+ //end physical value horizontal chunk
+ GUILayout.EndHorizontal();
+ }
+
+ GUI.DragWindow();
+ }
+
+ private void body_OP_show_orbital_info(CelestialBody body)
+ {
+ //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ if (body.bodyName == "Sun") GUILayout.Label("N/A", VOID_Core.Instance.LabelStyles["txt_right"], GUILayout.ExpandWidth(true));
+ else GUILayout.Label((body.orbit.ApA / 1000).ToString("##,#") + "km", VOID_Core.Instance.LabelStyles["txt_right"], GUILayout.ExpandWidth(true));
+ //GUILayout.EndHorizontal();
+
+ //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ if (body.bodyName == "Sun") GUILayout.Label("N/A", VOID_Core.Instance.LabelStyles["txt_right"], GUILayout.ExpandWidth(true));
+ else GUILayout.Label(Tools.ConvertInterval(body.orbit.timeToAp), VOID_Core.Instance.LabelStyles["txt_right"], GUILayout.ExpandWidth(true));
+ //GUILayout.EndHorizontal();
+
+ //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ if (body.bodyName == "Sun") GUILayout.Label("N/A", VOID_Core.Instance.LabelStyles["txt_right"], GUILayout.ExpandWidth(true));
+ else GUILayout.Label((body.orbit.PeA / 1000).ToString("##,#") + "km", VOID_Core.Instance.LabelStyles["txt_right"], GUILayout.ExpandWidth(true));
+ //GUILayout.EndHorizontal();
+
+ //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ if (body.bodyName == "Sun") GUILayout.Label("N/A", VOID_Core.Instance.LabelStyles["txt_right"], GUILayout.ExpandWidth(true));
+ else GUILayout.Label(Tools.ConvertInterval(body.orbit.timeToPe), VOID_Core.Instance.LabelStyles["txt_right"], GUILayout.ExpandWidth(true));
+ //GUILayout.EndHorizontal();
+
+ //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ if (body.bodyName == "Sun") GUILayout.Label("N/A", VOID_Core.Instance.LabelStyles["txt_right"], GUILayout.ExpandWidth(true));
+ else GUILayout.Label((body.orbit.semiMajorAxis / 1000).ToString("##,#") + "km", VOID_Core.Instance.LabelStyles["txt_right"], GUILayout.ExpandWidth(true));
+ //GUILayout.EndHorizontal();
+
+ //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ if (body.bodyName == "Sun") GUILayout.Label("N/A", VOID_Core.Instance.LabelStyles["txt_right"], GUILayout.ExpandWidth(true));
+ else GUILayout.Label(body.orbit.eccentricity.ToString("F4") + "", VOID_Core.Instance.LabelStyles["txt_right"], GUILayout.ExpandWidth(true));
+ //GUILayout.EndHorizontal();
+
+ //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ if (body.bodyName == "Sun") GUILayout.Label("N/A", VOID_Core.Instance.LabelStyles["txt_right"], GUILayout.ExpandWidth(true));
+ else GUILayout.Label(Tools.ConvertInterval(body.orbit.period), VOID_Core.Instance.LabelStyles["txt_right"], GUILayout.ExpandWidth(true));
+ //GUILayout.EndHorizontal();
+
+ //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ if (body.bodyName == "Sun") GUILayout.Label("N/A", VOID_Core.Instance.LabelStyles["txt_right"], GUILayout.ExpandWidth(true));
+ else GUILayout.Label(Tools.ConvertInterval(body.rotationPeriod), VOID_Core.Instance.LabelStyles["txt_right"], GUILayout.ExpandWidth(true));
+ //GUILayout.EndHorizontal();
+
+ //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ if (body.bodyName == "Sun") GUILayout.Label("N/A", VOID_Core.Instance.LabelStyles["txt_right"], GUILayout.ExpandWidth(true));
+ else GUILayout.Label((body.orbit.orbitalSpeed / 1000).ToString("F2") + "km/s", VOID_Core.Instance.LabelStyles["txt_right"], GUILayout.ExpandWidth(true));
+ //GUILayout.EndHorizontal();
+
+ //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ // Toadicus edit: convert mean anomaly into degrees.
+ if (body.bodyName == "Sun") GUILayout.Label("N/A", VOID_Core.Instance.LabelStyles["txt_right"], GUILayout.ExpandWidth(true));
+ else GUILayout.Label((body.orbit.meanAnomaly * 180d / Math.PI).ToString("F3") + "°", VOID_Core.Instance.LabelStyles["txt_right"], GUILayout.ExpandWidth(true));
+ //GUILayout.EndHorizontal();
+
+ //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ if (body.bodyName == "Sun") GUILayout.Label("N/A", VOID_Core.Instance.LabelStyles["txt_right"], GUILayout.ExpandWidth(true));
+ else GUILayout.Label(body.orbit.trueAnomaly.ToString("F3") + "°", VOID_Core.Instance.LabelStyles["txt_right"], GUILayout.ExpandWidth(true));
+ //GUILayout.EndHorizontal();
+
+ //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ // Toadicus edit: convert eccentric anomaly into degrees.
+ if (body.bodyName == "Sun") GUILayout.Label("N/A", VOID_Core.Instance.LabelStyles["txt_right"], GUILayout.ExpandWidth(true));
+ else GUILayout.Label((body.orbit.eccentricAnomaly * 180d / Math.PI).ToString("F3") + "°", VOID_Core.Instance.LabelStyles["txt_right"], GUILayout.ExpandWidth(true));
+ //GUILayout.EndHorizontal();
+
+ //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ if (body.bodyName == "Sun") GUILayout.Label("N/A", VOID_Core.Instance.LabelStyles["txt_right"], GUILayout.ExpandWidth(true));
+ else GUILayout.Label(body.orbit.inclination.ToString("F3") + "°", VOID_Core.Instance.LabelStyles["txt_right"], GUILayout.ExpandWidth(true));
+ //GUILayout.EndHorizontal();
+
+ //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ if (body.bodyName == "Sun") GUILayout.Label("N/A", VOID_Core.Instance.LabelStyles["txt_right"], GUILayout.ExpandWidth(true));
+ else GUILayout.Label(body.orbit.LAN.ToString("F3") + "°", VOID_Core.Instance.LabelStyles["txt_right"], GUILayout.ExpandWidth(true));
+ //GUILayout.EndHorizontal();
+
+ //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ if (body.bodyName == "Sun") GUILayout.Label("N/A", VOID_Core.Instance.LabelStyles["txt_right"], GUILayout.ExpandWidth(true));
+ else GUILayout.Label(body.orbit.argumentOfPeriapsis.ToString("F3") + "°", VOID_Core.Instance.LabelStyles["txt_right"], GUILayout.ExpandWidth(true));
+ //GUILayout.EndHorizontal();
+
+ //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ if (body.bodyName == "Sun") GUILayout.Label("N/A", VOID_Core.Instance.LabelStyles["txt_right"], GUILayout.ExpandWidth(true));
+ else
+ {
+ string body_tidally_locked = "No";
+ if (body.tidallyLocked) body_tidally_locked = "Yes";
+ GUILayout.Label(body_tidally_locked, VOID_Core.Instance.LabelStyles["txt_right"], GUILayout.ExpandWidth(true));
+ }
+ //GUILayout.EndHorizontal();
+ }
+
+ private void body_OP_show_physical_info(CelestialBody body)
+ {
+ //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ GUILayout.Label((body.Radius / 1000).ToString("##,#") + "km", VOID_Core.Instance.LabelStyles["txt_right"], GUILayout.ExpandWidth(true));
+ //GUILayout.EndHorizontal();
+
+ //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ GUILayout.Label(((Math.Pow((body.Radius), 2) * 4 * Math.PI) / 1000).ToString("0.00e+00") + "km²", VOID_Core.Instance.LabelStyles["txt_right"], GUILayout.ExpandWidth(true));
+ //GUILayout.EndHorizontal();
+
+ //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ // divide by 1000 to convert m to km
+ GUILayout.Label((((4d / 3) * Math.PI * Math.Pow(body.Radius, 3)) / 1000).ToString("0.00e+00") + "km³", VOID_Core.Instance.LabelStyles["txt_right"], GUILayout.ExpandWidth(true));
+ //GUILayout.Label(((4 / 3) * Math.PI * Math.Pow((vessel.mainBody.Radius / 1000), 3)).ToString(), txt_right, GUILayout.ExpandWidth(true));
+ //GUILayout.EndHorizontal();
+
+ //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ GUILayout.Label(body.Mass.ToString("0.00e+00") + "kg", VOID_Core.Instance.LabelStyles["txt_right"], GUILayout.ExpandWidth(true));
+ //GUILayout.EndHorizontal();
+
+ double p = body.Mass / (Math.Pow(body.Radius, 3) * (4d / 3) * Math.PI);
+ //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ GUILayout.Label(p.ToString("##,#") + "kg/m³", VOID_Core.Instance.LabelStyles["txt_right"], GUILayout.ExpandWidth(true));
+ //GUILayout.EndHorizontal();
+
+ //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ if (name == "Sun") GUILayout.Label(body.sphereOfInfluence.ToString(), VOID_Core.Instance.LabelStyles["txt_right"], GUILayout.ExpandWidth(true));
+ else GUILayout.Label((body.sphereOfInfluence / 1000).ToString("##,#") + "km", VOID_Core.Instance.LabelStyles["txt_right"], GUILayout.ExpandWidth(true));
+ //GUILayout.EndHorizontal();
+
+ //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ GUILayout.Label(body.orbitingBodies.Count.ToString(), VOID_Core.Instance.LabelStyles["txt_right"], GUILayout.ExpandWidth(true));
+ //GUILayout.EndHorizontal();
+
+ //show # artificial satellites
+ int num_art_sats = 0;
+ foreach (Vessel v in FlightGlobals.Vessels)
+ {
+ if (v.mainBody == body && v.situation.ToString() == "ORBITING") num_art_sats++;
+ }
+
+ //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ GUILayout.Label(num_art_sats.ToString(), VOID_Core.Instance.LabelStyles["txt_right"], GUILayout.ExpandWidth(true));
+ //GUILayout.EndHorizontal();
+
+ double g_ASL = (VOID_Core.Constant_G * body.Mass) / Math.Pow(body.Radius, 2);
+ //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ GUILayout.Label(Tools.MuMech_ToSI(g_ASL) + "m/s²", VOID_Core.Instance.LabelStyles["txt_right"], GUILayout.ExpandWidth(true));
+ //GUILayout.EndHorizontal();
+
+ //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ GUILayout.Label("≈ " + Tools.MuMech_ToSI(body.maxAtmosphereAltitude) + "m", VOID_Core.Instance.LabelStyles["txt_right"], GUILayout.ExpandWidth(true));
+ //GUILayout.EndHorizontal();
+
+ //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ string O2 = "No";
+ if (body.atmosphereContainsOxygen == true) O2 = "Yes";
+ GUILayout.Label(O2, VOID_Core.Instance.LabelStyles["txt_right"], GUILayout.ExpandWidth(true));
+ //GUILayout.EndHorizontal();
+
+ //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ string ocean = "No";
+ if (body.ocean == true) ocean = "Yes";
+ GUILayout.Label(ocean, VOID_Core.Instance.LabelStyles["txt_right"], GUILayout.ExpandWidth(true));
+ //GUILayout.EndHorizontal();
+ }
+ }
+}
--- a/VOID_Core.cs
+++ b/VOID_Core.cs
@@ -69,8 +69,6 @@
protected List<IVOID_Module> _modules = new List<IVOID_Module>();
protected bool _modulesLoaded = false;
- protected List<Callback> _configurableCallbacks = new List<Callback>();
-
[AVOID_SaveValue("mainWindowPos")]
protected VOID_SaveValue<Rect> mainWindowPos = new Rect(Screen.width / 2, Screen.height / 2, 10f, 10f);
@@ -255,7 +253,7 @@
}
}
- if (this.saveTimer > 15f)
+ if (this.saveTimer > 2f)
{
this.SaveConfig ();
this.saveTimer = 0;
@@ -423,19 +421,24 @@
}
}
- public override void SaveConfig()
+ public void SaveConfig()
{
if (!this.configDirty)
{
return;
}
- base.SaveConfig ();
+ var config = KSP.IO.PluginConfiguration.CreateForType<VOID_Core> ();
+ config.load ();
+
+ this._SaveToConfig(config);
foreach (IVOID_Module module in this.Modules)
{
- module.SaveConfig ();
- }
+ module._SaveToConfig (config);
+ }
+
+ config.save();
this.configDirty = false;
}
--- a/VOID_HUD.cs
+++ b/VOID_HUD.cs
@@ -32,14 +32,14 @@
/*
* Fields
* */
- protected new bool _hasConfigurables = true;
-
[AVOID_SaveValue("colorIndex")]
protected VOID_SaveValue<int> _colorIndex = 0;
protected List<Color> textColors = new List<Color>();
protected GUIStyle labelStyle;
+
+ protected Vessel vessel = null;
/*
* Properties
@@ -68,7 +68,6 @@
public VOID_HUD() : base()
{
this._Name = "Heads-Up Display";
-
this.textColors.Add(Color.green);
this.textColors.Add(Color.black);
this.textColors.Add(Color.white);
@@ -87,13 +86,16 @@
public override void DrawGUI()
{
- Tools.PostDebugMessage ("VOID_HUD: Drawing GUI.");
-
GUI.skin = VOID_Core.Instance.Skin;
- if (this.vessel == null)
+ if (vessel == null)
{
- return;
+ vessel = FlightGlobals.ActiveVessel;
+ }
+
+ if (vessel != FlightGlobals.ActiveVessel)
+ {
+ vessel = FlightGlobals.ActiveVessel;
}
if (VOID_Core.Instance.powerAvailable)
@@ -102,26 +104,26 @@
GUI.Label (
new Rect ((Screen.width * .2083f), 0, 300f, 70f),
- "Obt Alt: " + Tools.MuMech_ToSI (this.vessel.orbit.altitude) + "m" +
- " Obt Vel: " + Tools.MuMech_ToSI (this.vessel.orbit.vel.magnitude) + "m/s" +
- "\nAp: " + Tools.MuMech_ToSI (this.vessel.orbit.ApA) + "m" +
- " ETA " + Tools.ConvertInterval (this.vessel.orbit.timeToAp) +
- "\nPe: " + Tools.MuMech_ToSI (this.vessel.orbit.PeA) + "m" +
- " ETA " + Tools.ConvertInterval (this.vessel.orbit.timeToPe) +
- "\nInc: " + this.vessel.orbit.inclination.ToString ("F3") + "°",
+ "Obt Alt: " + Tools.MuMech_ToSI (vessel.orbit.altitude) + "m" +
+ " Obt Vel: " + Tools.MuMech_ToSI (vessel.orbit.vel.magnitude) + "m/s" +
+ "\nAp: " + Tools.MuMech_ToSI (vessel.orbit.ApA) + "m" +
+ " ETA " + Tools.ConvertInterval (vessel.orbit.timeToAp) +
+ "\nPe: " + Tools.MuMech_ToSI (vessel.orbit.PeA) + "m" +
+ " ETA " + Tools.ConvertInterval (vessel.orbit.timeToPe) +
+ "\nInc: " + vessel.orbit.inclination.ToString ("F3") + "°",
labelStyle);
// Toadicus edit: Added "Biome: " line to surf/atmo HUD
GUI.Label (
new Rect ((Screen.width * .625f), 0, 300f, 90f),
- "Srf Alt: " + Tools.MuMech_ToSI (Tools.TrueAltitude (this.vessel)) + "m" +
- " Srf Vel: " + Tools.MuMech_ToSI (this.vessel.srf_velocity.magnitude) + "m/s" +
- "\nVer: " + Tools.MuMech_ToSI (this.vessel.verticalSpeed) + "m/s" +
- " Hor: " + Tools.MuMech_ToSI (this.vessel.horizontalSrfSpeed) + "m/s" +
- "\nLat: " + Tools.GetLatitudeString (this.vessel, "F3") +
- " Lon: " + Tools.GetLongitudeString (this.vessel, "F3") +
- "\nHdg: " + Tools.MuMech_get_heading (this.vessel).ToString ("F2") + "° " +
- Tools.get_heading_text (Tools.MuMech_get_heading (this.vessel)) +
- "\nBiome: " + Tools.Toadicus_GetAtt (this.vessel).name,
+ "Srf Alt: " + Tools.MuMech_ToSI (Tools.TrueAltitude (vessel)) + "m" +
+ " Srf Vel: " + Tools.MuMech_ToSI (vessel.srf_velocity.magnitude) + "m/s" +
+ "\nVer: " + Tools.MuMech_ToSI (vessel.verticalSpeed) + "m/s" +
+ " Hor: " + Tools.MuMech_ToSI (vessel.horizontalSrfSpeed) + "m/s" +
+ "\nLat: " + Tools.GetLatitudeString (vessel, "F3") +
+ " Lon: " + Tools.GetLongitudeString (vessel, "F3") +
+ "\nHdg: " + Tools.MuMech_get_heading (vessel).ToString ("F2") + "° " +
+ Tools.get_heading_text (Tools.MuMech_get_heading (vessel)) +
+ "\nBiome: " + Tools.Toadicus_GetAtt (vessel).name,
labelStyle);
}
else
--- a/VOID_Module.cs
+++ b/VOID_Module.cs
@@ -22,6 +22,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
+using UnityEngine;
namespace VOID
{
@@ -109,7 +110,8 @@
foreach (var field in this.GetType().GetFields(
BindingFlags.NonPublic |
BindingFlags.Public |
- BindingFlags.Instance
+ BindingFlags.Instance |
+ BindingFlags.FlattenHierarchy
))
{
object[] attrs = field.GetCustomAttributes(typeof(AVOID_SaveValue), false);
@@ -147,26 +149,19 @@
}
}
- public virtual void SaveConfig()
- {
- if (!VOID_Core.Instance.configDirty)
- {
- return;
- }
-
- var config = KSP.IO.PluginConfiguration.CreateForType<VOID_Core> ();
- config.load ();
-
+ public virtual void _SaveToConfig(KSP.IO.PluginConfiguration config)
+ {
foreach (var field in this.GetType().GetFields(
+ BindingFlags.Instance |
BindingFlags.NonPublic |
BindingFlags.Public |
- BindingFlags.Instance
+ BindingFlags.FlattenHierarchy
))
{
object[] attrs = field.GetCustomAttributes(typeof(AVOID_SaveValue), false);
if (attrs.Length == 0) {
- return;
+ continue;
}
AVOID_SaveValue attr = attrs.FirstOrDefault () as AVOID_SaveValue;
@@ -184,8 +179,32 @@
Tools.PostDebugMessage(string.Format("{0}: Saved field {1}.", this.GetType().Name, fieldName));
}
-
- config.save ();
+ }
+ }
+
+ public abstract class VOID_WindowModule : VOID_Module
+ {
+ [AVOID_SaveValue("WindowPos")]
+ protected Rect WindowPos = new Rect(Screen.width / 2, Screen.height / 2, 10f, 10f);
+
+ public abstract void ModuleWindow(int _);
+
+ public override void DrawGUI()
+ {
+ Rect _Pos = this.WindowPos;
+
+ _Pos = GUILayout.Window(
+ VOID_Core.Instance.windowID,
+ _Pos,
+ this.ModuleWindow,
+ this.Name, GUILayout.Width(250),
+ GUILayout.Height(50));
+
+ if (_Pos != this.WindowPos)
+ {
+ this.WindowPos = _Pos;
+ VOID_Core.Instance.configDirty = true;
+ }
}
}
}
--- a/VOID_Orbital.cs
+++ b/VOID_Orbital.cs
@@ -24,17 +24,17 @@
namespace VOID
{
- public class VOID_Orbital : VOID_Module
+ public class VOID_Orbital : VOID_WindowModule
{
- protected new string _Name = "Orbital Information";
+ [AVOID_SaveValue("toggleExtended")]
+ protected VOID_SaveValue<bool> toggleExtended = false;
- [AVOID_SaveValue("OrbitalWindowPos")]
- protected Rect OrbitalWindowPos = new Rect(Screen.width / 2, Screen.height / 2, 10f, 10f);
+ public VOID_Orbital()
+ {
+ this._Name = "Orbital Information";
+ }
- [AVOID_SaveValue("toggleExtendedOribtal")]
- protected bool toggleExtendedOribtal = false;
-
- public void OrbitalWindow(int _)
+ public override void ModuleWindow(int _)
{
// Toadicus edit: added local sidereal longitude.
double LSL = vessel.longitude + vessel.orbit.referenceBody.rotationAngle;
@@ -89,9 +89,9 @@
GUILayout.Label(Tools.MuMech_ToSI(g_vessel) + "m/s²", GUILayout.ExpandWidth(false));
GUILayout.EndHorizontal();
- toggleExtendedOribtal = GUILayout.Toggle(toggleExtendedOribtal, "Extended info");
+ this.toggleExtended = GUILayout.Toggle(this.toggleExtended, "Extended info");
- if (toggleExtendedOribtal)
+ if (this.toggleExtended)
{
GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
GUILayout.Label("Period:");
@@ -145,16 +145,6 @@
GUILayout.EndVertical();
GUI.DragWindow();
}
-
- public override void DrawGUI()
- {
- OrbitalWindowPos = GUILayout.Window(
- ++VOID_Core.Instance.windowID,
- OrbitalWindowPos,
- this.OrbitalWindow,
- this.Name, GUILayout.Width(250),
- GUILayout.Height(50));
- }
}
}
--- /dev/null
+++ b/VOID_SurfAtmo.cs
@@ -1,1 +1,111 @@
+//
+// VOID_Orbital.cs
+//
+// Author:
+// toadicus <>
+//
+// Copyright (c) 2013 toadicus
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+using KSP;
+using System;
+using UnityEngine;
+namespace VOID
+{
+ public class VOID_SurfAtmo : VOID_WindowModule
+ {
+ public VOID_SurfAtmo()
+ {
+ this._Name = "Surface & Atmospheric Information";
+ }
+
+ public override void ModuleWindow(int _)
+ {
+ GUILayout.BeginVertical();
+
+ GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ GUILayout.Label("Altitude (true):");
+ double alt_true = vessel.orbit.altitude - vessel.terrainAltitude;
+ // HACK: This assumes that on worlds with oceans, all water is fixed at 0 m, and water covers the whole surface at 0 m.
+ if (vessel.terrainAltitude < 0 && vessel.mainBody.ocean ) alt_true = vessel.orbit.altitude;
+ GUILayout.Label(Tools.MuMech_ToSI(alt_true) + "m", GUILayout.ExpandWidth(false));
+ GUILayout.EndHorizontal ();
+
+ GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ GUILayout.Label("Latitude:");
+ GUILayout.Label(Tools.GetLatitudeString(vessel), GUILayout.ExpandWidth(false));
+ GUILayout.EndHorizontal();
+
+ GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ GUILayout.Label("Longitude:");
+ GUILayout.Label(Tools.GetLongitudeString(vessel), GUILayout.ExpandWidth(false));
+ GUILayout.EndHorizontal();
+
+ GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ GUILayout.Label("Heading:");
+ GUILayout.Label(Tools.MuMech_get_heading(vessel).ToString("F2") + "° " + Tools.get_heading_text(Tools.MuMech_get_heading(vessel)), GUILayout.ExpandWidth(false));
+ GUILayout.EndHorizontal();
+
+ GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ GUILayout.Label("Terrain elevation:");
+ GUILayout.Label(Tools.MuMech_ToSI(vessel.terrainAltitude) + "m", GUILayout.ExpandWidth(false));
+ GUILayout.EndHorizontal();
+
+ GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ GUILayout.Label("Surface velocity:");
+ GUILayout.Label(Tools.MuMech_ToSI(vessel.srf_velocity.magnitude) + "m/s", GUILayout.ExpandWidth(false));
+ GUILayout.EndHorizontal();
+
+ GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ GUILayout.Label("Vertical speed:");
+ GUILayout.Label(Tools.MuMech_ToSI(vessel.verticalSpeed) + "m/s", GUILayout.ExpandWidth(false));
+ GUILayout.EndHorizontal();
+
+ GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ GUILayout.Label("Horizontal speed:");
+ GUILayout.Label(Tools.MuMech_ToSI(vessel.horizontalSrfSpeed) + "m/s", GUILayout.ExpandWidth(false));
+ GUILayout.EndHorizontal();
+
+ GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ GUILayout.Label("Temperature:");
+ GUILayout.Label(vessel.flightIntegrator.getExternalTemperature().ToString("F2") + "° C", GUILayout.ExpandWidth(false));
+ GUILayout.EndHorizontal();
+
+ GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ GUILayout.Label("Atmosphere density:");
+ GUILayout.Label(Tools.MuMech_ToSI(vessel.atmDensity * 1000) + "g/m³", GUILayout.ExpandWidth(false));
+ GUILayout.EndHorizontal();
+
+ GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ GUILayout.Label("Pressure:");
+ GUILayout.Label(vessel.staticPressure.ToString("F2") + " atms", GUILayout.ExpandWidth(false));
+ GUILayout.EndHorizontal();
+
+ GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ GUILayout.Label("Atmosphere limit:");
+ GUILayout.Label("≈ " + Tools.MuMech_ToSI(vessel.mainBody.maxAtmosphereAltitude) + "m", GUILayout.ExpandWidth(false));
+ GUILayout.EndHorizontal();
+
+ // Toadicus edit: added Biome
+ GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ GUILayout.Label("Biome:");
+ GUILayout.Label(Tools.Toadicus_GetAtt(vessel).name, VOID_Core.Instance.LabelStyles["txt_right"]);
+ GUILayout.EndHorizontal();
+
+ GUILayout.EndVertical();
+ GUI.DragWindow();
+ }
+ }
+}
--- /dev/null
+++ b/VOID_Transfer.cs
@@ -1,1 +1,269 @@
-
+//
+// VOID_Orbital.cs
+//
+// Author:
+// toadicus <>
+//
+// Copyright (c) 2013 toadicus
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+using KSP;
+using System;
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace VOID
+{
+ public class VOID_Transfer : VOID_WindowModule
+ {
+ [AVOID_SaveValue("toggleExtended")]
+ protected VOID_SaveValue<bool> toggleExtended = false;
+
+ protected List<CelestialBody> selectedBodies = new List<CelestialBody>();
+
+ public VOID_Transfer()
+ {
+ this._Name = "Transfer Angle Information";
+ }
+
+ public override void ModuleWindow(int _)
+ {
+ GUILayout.BeginVertical();
+
+ if (vessel.mainBody.name == "Sun") //Vessel is orbiting the Sun
+ {
+ foreach (CelestialBody body in vessel.mainBody.orbitingBodies)
+ {
+ GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ if (GUILayout.Button(body.bodyName))
+ {
+ //add or remove this body to this list of bodies to display more info on
+ if (selectedBodies.Contains(body)) selectedBodies.Remove(body);
+ else selectedBodies.Add(body);
+ }
+ GUILayout.Label("Inclined " + body.orbit.inclination.ToString("F3") + "°", GUILayout.ExpandWidth(false));
+ GUILayout.EndHorizontal();
+
+ if (selectedBodies.Contains(body))
+ {
+ display_transfer_angles_SUN2PLANET(body); //show phase angles for each selected body
+ tad_targeting(body); //display Set/Unset Target button for each selected body
+ }
+ }
+ }
+ else if (vessel.mainBody.referenceBody.name == "Sun") //Vessel is orbiting a planet
+ {
+ foreach (CelestialBody body in vessel.mainBody.referenceBody.orbitingBodies)
+ {
+ if (body.name != vessel.mainBody.name) // show other planets
+ {
+ GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ if (GUILayout.Button(body.bodyName))
+ {
+ //add or remove this body to this list of bodies to display more info on
+ if (selectedBodies.Contains(body)) selectedBodies.Remove(body);
+ else selectedBodies.Add(body);
+ }
+ GUILayout.Label("Inclined " + body.orbit.inclination.ToString("F3") + "°", GUILayout.ExpandWidth(false));
+ GUILayout.EndHorizontal();
+
+ if (selectedBodies.Contains(body))
+ {
+ display_transfer_angles_PLANET2PLANET(body);
+ tad_targeting(body); //display Set/Unset Target button
+ }
+ }
+ }
+ foreach (CelestialBody body in vessel.mainBody.orbitingBodies) // show moons
+ {
+ GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ if (GUILayout.Button(body.bodyName))
+ {
+ //add or remove this body to this list of bodies to display more info on
+ if (selectedBodies.Contains(body)) selectedBodies.Remove(body);
+ else selectedBodies.Add(body);
+ }
+ GUILayout.Label("Inclined " + body.orbit.inclination.ToString("F3") + "°", GUILayout.ExpandWidth(false));
+ GUILayout.EndHorizontal();
+
+ if (selectedBodies.Contains(body))
+ {
+ display_transfer_angles_PLANET2MOON(body);
+ tad_targeting(body); //display Set/Unset Target button
+ }
+ }
+ }
+ else if (vessel.mainBody.referenceBody.referenceBody.name == "Sun") // Vessel is orbiting a moon
+ {
+ foreach (CelestialBody body in vessel.mainBody.referenceBody.orbitingBodies)
+ {
+ if (body.name != vessel.mainBody.name) // show other moons
+ {
+ GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ if (GUILayout.Button(body.bodyName))
+ {
+ //add or remove this body to this list of bodies to display more info on
+ if (selectedBodies.Contains(body)) selectedBodies.Remove(body);
+ else selectedBodies.Add(body);
+ }
+ GUILayout.Label("Inclined " + body.orbit.inclination.ToString("F3") + "°", GUILayout.ExpandWidth(false));
+ GUILayout.EndHorizontal();
+
+ if (selectedBodies.Contains(body))
+ {
+ display_transfer_angles_MOON2MOON(body);
+ tad_targeting(body); //display Set/Unset Target button
+ }
+ }
+ }
+ }
+ GUILayout.EndVertical();
+ GUI.DragWindow();
+ }
+
+ private void tad_targeting(CelestialBody body)
+ {
+ //Target Set/Unset buttons
+ if (FlightGlobals.fetch.VesselTarget == null || (FlightGlobals.fetch.VesselTarget != null && FlightGlobals.fetch.VesselTarget.GetVessel() == null))
+ {
+ //No TGT set or TGT is a Body
+ if ((CelestialBody)FlightGlobals.fetch.VesselTarget != body)
+ {
+ if (GUILayout.Button("Set Target", GUILayout.ExpandWidth(false)))
+ {
+ FlightGlobals.fetch.SetVesselTarget(body);
+ Tools.PostDebugMessage("[VOID] KSP Target set to CelestialBody " + body.bodyName);
+ }
+ }
+ else if ((CelestialBody)FlightGlobals.fetch.VesselTarget == body)
+ {
+ if (GUILayout.Button("Unset Target", GUILayout.ExpandWidth(false)))
+ {
+ FlightGlobals.fetch.SetVesselTarget(null);
+ Tools.PostDebugMessage("[VOID] KSP Target set to null");
+ }
+ }
+ }
+ else if (FlightGlobals.fetch.VesselTarget == null || (FlightGlobals.fetch.VesselTarget != null && FlightGlobals.fetch.VesselTarget.GetVessel() != null))
+ {
+ //No TGT or TGT is a vessel
+ if (GUILayout.Button("Set Target", GUILayout.ExpandWidth(false)))
+ {
+ FlightGlobals.fetch.SetVesselTarget(body);
+ Tools.PostDebugMessage("[VOID] KSP Target set to CelestialBody " + body.bodyName);
+ }
+ }
+ }
+
+ private void display_transfer_angles_SUN2PLANET(CelestialBody body)
+ {
+ GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ GUILayout.Label("Phase angle (curr/trans):");
+ GUILayout.Label(Tools.mrenigma03_calcphase(vessel, body).ToString("F3") + "° / " + Tools.Nivvy_CalcTransferPhaseAngle(vessel.orbit.semiMajorAxis, body.orbit.semiMajorAxis, vessel.mainBody.gravParameter).ToString("F3") + "°", GUILayout.ExpandWidth(false));
+ GUILayout.EndHorizontal();
+
+ GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ GUILayout.Label("Transfer velocity:");
+ GUILayout.Label((Tools.Younata_DeltaVToGetToOtherBody((vessel.mainBody.gravParameter / 1000000000), (vessel.orbit.semiMajorAxis / 1000), (body.orbit.semiMajorAxis / 1000)) * 1000).ToString("F2") + "m/s", GUILayout.ExpandWidth(false));
+ GUILayout.EndHorizontal();
+ }
+
+ private void display_transfer_angles_PLANET2PLANET(CelestialBody body)
+ {
+ double dv1 = Tools.Younata_DeltaVToGetToOtherBody((vessel.mainBody.referenceBody.gravParameter / 1000000000), (vessel.mainBody.orbit.semiMajorAxis / 1000), (body.orbit.semiMajorAxis / 1000));
+ double dv2 = Tools.Younata_DeltaVToExitSOI((vessel.mainBody.gravParameter / 1000000000), (vessel.orbit.semiMajorAxis / 1000), (vessel.mainBody.sphereOfInfluence / 1000), Math.Abs(dv1));
+
+ double trans_ejection_angle = Tools.Younata_TransferBurnPoint((vessel.orbit.semiMajorAxis / 1000), dv2, (Math.PI / 2.0), (vessel.mainBody.gravParameter / 1000000000));
+ double curr_ejection_angle = Tools.Adammada_CurrentEjectionAngle(FlightGlobals.ActiveVessel.longitude, FlightGlobals.ActiveVessel.orbit.referenceBody.rotationAngle, FlightGlobals.ActiveVessel.orbit.referenceBody.orbit.LAN, FlightGlobals.ActiveVessel.orbit.referenceBody.orbit.orbitPercent);
+
+ double trans_phase_angle = Tools.Nivvy_CalcTransferPhaseAngle(vessel.mainBody.orbit.semiMajorAxis, body.orbit.semiMajorAxis, vessel.mainBody.referenceBody.gravParameter) % 360;
+ double curr_phase_angle = Tools.Adammada_CurrrentPhaseAngle(body.orbit.LAN, body.orbit.orbitPercent, FlightGlobals.ActiveVessel.orbit.referenceBody.orbit.LAN, FlightGlobals.ActiveVessel.orbit.referenceBody.orbit.orbitPercent);
+
+ double adj_phase_angle = Tools.adjustCurrPhaseAngle(trans_phase_angle, curr_phase_angle);
+ double adj_trans_ejection_angle = Tools.adjust_transfer_ejection_angle(trans_ejection_angle, trans_phase_angle);
+ double adj_curr_ejection_angle = Tools.adjust_current_ejection_angle(curr_ejection_angle);
+
+ GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ GUILayout.Label("Phase angle (curr/trans):");
+ GUILayout.Label(adj_phase_angle.ToString("F3") + "° / " + trans_phase_angle.ToString("F3") + "°", GUILayout.ExpandWidth(false));
+ GUILayout.EndHorizontal();
+
+ GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ GUILayout.Label("Ejection angle (curr/trans):");
+ GUILayout.Label(adj_curr_ejection_angle.ToString("F3") + "° / " + adj_trans_ejection_angle.ToString("F3") + "°", GUILayout.ExpandWidth(false));
+ GUILayout.EndHorizontal();
+
+ GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ GUILayout.Label("Transfer velocity:");
+ GUILayout.Label((dv2 * 1000).ToString("F2") + "m/s", GUILayout.ExpandWidth(false));
+ GUILayout.EndHorizontal();
+ }
+
+ private void display_transfer_angles_PLANET2MOON(CelestialBody body)
+ {
+ double dv1 = Tools.Younata_DeltaVToGetToOtherBody((vessel.mainBody.gravParameter / 1000000000), (vessel.orbit.semiMajorAxis / 1000), (body.orbit.semiMajorAxis / 1000));
+
+ double trans_phase_angle = Tools.Nivvy_CalcTransferPhaseAngle(vessel.orbit.semiMajorAxis, body.orbit.semiMajorAxis, vessel.mainBody.gravParameter);
+
+ GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ GUILayout.Label("Phase angle (curr/trans):");
+ GUILayout.Label(Tools.mrenigma03_calcphase(vessel, body).ToString("F3") + "° / " + trans_phase_angle.ToString("F3") + "°", GUILayout.ExpandWidth(false));
+ GUILayout.EndHorizontal();
+
+ GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ GUILayout.Label("Transfer velocity:");
+ GUILayout.Label((dv1 * 1000).ToString("F2") + "m/s", GUILayout.ExpandWidth(false));
+ GUILayout.EndHorizontal();
+ }
+
+ private void display_transfer_angles_MOON2MOON(CelestialBody body)
+ {
+ double dv1 = Tools.Younata_DeltaVToGetToOtherBody((vessel.mainBody.referenceBody.gravParameter / 1000000000), (vessel.mainBody.orbit.semiMajorAxis / 1000), (body.orbit.semiMajorAxis / 1000));
+ double dv2 = Tools.Younata_DeltaVToExitSOI((vessel.mainBody.gravParameter / 1000000000), (vessel.orbit.semiMajorAxis / 1000), (vessel.mainBody.sphereOfInfluence / 1000), Math.Abs(dv1));
+ double trans_ejection_angle = Tools.Younata_TransferBurnPoint((vessel.orbit.semiMajorAxis / 1000), dv2, (Math.PI / 2.0), (vessel.mainBody.gravParameter / 1000000000));
+
+ double curr_phase_angle = Tools.Adammada_CurrrentPhaseAngle(body.orbit.LAN, body.orbit.orbitPercent, FlightGlobals.ActiveVessel.orbit.referenceBody.orbit.LAN, FlightGlobals.ActiveVessel.orbit.referenceBody.orbit.orbitPercent);
+ double curr_ejection_angle = Tools.Adammada_CurrentEjectionAngle(FlightGlobals.ActiveVessel.longitude, FlightGlobals.ActiveVessel.orbit.referenceBody.rotationAngle, FlightGlobals.ActiveVessel.orbit.referenceBody.orbit.LAN, FlightGlobals.ActiveVessel.orbit.referenceBody.orbit.orbitPercent);
+
+ double trans_phase_angle = Tools.Nivvy_CalcTransferPhaseAngle(vessel.mainBody.orbit.semiMajorAxis, body.orbit.semiMajorAxis, vessel.mainBody.referenceBody.gravParameter) % 360;
+
+ double adj_phase_angle = Tools.adjustCurrPhaseAngle(trans_phase_angle, curr_phase_angle);
+ //double adj_ejection_angle = adjustCurrEjectionAngle(trans_phase_angle, curr_ejection_angle);
+
+ //new stuff
+ //
+ double adj_trans_ejection_angle = Tools.adjust_transfer_ejection_angle(trans_ejection_angle, trans_phase_angle);
+ double adj_curr_ejection_angle = Tools.adjust_current_ejection_angle(curr_ejection_angle);
+ //
+ //
+
+ GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ GUILayout.Label("Phase angle (curr/trans):");
+ GUILayout.Label(adj_phase_angle.ToString("F3") + "° / " + trans_phase_angle.ToString("F3") + "°", GUILayout.ExpandWidth(false));
+ GUILayout.EndHorizontal();
+
+ GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ GUILayout.Label("Ejection angle (curr/trans):");
+ GUILayout.Label(adj_curr_ejection_angle.ToString("F3") + "° / " + adj_trans_ejection_angle.ToString("F3") + "°", GUILayout.ExpandWidth(false));
+ GUILayout.EndHorizontal();
+
+ GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ GUILayout.Label("Transfer velocity:");
+ GUILayout.Label((dv2 * 1000).ToString("F2") + "m/s", GUILayout.ExpandWidth(false));
+ GUILayout.EndHorizontal();
+ }
+ }
+}
+
+
--- /dev/null
+++ b/VOID_VesselInfo.cs
@@ -1,1 +1,142 @@
+//
+// VOID_Orbital.cs
+//
+// Author:
+// toadicus <>
+//
+// Copyright (c) 2013 toadicus
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+using KSP;
+using System;
+using UnityEngine;
+namespace VOID
+{
+ public class VOID_VesselInfo : VOID_WindowModule
+ {
+ [AVOID_SaveValue("toggleExtended")]
+ protected VOID_SaveValue<bool> toggleExtended = false;
+
+ public VOID_VesselInfo()
+ {
+ this._Name = "Vessel Information";
+ }
+
+ public override void ModuleWindow(int _)
+ {
+ if ((TimeWarp.WarpMode == TimeWarp.Modes.LOW) || (TimeWarp.CurrentRate <= TimeWarp.MaxPhysicsRate))
+ {
+ Engineer.VesselSimulator.SimManager.Instance.RequestSimulation();
+ }
+
+ Engineer.VesselSimulator.Stage[] stages = Engineer.VesselSimulator.SimManager.Instance.Stages;
+
+ GUILayout.BeginVertical();
+
+ GUILayout.Label(vessel.vesselName, VOID_Core.Instance.LabelStyles["center_bold"], GUILayout.ExpandWidth(true));
+
+ GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ GUILayout.Label("G-force:");
+ GUILayout.Label(vessel.geeForce.ToString("F2") + " gees", GUILayout.ExpandWidth(false));
+ GUILayout.EndHorizontal();
+
+ int num_parts = 0;
+ double total_mass = vessel.GetTotalMass();
+ double resource_mass = 0;
+ double max_thrust = 0;
+ double final_thrust = 0;
+
+ foreach (Part p in vessel.parts)
+ {
+ num_parts++;
+ resource_mass += p.GetResourceMass();
+
+ foreach (PartModule pm in p.Modules)
+ {
+ if ((pm.moduleName == "ModuleEngines") && ((p.State == PartStates.ACTIVE) || ((Staging.CurrentStage > Staging.lastStage) && (p.inverseStage == Staging.lastStage))))
+ {
+ max_thrust += ((ModuleEngines)pm).maxThrust;
+ final_thrust += ((ModuleEngines)pm).finalThrust;
+ }
+ }
+ }
+
+ GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ GUILayout.Label("Parts:");
+ GUILayout.Label(num_parts.ToString("F0"), GUILayout.ExpandWidth(false));
+ GUILayout.EndHorizontal();
+
+ GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ GUILayout.Label("Total mass:");
+ GUILayout.Label(total_mass.ToString("F1") + " tons", GUILayout.ExpandWidth(false));
+ GUILayout.EndHorizontal();
+
+ GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ GUILayout.Label("Resource mass:");
+ GUILayout.Label(resource_mass.ToString("F1") + " tons", GUILayout.ExpandWidth(false));
+ GUILayout.EndHorizontal();
+
+ if (stages.Length > Staging.lastStage)
+ {
+ GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ GUILayout.Label("DeltaV (Current Stage):");
+ GUILayout.Label(Tools.MuMech_ToSI(stages[Staging.lastStage].deltaV).ToString() + "m/s", GUILayout.ExpandWidth(false));
+ GUILayout.EndHorizontal();
+ }
+
+ if (stages.Length > 0)
+ {
+ double totalDeltaV = 0d;
+
+ for (int i = 0; i < stages.Length; ++i)
+ {
+ totalDeltaV += stages [i].deltaV;
+ }
+
+ GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ GUILayout.Label("DeltaV (Total):");
+ GUILayout.Label(Tools.MuMech_ToSI(totalDeltaV).ToString() + "m/s", GUILayout.ExpandWidth(false));
+ GUILayout.EndHorizontal();
+ }
+
+ GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ GUILayout.Label("Throttle:");
+ GUILayout.Label((vessel.ctrlState.mainThrottle * 100f).ToString("F0") + "%", GUILayout.ExpandWidth(false));
+ GUILayout.EndHorizontal();
+
+ GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ GUILayout.Label("Thrust (curr/max):");
+ GUILayout.Label(final_thrust.ToString("F1") + " / " + max_thrust.ToString("F1") + " kN", GUILayout.ExpandWidth(false));
+ GUILayout.EndHorizontal();
+
+ double gravity = vessel.mainBody.gravParameter / Math.Pow(vessel.mainBody.Radius + vessel.altitude, 2);
+ GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ GUILayout.Label("T:W (curr/max):");
+ GUILayout.Label((final_thrust / (total_mass * gravity)).ToString("F2") + " / " + (max_thrust / (total_mass * gravity)).ToString("F2"), GUILayout.ExpandWidth(false));
+ GUILayout.EndHorizontal();
+
+ double g_ASL = (VOID_Core.Constant_G * vessel.mainBody.Mass) / Math.Pow(vessel.mainBody.Radius, 2);
+ GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ GUILayout.Label("Max T:W @ surface:");
+ GUILayout.Label((max_thrust / (total_mass * g_ASL)).ToString("F2"), GUILayout.ExpandWidth(false));
+ GUILayout.EndHorizontal();
+
+ GUILayout.EndVertical();
+ GUI.DragWindow();
+ }
+ }
+}
+
+