VOID_HUD: Added new delta-v lines to leftHUD. Added new pitch field to rightHUD. Moved sciency stuff to top line of rightHUD.
--- a/Tools.cs
+++ b/Tools.cs
@@ -149,67 +149,17 @@
return string.Format("{0}° {1}", Math.Abs(v_lat).ToString(format), dir_lat);
}
- ///////////////////////////////////////////////////////////////////////////////
-
- //For MuMech_get_heading()
- public class MuMech_MovingAverage
- {
- private double[] store;
- private int storeSize;
- private int nextIndex = 0;
-
- public double value
- {
- get
- {
- double tmp = 0;
- foreach (double i in store)
- {
- tmp += i;
- }
- return tmp / storeSize;
- }
- set
- {
- store[nextIndex] = value;
- nextIndex = (nextIndex + 1) % storeSize;
- }
- }
-
- public MuMech_MovingAverage(int size = 10, double startingValue = 0)
- {
- storeSize = size;
- store = new double[size];
- force(startingValue);
- }
-
- public void force(double newValue)
- {
- for (int i = 0; i < storeSize; i++)
- {
- store[i] = newValue;
- }
- }
-
- public static implicit operator double(MuMech_MovingAverage v)
- {
- return v.value;
- }
-
- public override string ToString()
- {
- return value.ToString();
- }
-
- public string ToString(string format)
- {
- return value.ToString(format);
- }
- }
- //From http://svn.mumech.com/KSP/trunk/MuMechLib/VOID.vesselState.cs
- public static double MuMech_get_heading(Vessel vessel)
- {
- Vector3d CoM;
+ /*
+ * MuMechLib Methods
+ * The methods below are adapted from MuMechLib, © 2013-2014 r4m0n
+ * The following methods are a derivative work of the code from MuMechLib in the MechJeb project.
+ * Used under license.
+ * */
+
+ // Derived from MechJeb2/VesselState.cs
+ public static Quaternion getSurfaceRotation(this Vessel vessel)
+ {
+ Vector3 CoM;
try
{
@@ -217,25 +167,42 @@
}
catch
{
- return double.NaN;
- }
-
- Vector3d up = (CoM - vessel.mainBody.position).normalized;
- Vector3d north = Vector3d.Exclude(
- up,
- (vessel.mainBody.position +
- vessel.mainBody.transform.up * (float)vessel.mainBody.Radius
- ) - CoM).normalized;
-
- Quaternion rotationSurface = Quaternion.LookRotation(north, up);
- Quaternion rotationvesselSurface = Quaternion.Inverse(
- Quaternion.Euler(90, 0, 0) *
- Quaternion.Inverse(vessel.transform.rotation) *
- rotationSurface);
-
- return rotationvesselSurface.eulerAngles.y;
- }
- //From http://svn.mumech.com/KSP/trunk/MuMechLib/MuUtils.cs
+ return new Quaternion();
+ }
+
+ Vector3 bodyPosition = vessel.mainBody.position;
+ Vector3 bodyUp = vessel.mainBody.transform.up;
+
+ Vector3 surfaceUp = (CoM - vessel.mainBody.position).normalized;
+ Vector3 surfaceNorth = Vector3.Exclude(
+ surfaceUp,
+ (bodyPosition + bodyUp * (float)vessel.mainBody.Radius) - CoM
+ ).normalized;
+
+ Quaternion surfaceRotation = Quaternion.LookRotation(surfaceNorth, surfaceUp);
+
+ return Quaternion.Inverse(
+ Quaternion.Euler(90, 0, 0) * Quaternion.Inverse(vessel.GetTransform().rotation) * surfaceRotation
+ );
+ }
+
+ // Derived from MechJeb2/VesselState.cs
+ public static double getSurfaceHeading(this Vessel vessel)
+ {
+ return vessel.getSurfaceRotation().eulerAngles.y;
+ }
+
+ // Derived from MechJeb2/VesselState.cs
+ public static double getSurfacePitch(this Vessel vessel)
+ {
+ Quaternion vesselSurfaceRotation = vessel.getSurfaceRotation();
+
+ return (vesselSurfaceRotation.eulerAngles.x > 180f) ?
+ (360f - vesselSurfaceRotation.eulerAngles.x) :
+ -vesselSurfaceRotation.eulerAngles.x;
+ }
+
+ // Derived from MechJeb2/MuUtils.cs
public static string MuMech_ToSI(
double d, int digits = 3, int MinMagnitude = 0, int MaxMagnitude = int.MaxValue
)
@@ -325,6 +292,10 @@
}
}
+ /*
+ * END MuMecLib METHODS
+ * */
+
public static string ConvertInterval(double seconds)
{
string format_1 = "{0:D1}y {1:D1}d {2:D2}h {3:D2}m {4:D2}.{5:D1}s";
--- /dev/null
+++ b/VOIDEditorMaster.cs
@@ -1,1 +1,100 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+// VOID - Vessel Orbital Information Display for Kerbal Space Program
+// Copyright (C) 2012 Iannic-ann-od
+// 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/>.
+//
+///////////////////////////////////////////////////////////////////////////////
+//
+// Much, much credit to Younata, Adammada, Nivvydaskrl and to all the authors
+// behind MechJeb, RemoteTech Relay Network, ISA MapSat, and Protractor for some
+// invaluable functions and making your nicely written code available to learn from.
+//
+///////////////////////////////////////////////////////////////////////////////
+//
+// This software uses VesselSimulator and Engineer.Extensions from Engineer Redux.
+// Engineer Redux (c) 2013 cybutek
+// Used by permission.
+//
+///////////////////////////////////////////////////////////////////////////////
+using System;
+using UnityEngine;
+using Engineer.VesselSimulator;
+
+namespace VOID
+{
+ [KSPAddon(KSPAddon.Startup.EditorAny, false)]
+ public class VOIDEditorMaster : MonoBehaviour
+ {
+ protected VOID_EditorCore Core;
+
+ public void Awake()
+ {
+ Tools.PostDebugMessage ("VOIDEditorMaster: Waking up.");
+ this.Core = VOID_EditorCore.Instance;
+ this.Core.ResetGUI ();
+ SimManager.HardReset();
+ Tools.PostDebugMessage ("VOIDEditorMaster: Awake.");
+ }
+
+ public void Update()
+ {
+ if (!HighLogic.LoadedSceneIsEditor && this.Core != null)
+ {
+ this.Core.SaveConfig ();
+ this.Core = null;
+ VOID_EditorCore.Reset();
+ return;
+ }
+
+ if (this.Core == null)
+ {
+ this.Awake();
+ }
+
+ this.Core.Update ();
+
+ if (this.Core.factoryReset)
+ {
+ KSP.IO.File.Delete<VOID_EditorCore>("config.xml");
+ this.Core = null;
+ VOID_EditorCore.Reset();
+ }
+ }
+
+ public void FixedUpdate()
+ {
+ if (this.Core == null || !HighLogic.LoadedSceneIsEditor)
+ {
+ return;
+ }
+
+ this.Core.FixedUpdate ();
+ }
+
+ public void OnGUI()
+ {
+ if (this.Core == null)
+ {
+ return;
+ }
+
+ this.Core.OnGUI();
+ }
+ }
+}
+
--- a/VOIDFlightMaster.cs
+++ b/VOIDFlightMaster.cs
@@ -96,65 +96,5 @@
this.Core.OnGUI();
}
}
-
- [KSPAddon(KSPAddon.Startup.EditorAny, false)]
- public class VOIDEditorMaster : MonoBehaviour
- {
- protected VOID_EditorCore Core;
-
- public void Awake()
- {
- Tools.PostDebugMessage ("VOIDEditorMaster: Waking up.");
- this.Core = VOID_EditorCore.Instance;
- this.Core.ResetGUI ();
- SimManager.HardReset();
- Tools.PostDebugMessage ("VOIDEditorMaster: Awake.");
- }
-
- public void Update()
- {
- if (!HighLogic.LoadedSceneIsEditor && this.Core != null)
- {
- this.Core.SaveConfig ();
- this.Core = null;
- VOID_EditorCore.Reset();
- return;
- }
-
- if (this.Core == null)
- {
- this.Awake();
- }
-
- this.Core.Update ();
-
- if (this.Core.factoryReset)
- {
- KSP.IO.File.Delete<VOID_EditorCore>("config.xml");
- this.Core = null;
- VOID_EditorCore.Reset();
- }
- }
-
- public void FixedUpdate()
- {
- if (this.Core == null || !HighLogic.LoadedSceneIsEditor)
- {
- return;
- }
-
- this.Core.FixedUpdate ();
- }
-
- public void OnGUI()
- {
- if (this.Core == null)
- {
- return;
- }
-
- this.Core.OnGUI();
- }
- }
}
--- a/VOID_CBInfoBrowser.cs
+++ b/VOID_CBInfoBrowser.cs
@@ -98,8 +98,6 @@
GUILayout.EndVertical();
GUILayout.EndHorizontal();
-
- //}
//toggle for orbital info chunk
if (GUILayout.Button("Orbital Characteristics", GUILayout.ExpandWidth(true))) toggleOrbital.value = !toggleOrbital;
@@ -206,84 +204,53 @@
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["right"], GUILayout.ExpandWidth(true));
else GUILayout.Label((body.orbit.ApA / 1000).ToString("##,#") + "km", VOID_Core.Instance.LabelStyles["right"], GUILayout.ExpandWidth(true));
- //GUILayout.EndHorizontal();
-
- //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+
if (body.bodyName == "Sun") GUILayout.Label("N/A", VOID_Core.Instance.LabelStyles["right"], GUILayout.ExpandWidth(true));
else GUILayout.Label(Tools.ConvertInterval(body.orbit.timeToAp), VOID_Core.Instance.LabelStyles["right"], GUILayout.ExpandWidth(true));
- //GUILayout.EndHorizontal();
-
- //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+
if (body.bodyName == "Sun") GUILayout.Label("N/A", VOID_Core.Instance.LabelStyles["right"], GUILayout.ExpandWidth(true));
else GUILayout.Label((body.orbit.PeA / 1000).ToString("##,#") + "km", VOID_Core.Instance.LabelStyles["right"], GUILayout.ExpandWidth(true));
- //GUILayout.EndHorizontal();
-
- //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+
if (body.bodyName == "Sun") GUILayout.Label("N/A", VOID_Core.Instance.LabelStyles["right"], GUILayout.ExpandWidth(true));
else GUILayout.Label(Tools.ConvertInterval(body.orbit.timeToPe), VOID_Core.Instance.LabelStyles["right"], GUILayout.ExpandWidth(true));
- //GUILayout.EndHorizontal();
-
- //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+
if (body.bodyName == "Sun") GUILayout.Label("N/A", VOID_Core.Instance.LabelStyles["right"], GUILayout.ExpandWidth(true));
else GUILayout.Label((body.orbit.semiMajorAxis / 1000).ToString("##,#") + "km", VOID_Core.Instance.LabelStyles["right"], GUILayout.ExpandWidth(true));
- //GUILayout.EndHorizontal();
-
- //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+
if (body.bodyName == "Sun") GUILayout.Label("N/A", VOID_Core.Instance.LabelStyles["right"], GUILayout.ExpandWidth(true));
else GUILayout.Label(body.orbit.eccentricity.ToString("F4") + "", VOID_Core.Instance.LabelStyles["right"], GUILayout.ExpandWidth(true));
- //GUILayout.EndHorizontal();
-
- //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+
if (body.bodyName == "Sun") GUILayout.Label("N/A", VOID_Core.Instance.LabelStyles["right"], GUILayout.ExpandWidth(true));
else GUILayout.Label(Tools.ConvertInterval(body.orbit.period), VOID_Core.Instance.LabelStyles["right"], GUILayout.ExpandWidth(true));
- //GUILayout.EndHorizontal();
-
- //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+
if (body.bodyName == "Sun") GUILayout.Label("N/A", VOID_Core.Instance.LabelStyles["right"], GUILayout.ExpandWidth(true));
else GUILayout.Label(Tools.ConvertInterval(body.rotationPeriod), VOID_Core.Instance.LabelStyles["right"], GUILayout.ExpandWidth(true));
- //GUILayout.EndHorizontal();
-
- //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+
if (body.bodyName == "Sun") GUILayout.Label("N/A", VOID_Core.Instance.LabelStyles["right"], GUILayout.ExpandWidth(true));
else GUILayout.Label((body.orbit.orbitalSpeed / 1000).ToString("F2") + "km/s", VOID_Core.Instance.LabelStyles["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["right"], GUILayout.ExpandWidth(true));
else GUILayout.Label((body.orbit.meanAnomaly * 180d / Math.PI).ToString("F3") + "°", VOID_Core.Instance.LabelStyles["right"], GUILayout.ExpandWidth(true));
- //GUILayout.EndHorizontal();
-
- //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+
if (body.bodyName == "Sun") GUILayout.Label("N/A", VOID_Core.Instance.LabelStyles["right"], GUILayout.ExpandWidth(true));
else GUILayout.Label(body.orbit.trueAnomaly.ToString("F3") + "°", VOID_Core.Instance.LabelStyles["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["right"], GUILayout.ExpandWidth(true));
else GUILayout.Label((body.orbit.eccentricAnomaly * 180d / Math.PI).ToString("F3") + "°", VOID_Core.Instance.LabelStyles["right"], GUILayout.ExpandWidth(true));
- //GUILayout.EndHorizontal();
-
- //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+
if (body.bodyName == "Sun") GUILayout.Label("N/A", VOID_Core.Instance.LabelStyles["right"], GUILayout.ExpandWidth(true));
else GUILayout.Label(body.orbit.inclination.ToString("F3") + "°", VOID_Core.Instance.LabelStyles["right"], GUILayout.ExpandWidth(true));
- //GUILayout.EndHorizontal();
-
- //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+
if (body.bodyName == "Sun") GUILayout.Label("N/A", VOID_Core.Instance.LabelStyles["right"], GUILayout.ExpandWidth(true));
else GUILayout.Label(body.orbit.LAN.ToString("F3") + "°", VOID_Core.Instance.LabelStyles["right"], GUILayout.ExpandWidth(true));
- //GUILayout.EndHorizontal();
-
- //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+
if (body.bodyName == "Sun") GUILayout.Label("N/A", VOID_Core.Instance.LabelStyles["right"], GUILayout.ExpandWidth(true));
else GUILayout.Label(body.orbit.argumentOfPeriapsis.ToString("F3") + "°", VOID_Core.Instance.LabelStyles["right"], GUILayout.ExpandWidth(true));
- //GUILayout.EndHorizontal();
-
- //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+
if (body.bodyName == "Sun") GUILayout.Label("N/A", VOID_Core.Instance.LabelStyles["right"], GUILayout.ExpandWidth(true));
else
{
@@ -291,42 +258,28 @@
if (body.tidallyLocked) body_tidally_locked = "Yes";
GUILayout.Label(body_tidally_locked, VOID_Core.Instance.LabelStyles["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["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["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["right"], GUILayout.ExpandWidth(true));
- //GUILayout.Label(((4 / 3) * Math.PI * Math.Pow((vessel.mainBody.Radius / 1000), 3)).ToString(), right, GUILayout.ExpandWidth(true));
- //GUILayout.EndHorizontal();
-
- //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+
GUILayout.Label(body.Mass.ToString("0.00e+00") + "kg", VOID_Core.Instance.LabelStyles["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["right"], GUILayout.ExpandWidth(true));
- //GUILayout.EndHorizontal();
-
- //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+
if (body.bodyName == "Sun") GUILayout.Label(Tools.MuMech_ToSI(body.sphereOfInfluence), VOID_Core.Instance.LabelStyles["right"], GUILayout.ExpandWidth(true));
else GUILayout.Label(Tools.MuMech_ToSI(body.sphereOfInfluence), VOID_Core.Instance.LabelStyles["right"], GUILayout.ExpandWidth(true));
- //GUILayout.EndHorizontal();
-
- //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+
GUILayout.Label(body.orbitingBodies.Count.ToString(), VOID_Core.Instance.LabelStyles["right"], GUILayout.ExpandWidth(true));
- //GUILayout.EndHorizontal();
//show # artificial satellites
int num_art_sats = 0;
@@ -335,30 +288,31 @@
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["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["right"], GUILayout.ExpandWidth(true));
- //GUILayout.EndHorizontal();
-
- //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
- GUILayout.Label("≈ " + Tools.MuMech_ToSI(body.maxAtmosphereAltitude) + "m", VOID_Core.Instance.LabelStyles["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["right"], GUILayout.ExpandWidth(true));
- //GUILayout.EndHorizontal();
-
- //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+
+ if (body.atmosphere)
+ {
+ GUILayout.Label("≈ " + Tools.MuMech_ToSI(body.maxAtmosphereAltitude) + "m",
+ VOID_Core.Instance.LabelStyles["right"],
+ GUILayout.ExpandWidth(true));
+
+ string O2 = "No";
+ if (body.atmosphereContainsOxygen == true) O2 = "Yes";
+ GUILayout.Label(O2, VOID_Core.Instance.LabelStyles["right"], GUILayout.ExpandWidth(true));
+ }
+ else
+ {
+ GUILayout.Label("N/A", VOID_Core.Instance.LabelStyles["right"], GUILayout.ExpandWidth(true));
+ GUILayout.Label("N/A", VOID_Core.Instance.LabelStyles["right"], GUILayout.ExpandWidth(true));
+ }
+
string ocean = "No";
if (body.ocean == true) ocean = "Yes";
GUILayout.Label(ocean, VOID_Core.Instance.LabelStyles["right"], GUILayout.ExpandWidth(true));
- //GUILayout.EndHorizontal();
}
}
}
--- a/VOID_Core.cs
+++ b/VOID_Core.cs
@@ -849,18 +849,11 @@
protected void InitializeToolbarButton()
{
- this.ToolbarButton = ToolbarManager.Instance.add(this.GetType().Name, "coreToggle");
+ this.ToolbarButton = ToolbarManager.Instance.add(this.VoidName, "coreToggle");
this.ToolbarButton.Text = this.VoidName;
this.SetIconTexture(this.powerState | this.activeState);
- if (this is VOID_EditorCore)
- {
- this.ToolbarButton.Visibility = new GameScenesVisibility(GameScenes.EDITOR);
- }
- else
- {
- this.ToolbarButton.Visibility = new GameScenesVisibility(GameScenes.FLIGHT);
- }
+ this.ToolbarButton.Visibility = new GameScenesVisibility(GameScenes.EDITOR, GameScenes.FLIGHT, GameScenes.SPH);
this.ToolbarButton.OnClick +=
(e) =>
@@ -985,6 +978,33 @@
Active = 8
}
}
+
+ public static partial class VOID_Data
+ {
+ public static VOID_Core core
+ {
+ get
+ {
+ return VOID_Core.Instance;
+ }
+ }
+
+ public static Engineer.VesselSimulator.SimManager simManager
+ {
+ get
+ {
+ return Engineer.VesselSimulator.SimManager.Instance;
+ }
+ }
+
+ public static double KerbinGee
+ {
+ get
+ {
+ return core.Kerbin.gravParameter / Math.Pow(core.Kerbin.Radius, 2);
+ }
+ }
+ }
}
--- a/VOID_DataValue.cs
+++ b/VOID_DataValue.cs
@@ -48,6 +48,7 @@
* */
protected T cache;
protected Func<T> ValueFunc;
+ protected float lastUpdate;
/*
* Properties
@@ -55,8 +56,17 @@
public string Label { get; protected set; }
public string Units { get; protected set; }
- public T Value {
- get {
+ public T Value
+ {
+ get
+ {
+ if (
+ (VOID_Core.Instance.updateTimer - this.lastUpdate > VOID_Core.Instance.updatePeriod) ||
+ (this.lastUpdate > VOID_Core.Instance.updateTimer)
+ )
+ {
+ this.Refresh();
+ }
return (T)this.cache;
}
}
@@ -69,11 +79,13 @@
this.Label = Label;
this.Units = Units;
this.ValueFunc = ValueFunc;
+ this.lastUpdate = 0;
}
public void Refresh()
{
this.cache = this.ValueFunc.Invoke ();
+ this.lastUpdate = VOID_Core.Instance.updateTimer;
}
public T GetFreshValue()
@@ -106,30 +118,94 @@
}
}
- internal interface IVOID_NumericValue
- {
- double ToDouble();
- string ToString(string format);
- string ToSIString(int digits, int MinMagnitude, int MaxMagnitude);
- }
-
- public abstract class VOID_NumValue<T> : VOID_DataValue<T>, IVOID_NumericValue
- {
- public VOID_NumValue(string Label, Func<T> ValueFunc, string Units = "") : base(Label, ValueFunc, Units) {}
-
- public abstract double ToDouble();
- public abstract string ToString(string Format);
- public abstract string ToSIString(int digits = 3, int MinMagnitude = 0, int MaxMagnitude = int.MaxValue);
-
- public abstract string ValueUnitString(string format);
+ public abstract class VOID_NumValue<T> : VOID_DataValue<T>
+ where T : IFormattable, IConvertible, IComparable
+ {
+ public static implicit operator Double(VOID_NumValue<T> v)
+ {
+ return v.ToDouble();
+ }
+
+ public static implicit operator Int32(VOID_NumValue<T> v)
+ {
+ return v.ToInt32();
+ }
+
+
+ public static implicit operator Single(VOID_NumValue<T> v)
+ {
+ return v.ToSingle();
+ }
+
+
+ protected IFormatProvider formatProvider;
+
+ public VOID_NumValue(string Label, Func<T> ValueFunc, string Units = "") : base(Label, ValueFunc, Units)
+ {
+ this.formatProvider = System.Globalization.CultureInfo.CurrentUICulture;
+ }
+
+ public virtual double ToDouble(IFormatProvider provider)
+ {
+ return this.Value.ToDouble(provider);
+ }
+
+ public virtual double ToDouble()
+ {
+ return this.ToDouble(this.formatProvider);
+ }
+
+ public virtual int ToInt32(IFormatProvider provider)
+ {
+ return this.Value.ToInt32(provider);
+ }
+
+ public virtual int ToInt32()
+ {
+ return this.ToInt32(this.formatProvider);
+ }
+
+ public virtual float ToSingle(IFormatProvider provider)
+ {
+ return this.Value.ToSingle(provider);
+ }
+
+ public virtual float ToSingle()
+ {
+ return this.ToSingle(this.formatProvider);
+ }
+
+ public virtual string ToString(string Format)
+ {
+ return string.Format (
+ "{0}: {1}{2}",
+ this.Label,
+ this.Value.ToString(Format, this.formatProvider),
+ this.Units
+ );
+ }
+
+ public virtual string ToSIString(int digits = 3, int MinMagnitude = 0, int MaxMagnitude = int.MaxValue)
+ {
+ return string.Format (
+ "{0}{1}",
+ Tools.MuMech_ToSI (this, digits, MinMagnitude, MaxMagnitude),
+ this.Units
+ );
+ }
+
+ public virtual string ValueUnitString(string format)
+ {
+ return this.Value.ToString(format, this.formatProvider) + this.Units;
+ }
public virtual string ValueUnitString(int digits) {
- return Tools.MuMech_ToSI(this.ToDouble(), digits) + this.Units;
+ return Tools.MuMech_ToSI(this, digits) + this.Units;
}
public virtual string ValueUnitString(int digits, int MinMagnitude, int MaxMagnitude)
{
- return Tools.MuMech_ToSI(this.ToDouble(), digits, MinMagnitude, MaxMagnitude) + this.Units;
+ return Tools.MuMech_ToSI(this, digits, MinMagnitude, MaxMagnitude) + this.Units;
}
public virtual void DoGUIHorizontal(string format)
@@ -162,7 +238,7 @@
float magnitude;
float magLimit;
- magnitude = (float)Math.Log10(Math.Abs(this.ToDouble()));
+ magnitude = (float)Math.Log10(Math.Abs(this));
magLimit = Mathf.Max(magnitude, 6f);
magLimit = Mathf.Round((float)Math.Ceiling(magLimit / 3f) * 3f);
@@ -198,103 +274,20 @@
}
}
- public class VOID_DoubleValue : VOID_NumValue<double>, IVOID_NumericValue
+ public class VOID_DoubleValue : VOID_NumValue<double>
{
public VOID_DoubleValue(string Label, Func<double> ValueFunc, string Units) : base(Label, ValueFunc, Units) {}
-
- public override double ToDouble ()
- {
- return this.Value;
- }
-
- public override string ToString(string format)
- {
- return string.Format (
- "{0}: {1}{2}",
- this.Label,
- this.Value.ToString (format),
- this.Units
- );
- }
-
- public override string ValueUnitString(string format) {
- return this.Value.ToString(format) + this.Units;
- }
-
- public override string ToSIString(int digits = 3, int MinMagnitude = 0, int MaxMagnitude = int.MaxValue)
- {
- return string.Format (
- "{0}{1}",
- Tools.MuMech_ToSI (this.Value, digits, MinMagnitude, MaxMagnitude),
- this.Units
- );
- }
- }
- public class VOID_FloatValue : VOID_NumValue<float>, IVOID_NumericValue
+ }
+
+ public class VOID_FloatValue : VOID_NumValue<float>
{
public VOID_FloatValue(string Label, Func<float> ValueFunc, string Units) : base(Label, ValueFunc, Units) {}
-
- public override double ToDouble ()
- {
- return (double)this.Value;
- }
-
- public override string ValueUnitString(string format) {
- return this.Value.ToString(format) + this.Units;
- }
-
- public override string ToString(string format)
- {
- return string.Format (
- "{0}: {1}{2}",
- this.Label,
- this.Value.ToString (format),
- this.Units
- );
- }
-
- public override string ToSIString(int digits = 3, int MinMagnitude = 0, int MaxMagnitude = int.MaxValue)
- {
- return string.Format (
- "{0}{1}",
- Tools.MuMech_ToSI ((double)this.Value, digits, MinMagnitude, MaxMagnitude),
- this.Units
- );
- }
- }
- public class VOID_IntValue : VOID_NumValue<int>, IVOID_NumericValue
+ }
+
+ public class VOID_IntValue : VOID_NumValue<int>
{
public VOID_IntValue(string Label, Func<int> ValueFunc, string Units) : base(Label, ValueFunc, Units) {}
-
- public override double ToDouble ()
- {
- return (double)this.Value;
- }
-
- public override string ValueUnitString(string format) {
- return this.Value.ToString(format) + this.Units;
- }
-
- public override string ToString(string format)
- {
- return string.Format (
- "{0}: {1}{2}",
- this.Label,
- this.Value.ToString (format),
- this.Units
- );
- }
-
- public override string ToSIString(int digits = 3, int MinMagnitude = 0, int MaxMagnitude = int.MaxValue)
- {
- return string.Format (
- "{0}{1}",
- Tools.MuMech_ToSI ((double)this.Value, digits, MinMagnitude, MaxMagnitude),
- this.Units
- );
- }
- }
-
+ }
public class VOID_StrValue : VOID_DataValue<string>
{
--- a/VOID_EditorCore.cs
+++ b/VOID_EditorCore.cs
@@ -122,7 +122,7 @@
if (EditorLogic.SortedShipList.Count > 0)
{
- SimManager.Instance.Gravity = 9.08665;
+ SimManager.Instance.Gravity = VOID_Data.KerbinGee;
SimManager.Instance.TryStartSimulation();
}
--- a/VOID_HUD.cs
+++ b/VOID_HUD.cs
@@ -24,6 +24,7 @@
using UnityEngine;
using System;
using System.Collections.Generic;
+using System.Text;
namespace VOID
{
@@ -33,9 +34,20 @@
* Fields
* */
[AVOID_SaveValue("colorIndex")]
- protected VOID_SaveValue<int> _colorIndex = 0;
-
- protected List<Color> textColors = new List<Color>();
+ protected VOID_SaveValue<int> _colorIndex;
+
+ protected List<Color> textColors;
+
+ protected Rect leftHUDdefaultPos;
+ protected Rect rightHUDdefaultPos;
+
+ [AVOID_SaveValue("leftHUDPos")]
+ protected VOID_SaveValue<Rect> leftHUDPos;
+ [AVOID_SaveValue("rightHUDPos")]
+ protected VOID_SaveValue<Rect> rightHUDPos;
+
+ [AVOID_SaveValue("positionsLocked")]
+ protected VOID_SaveValue<bool> positionsLocked;
/*
* Properties
@@ -66,6 +78,10 @@
this._Name = "Heads-Up Display";
this._Active.value = true;
+
+ this._colorIndex = 0;
+
+ this.textColors = new List<Color>();
this.textColors.Add(Color.green);
this.textColors.Add(Color.black);
@@ -77,60 +93,224 @@
this.textColors.Add(Color.cyan);
this.textColors.Add(Color.magenta);
- VOID_Core.Instance.LabelStyles["hud"] = new GUIStyle();
- VOID_Core.Instance.LabelStyles["hud"].normal.textColor = this.textColors [this.ColorIndex];
+ this.leftHUDdefaultPos = new Rect(Screen.width * .375f - 300f, 0f, 300f, 90f);
+ this.leftHUDPos = new Rect(this.leftHUDdefaultPos);
+
+ this.rightHUDdefaultPos = new Rect(Screen.width * .625f, 0f, 300f, 90f);
+ this.rightHUDPos = new Rect(this.rightHUDdefaultPos);
+
+ this.positionsLocked = true;
Tools.PostDebugMessage ("VOID_HUD: Constructed.");
}
+ protected void leftHUDWindow(int id)
+ {
+ StringBuilder leftHUD;
+
+ leftHUD = new StringBuilder();
+
+ VOID_Core.Instance.LabelStyles["hud"].alignment = TextAnchor.UpperRight;
+
+ if (VOID_Core.Instance.powerAvailable)
+ {
+ leftHUD.AppendFormat("Primary: {0} Inc: {1}",
+ VOID_Data.primaryName.ValueUnitString(),
+ VOID_Data.orbitInclination.ValueUnitString("F3")
+ );
+ leftHUD.AppendFormat("\nObt Alt: {0} Obt Vel: {1}",
+ VOID_Data.orbitAltitude.ToSIString(),
+ VOID_Data.orbitVelocity.ToSIString()
+ );
+ leftHUD.AppendFormat("\nAp: {0} ETA {1}",
+ VOID_Data.orbitApoAlt.ToSIString(),
+ VOID_Data.timeToApo.ValueUnitString()
+ );
+ leftHUD.AppendFormat("\nPe: {0} ETA {1}",
+ VOID_Data.oribtPeriAlt.ToSIString(),
+ VOID_Data.timeToPeri.ValueUnitString()
+ );
+ leftHUD.AppendFormat("\nTot Δv: {0} Stg Δv: {1}",
+ VOID_Data.totalDeltaV.ToSIString(2),
+ VOID_Data.stageDeltaV.ToSIString(2)
+ );
+ }
+ else
+ {
+ VOID_Core.Instance.LabelStyles["hud"].normal.textColor = Color.red;
+ leftHUD.Append(string.Intern("-- POWER LOST --"));
+ }
+
+ GUILayout.Label(leftHUD.ToString(), VOID_Core.Instance.LabelStyles["hud"], GUILayout.ExpandWidth(true));
+
+ if (!this.positionsLocked)
+ {
+ GUI.DragWindow();
+ }
+
+ GUI.BringWindowToBack(id);
+ }
+
+ protected void rightHUDWindow(int id)
+ {
+ StringBuilder rightHUD;
+
+ rightHUD = new StringBuilder();
+
+ VOID_Core.Instance.LabelStyles["hud"].alignment = TextAnchor.UpperLeft;
+
+ if (VOID_Core.Instance.powerAvailable)
+ {
+ rightHUD.AppendFormat("Biome: {0} Sit: {1}",
+ VOID_Data.currBiome.ValueUnitString(),
+ VOID_Data.expSituation.ValueUnitString()
+ );
+ rightHUD.AppendFormat("\nSrf Alt: {0} Srf Vel: {1}",
+ VOID_Data.trueAltitude.ToSIString(),
+ VOID_Data.surfVelocity.ToSIString()
+ );
+ rightHUD.AppendFormat("\nVer: {0} Hor: {1}",
+ VOID_Data.vertVelocity.ToSIString(),
+ VOID_Data.horzVelocity.ToSIString()
+ );
+ rightHUD.AppendFormat("\nLat: {0} Lon: {1}",
+ VOID_Data.surfLatitude.ValueUnitString(),
+ VOID_Data.surfLongitude.ValueUnitString()
+ );
+ rightHUD.AppendFormat("\nHdg: {0} Pit: {1}",
+ VOID_Data.vesselHeading.ValueUnitString(),
+ VOID_Data.vesselPitch.ToSIString(2)
+ );
+ }
+ else
+ {
+ VOID_Core.Instance.LabelStyles["hud"].normal.textColor = Color.red;
+ rightHUD.Append(string.Intern("-- POWER LOST --"));
+ }
+
+
+ GUILayout.Label(rightHUD.ToString(), VOID_Core.Instance.LabelStyles["hud"], GUILayout.ExpandWidth(true));
+
+ if (!this.positionsLocked)
+ {
+ GUI.DragWindow();
+ }
+
+ GUI.BringWindowToBack(id);
+ }
+
public override void DrawGUI()
{
- GUI.skin = VOID_Core.Instance.Skin;
-
- if (VOID_Core.Instance.powerAvailable)
- {
- VOID_Core.Instance.LabelStyles["hud"].normal.textColor = textColors [ColorIndex];
-
- GUI.Label (
- new Rect ((Screen.width * .2083f), 0, 300f, 70f),
- "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") + "°" +
- "\nPrimary: " + vessel.mainBody.bodyName,
- VOID_Core.Instance.LabelStyles["hud"]);
- // 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 (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 +
- " Sit: " + vessel.GetExperimentSituation().HumanString(),
- VOID_Core.Instance.LabelStyles["hud"]);
- }
- else
- {
- VOID_Core.Instance.LabelStyles["hud"].normal.textColor = Color.red;
- GUI.Label (new Rect ((Screen.width * .2083f), 0, 300f, 70f), "-- POWER LOST --", VOID_Core.Instance.LabelStyles["hud"]);
- GUI.Label (new Rect ((Screen.width * .625f), 0, 300f, 70f), "-- POWER LOST --", VOID_Core.Instance.LabelStyles["hud"]);
- }
+ if (!VOID_Core.Instance.LabelStyles.ContainsKey("hud"))
+ {
+ VOID_Core.Instance.LabelStyles["hud"] = new GUIStyle(GUI.skin.label);
+ }
+
+ VOID_Core.Instance.LabelStyles["hud"].normal.textColor = textColors [ColorIndex];
+
+ this.leftHUDPos = GUI.Window(
+ VOID_Core.Instance.windowID,
+ this.leftHUDPos,
+ this.leftHUDWindow,
+ GUIContent.none,
+ GUIStyle.none
+ );
+
+ this.rightHUDPos = GUI.Window(
+ VOID_Core.Instance.windowID,
+ this.rightHUDPos,
+ this.rightHUDWindow,
+ GUIContent.none,
+ GUIStyle.none
+ );
}
public override void DrawConfigurables()
{
- if (GUILayout.Button ("Change HUD color", GUILayout.ExpandWidth (false)))
+ if (GUILayout.Button (string.Intern("Change HUD color"), GUILayout.ExpandWidth (false)))
{
++this.ColorIndex;
}
+
+ if (GUILayout.Button(string.Intern("Reset HUD Positions"), GUILayout.ExpandWidth(false)))
+ {
+ this.leftHUDPos = new Rect(this.leftHUDdefaultPos);
+ this.rightHUDPos = new Rect(this.rightHUDdefaultPos);
+ }
+
+ this.positionsLocked = GUILayout.Toggle(this.positionsLocked,
+ string.Intern("Lock HUD Positions"),
+ GUILayout.ExpandWidth(false));
+ }
+ }
+
+ public static partial class VOID_Data
+ {
+ public static VOID_StrValue expSituation = new VOID_StrValue(
+ "Situation",
+ new Func<string> (() => VOID_Core.Instance.vessel.GetExperimentSituation().HumanString())
+ );
+
+ public static VOID_DoubleValue vesselPitch = new VOID_DoubleValue(
+ "Pitch",
+ () => core.vessel.getSurfacePitch(),
+ "°"
+ );
+
+ public static VOID_DoubleValue stageMassFlow = new VOID_DoubleValue(
+ "Stage Mass Flow",
+ delegate()
+ {
+ if (simManager.LastStage == null)
+ {
+ return double.NaN;
+ }
+
+ double stageIsp = simManager.LastStage.isp;
+ double stageThrust = simManager.LastStage.actualThrust;
+
+ return stageThrust / (stageIsp * KerbinGee);
+ },
+ "Mg/s"
+ );
+
+ public static VOID_DoubleValue burnTimeCompleteAtNode = new VOID_DoubleValue(
+ "Full burn time to complete at node",
+ delegate()
+ {
+ if (simManager.LastStage == null)
+ {
+ return double.NaN;
+ }
+
+ double nextManeuverDV = core.vessel.patchedConicSolver.maneuverNodes[0].DeltaV.magnitude;
+ double stageThrust = simManager.LastStage.actualThrust;
+
+ return burnTime(nextManeuverDV, totalMass, stageMassFlow, stageThrust);
+ },
+ "s"
+ );
+
+ public static VOID_DoubleValue burnTimeHalfDoneAtNode = new VOID_DoubleValue(
+ "Full burn time to be half done at node",
+ delegate()
+ {
+ if (simManager.LastStage == null)
+ {
+ return double.NaN;
+ }
+
+ double nextManeuverDV = core.vessel.patchedConicSolver.maneuverNodes[0].DeltaV.magnitude / 2d;
+ double stageThrust = simManager.LastStage.actualThrust;
+
+ return burnTime(nextManeuverDV, totalMass, stageMassFlow, stageThrust);
+ },
+ "s"
+ );
+
+ private static double burnTime(double deltaV, double initialMass, double massFlow, double thrust)
+ {
+ return initialMass / massFlow * (Math.Exp(deltaV * massFlow / thrust) - 1d);
}
}
}
--- a/VOID_Module.cs
+++ b/VOID_Module.cs
@@ -199,39 +199,39 @@
public virtual void ModuleWindow(int _)
{
- if (VOID_Core.Instance.updateTimer - this.lastUpdate > VOID_Core.Instance.updatePeriod) {
- foreach (var fieldinfo in this.GetType().GetFields(
- BindingFlags.Instance |
- BindingFlags.NonPublic |
- BindingFlags.Public |
- BindingFlags.FlattenHierarchy
- ))
- {
- object field = null;
-
- try
- {
- field = fieldinfo.GetValue (this);
- }
- catch (NullReferenceException) {
- Tools.PostDebugMessage(string.Format(
- "{0}: caught NullReferenceException, could not get value for field {1}.",
- this.GetType().Name,
- fieldinfo.Name
- ));
- }
-
- if (field == null) {
- continue;
- }
-
- if (typeof(IVOID_DataValue).IsAssignableFrom (field.GetType ())) {
- (field as IVOID_DataValue).Refresh ();
- }
- }
-
- this.lastUpdate = VOID_Core.Instance.updateTimer;
- }
+// if (VOID_Core.Instance.updateTimer - this.lastUpdate > VOID_Core.Instance.updatePeriod) {
+// foreach (var fieldinfo in this.GetType().GetFields(
+// BindingFlags.Instance |
+// BindingFlags.NonPublic |
+// BindingFlags.Public |
+// BindingFlags.FlattenHierarchy
+// ))
+// {
+// object field = null;
+//
+// try
+// {
+// field = fieldinfo.GetValue (this);
+// }
+// catch (NullReferenceException) {
+// Tools.PostDebugMessage(string.Format(
+// "{0}: caught NullReferenceException, could not get value for field {1}.",
+// this.GetType().Name,
+// fieldinfo.Name
+// ));
+// }
+//
+// if (field == null) {
+// continue;
+// }
+//
+// if (typeof(IVOID_DataValue).IsAssignableFrom (field.GetType ())) {
+// (field as IVOID_DataValue).Refresh ();
+// }
+// }
+//
+// this.lastUpdate = VOID_Core.Instance.updateTimer;
+// }
}
public override void DrawGUI()
--- a/VOID_Orbital.cs
+++ b/VOID_Orbital.cs
@@ -33,197 +33,201 @@
protected long _precisionValues = 230584300921369395;
protected IntCollection precisionValues;
- protected VOID_StrValue primaryName = new VOID_StrValue (
+ public VOID_Orbital()
+ {
+ this._Name = "Orbital Information";
+
+ this.WindowPos.x = Screen.width - 520f;
+ this.WindowPos.y = 250f;
+ }
+
+ public override void ModuleWindow(int _)
+ {
+ base.ModuleWindow (_);
+
+ int idx = 0;
+
+ GUILayout.BeginVertical();
+
+ VOID_Data.primaryName.DoGUIHorizontal ();
+
+ this.precisionValues [idx]= (ushort)VOID_Data.orbitAltitude.DoGUIHorizontal (this.precisionValues [idx]);
+ idx++;
+
+ this.precisionValues [idx]= (ushort)VOID_Data.orbitVelocity.DoGUIHorizontal (this.precisionValues [idx]);
+ idx++;
+
+ this.precisionValues [idx]= (ushort)VOID_Data.orbitApoAlt.DoGUIHorizontal (this.precisionValues [idx]);
+ idx++;
+
+ VOID_Data.timeToApo.DoGUIHorizontal();
+
+ this.precisionValues [idx]= (ushort)VOID_Data.oribtPeriAlt.DoGUIHorizontal (this.precisionValues [idx]);
+ idx++;
+
+ VOID_Data.timeToPeri.DoGUIHorizontal();
+
+ VOID_Data.orbitInclination.DoGUIHorizontal("F3");
+
+ this.precisionValues [idx]= (ushort)VOID_Data.gravityAccel.DoGUIHorizontal (this.precisionValues [idx]);
+ idx++;
+
+ this.toggleExtended.value = GUILayout.Toggle(this.toggleExtended, "Extended info");
+
+ if (this.toggleExtended)
+ {
+ VOID_Data.orbitPeriod.DoGUIHorizontal();
+
+ this.precisionValues [idx]= (ushort)VOID_Data.semiMajorAxis.DoGUIHorizontal (this.precisionValues [idx]);
+ idx++;
+
+ VOID_Data.eccentricity.DoGUIHorizontal("F4");
+
+ VOID_Data.meanAnomaly.DoGUIHorizontal("F3");
+
+ VOID_Data.trueAnomaly.DoGUIHorizontal("F3");
+
+ VOID_Data.eccAnomaly.DoGUIHorizontal("F3");
+
+ VOID_Data.longitudeAscNode.DoGUIHorizontal("F3");
+
+ VOID_Data.argumentPeriapsis.DoGUIHorizontal("F3");
+
+ VOID_Data.localSiderealLongitude.DoGUIHorizontal("F3");
+ }
+
+ GUILayout.EndVertical();
+ GUI.DragWindow();
+ }
+
+ public override void LoadConfig ()
+ {
+ base.LoadConfig ();
+
+ this.precisionValues = new IntCollection (4, this._precisionValues);
+ }
+
+ public override void _SaveToConfig (KSP.IO.PluginConfiguration config)
+ {
+ this._precisionValues = this.precisionValues.collection;
+
+ base._SaveToConfig (config);
+ }
+ }
+
+
+ public static partial class VOID_Data
+ {
+ public static VOID_StrValue primaryName = new VOID_StrValue (
VOIDLabels.void_primary,
new Func<string> (() => VOID_Core.Instance.vessel.mainBody.name)
);
- protected VOID_DoubleValue orbitAltitude = new VOID_DoubleValue (
+ public static VOID_DoubleValue orbitAltitude = new VOID_DoubleValue (
"Altitude (ASL)",
new Func<double> (() => VOID_Core.Instance.vessel.orbit.altitude),
"m"
);
- protected VOID_DoubleValue orbitVelocity = new VOID_DoubleValue (
+ public static VOID_DoubleValue orbitVelocity = new VOID_DoubleValue (
VOIDLabels.void_velocity,
new Func<double> (() => VOID_Core.Instance.vessel.orbit.vel.magnitude),
"m/s"
);
- protected VOID_DoubleValue orbitApoAlt = new VOID_DoubleValue(
+ public static VOID_DoubleValue orbitApoAlt = new VOID_DoubleValue(
VOIDLabels.void_apoapsis,
new Func<double>(() => VOID_Core.Instance.vessel.orbit.ApA),
"m"
);
- protected VOID_DoubleValue oribtPeriAlt = new VOID_DoubleValue(
+ public static VOID_DoubleValue oribtPeriAlt = new VOID_DoubleValue(
VOIDLabels.void_periapsis,
new Func<double>(() => VOID_Core.Instance.vessel.orbit.PeA),
"m"
);
- protected VOID_StrValue timeToApo = new VOID_StrValue(
- "Time to Apoapsis",
+ public static VOID_StrValue timeToApo = new VOID_StrValue(
+ "Time to Apoapsis",
new Func<string>(() => Tools.ConvertInterval(VOID_Core.Instance.vessel.orbit.timeToAp))
);
- protected VOID_StrValue timeToPeri = new VOID_StrValue(
+ public static VOID_StrValue timeToPeri = new VOID_StrValue(
"Time to Periapsis",
new Func<string>(() => Tools.ConvertInterval(VOID_Core.Instance.vessel.orbit.timeToPe))
);
- protected VOID_DoubleValue orbitInclination = new VOID_DoubleValue(
+ public static VOID_DoubleValue orbitInclination = new VOID_DoubleValue(
"Inclination",
new Func<double>(() => VOID_Core.Instance.vessel.orbit.inclination),
"°"
);
- protected VOID_DoubleValue gravityAccel = new VOID_DoubleValue(
+ public static VOID_DoubleValue gravityAccel = new VOID_DoubleValue(
"Gravity",
delegate()
- {
- double orbitRadius = VOID_Core.Instance.vessel.mainBody.Radius +
+ {
+ double orbitRadius = VOID_Core.Instance.vessel.mainBody.Radius +
VOID_Core.Instance.vessel.mainBody.GetAltitude(VOID_Core.Instance.vessel.findWorldCenterOfMass());
- return (VOID_Core.Constant_G * VOID_Core.Instance.vessel.mainBody.Mass) /
+ return (VOID_Core.Constant_G * VOID_Core.Instance.vessel.mainBody.Mass) /
Math.Pow(orbitRadius, 2);
- },
+ },
"m/s²"
);
- protected VOID_StrValue orbitPeriod = new VOID_StrValue(
+ public static VOID_StrValue orbitPeriod = new VOID_StrValue(
"Period",
- new Func<string>(() => Tools.ConvertInterval(VOID_Core.Instance.vessel.orbit.period))
- );
-
- protected VOID_DoubleValue semiMajorAxis = new VOID_DoubleValue(
+ new Func<string>(() => Tools.ConvertInterval(VOID_Core.Instance.vessel.orbit.period))
+ );
+
+ public static VOID_DoubleValue semiMajorAxis = new VOID_DoubleValue(
"Semi-Major Axis",
new Func<double>(() => VOID_Core.Instance.vessel.orbit.semiMajorAxis),
"m"
);
- protected VOID_DoubleValue eccentricity = new VOID_DoubleValue(
+ public static VOID_DoubleValue eccentricity = new VOID_DoubleValue(
"Eccentricity",
new Func<double>(() => VOID_Core.Instance.vessel.orbit.eccentricity),
""
);
- protected VOID_DoubleValue meanAnomaly = new VOID_DoubleValue(
+ public static VOID_DoubleValue meanAnomaly = new VOID_DoubleValue(
"Mean Anomaly",
new Func<double>(() => VOID_Core.Instance.vessel.orbit.meanAnomaly * 180d / Math.PI),
"°"
);
- protected VOID_DoubleValue trueAnomaly = new VOID_DoubleValue(
+ public static VOID_DoubleValue trueAnomaly = new VOID_DoubleValue(
"True Anomaly",
new Func<double>(() => VOID_Core.Instance.vessel.orbit.trueAnomaly),
"°"
);
- protected VOID_DoubleValue eccAnomaly = new VOID_DoubleValue(
- "Eccentric Anomaly",
+ public static VOID_DoubleValue eccAnomaly = new VOID_DoubleValue(
+ "Eccentric Anomaly",
new Func<double>(() => VOID_Core.Instance.vessel.orbit.eccentricAnomaly * 180d / Math.PI),
"°"
);
- protected VOID_DoubleValue longitudeAscNode = new VOID_DoubleValue(
+ public static VOID_DoubleValue longitudeAscNode = new VOID_DoubleValue(
"Long. Ascending Node",
new Func<double>(() => VOID_Core.Instance.vessel.orbit.LAN),
"°"
);
- protected VOID_DoubleValue argumentPeriapsis = new VOID_DoubleValue(
+ public static VOID_DoubleValue argumentPeriapsis = new VOID_DoubleValue(
"Argument of Periapsis",
new Func<double>(() => VOID_Core.Instance.vessel.orbit.argumentOfPeriapsis),
"°"
- );
-
- protected VOID_DoubleValue localSiderealLongitude = new VOID_DoubleValue(
+ );
+
+ public static VOID_DoubleValue localSiderealLongitude = new VOID_DoubleValue(
"Local Sidereal Longitude",
new Func<double>(() => Tools.FixDegreeDomain(
VOID_Core.Instance.vessel.longitude + VOID_Core.Instance.vessel.orbit.referenceBody.rotationAngle)),
"°"
);
-
- public VOID_Orbital()
- {
- this._Name = "Orbital Information";
-
- this.WindowPos.x = Screen.width - 520f;
- this.WindowPos.y = 250f;
- }
-
- public override void ModuleWindow(int _)
- {
- base.ModuleWindow (_);
-
- int idx = 0;
-
- GUILayout.BeginVertical();
-
- this.primaryName.DoGUIHorizontal ();
-
- this.precisionValues [idx]= (ushort)this.orbitAltitude.DoGUIHorizontal (this.precisionValues [idx]);
- idx++;
-
- this.precisionValues [idx]= (ushort)this.orbitVelocity.DoGUIHorizontal (this.precisionValues [idx]);
- idx++;
-
- this.precisionValues [idx]= (ushort)this.orbitApoAlt.DoGUIHorizontal (this.precisionValues [idx]);
- idx++;
-
- this.timeToApo.DoGUIHorizontal();
-
- this.precisionValues [idx]= (ushort)this.oribtPeriAlt.DoGUIHorizontal (this.precisionValues [idx]);
- idx++;
-
- this.timeToPeri.DoGUIHorizontal();
-
- this.orbitInclination.DoGUIHorizontal("F3");
-
- this.precisionValues [idx]= (ushort)this.gravityAccel.DoGUIHorizontal (this.precisionValues [idx]);
- idx++;
-
- this.toggleExtended.value = GUILayout.Toggle(this.toggleExtended, "Extended info");
-
- if (this.toggleExtended)
- {
- this.orbitPeriod.DoGUIHorizontal();
-
- this.precisionValues [idx]= (ushort)this.semiMajorAxis.DoGUIHorizontal (this.precisionValues [idx]);
- idx++;
-
- this.eccentricity.DoGUIHorizontal("F4");
-
- this.meanAnomaly.DoGUIHorizontal("F3");
-
- this.trueAnomaly.DoGUIHorizontal("F3");
-
- this.eccAnomaly.DoGUIHorizontal("F3");
-
- this.longitudeAscNode.DoGUIHorizontal("F3");
-
- this.argumentPeriapsis.DoGUIHorizontal("F3");
-
- this.localSiderealLongitude.DoGUIHorizontal("F3");
- }
-
- GUILayout.EndVertical();
- GUI.DragWindow();
- }
-
- public override void LoadConfig ()
- {
- base.LoadConfig ();
-
- this.precisionValues = new IntCollection (4, this._precisionValues);
- }
-
- public override void _SaveToConfig (KSP.IO.PluginConfiguration config)
- {
- this._precisionValues = this.precisionValues.collection;
-
- base._SaveToConfig (config);
- }
}
}
--- a/VOID_SurfAtmo.cs
+++ b/VOID_SurfAtmo.cs
@@ -30,98 +30,6 @@
protected long _precisionValues = 230584300921369395;
protected IntCollection precisionValues;
- protected VOID_DoubleValue trueAltitude = new VOID_DoubleValue(
- "Altitude (true)",
- delegate()
- {
- double alt_true = VOID_Core.Instance.vessel.orbit.altitude - VOID_Core.Instance.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 (VOID_Core.Instance.vessel.terrainAltitude < 0 && VOID_Core.Instance.vessel.mainBody.ocean )
- alt_true = VOID_Core.Instance.vessel.orbit.altitude;
- return alt_true;
- },
- "m"
- );
-
- protected VOID_StrValue surfLatitude = new VOID_StrValue(
- "Latitude",
- new Func<string> (() => Tools.GetLatitudeString(VOID_Core.Instance.vessel))
- );
-
- protected VOID_StrValue surfLongitude = new VOID_StrValue(
- "Longitude",
- new Func<string> (() => Tools.GetLongitudeString(VOID_Core.Instance.vessel))
- );
-
- protected VOID_StrValue vesselHeading = new VOID_StrValue(
- "Heading",
- delegate()
- {
- double heading = Tools.MuMech_get_heading(VOID_Core.Instance.vessel);
- string cardinal = Tools.get_heading_text(heading);
-
- return string.Format(
- "{0}° {1}",
- heading.ToString("F2"),
- cardinal
- );
- }
- );
-
- protected VOID_DoubleValue terrainElevation = new VOID_DoubleValue(
- "Terrain elevation",
- new Func<double> (() => VOID_Core.Instance.vessel.terrainAltitude),
- "m"
- );
-
- protected VOID_DoubleValue surfVelocity = new VOID_DoubleValue(
- "Surface velocity",
- new Func<double> (() => VOID_Core.Instance.vessel.srf_velocity.magnitude),
- "m/s"
- );
-
- protected VOID_DoubleValue vertVelocity = new VOID_DoubleValue(
- "Vertical speed",
- new Func<double> (() => VOID_Core.Instance.vessel.verticalSpeed),
- "m/s"
- );
-
- protected VOID_DoubleValue horzVelocity = new VOID_DoubleValue(
- "Horizontal speed",
- new Func<double> (() => VOID_Core.Instance.vessel.horizontalSrfSpeed),
- "m/s"
- );
-
- protected VOID_FloatValue temperature = new VOID_FloatValue(
- "Temperature",
- new Func<float> (() => VOID_Core.Instance.vessel.flightIntegrator.getExternalTemperature()),
- "°C"
- );
-
- protected VOID_DoubleValue atmDensity = new VOID_DoubleValue (
- "Atmosphere Density",
- new Func<double> (() => VOID_Core.Instance.vessel.atmDensity * 1000f),
- "g/m³"
- );
-
- protected VOID_DoubleValue atmPressure = new VOID_DoubleValue (
- "Pressure",
- new Func<double> (() => VOID_Core.Instance.vessel.staticPressure),
- "atm"
- );
-
- protected VOID_FloatValue atmLimit = new VOID_FloatValue(
- "Atmosphere Limit",
- new Func<float> (() => VOID_Core.Instance.vessel.mainBody.maxAtmosphereAltitude),
- "m"
- );
-
- protected VOID_StrValue currBiome = new VOID_StrValue(
- "Biome",
- new Func<string> (() => Tools.Toadicus_GetAtt(VOID_Core.Instance.vessel).name)
- );
-
public VOID_SurfAtmo()
{
this._Name = "Surface & Atmospheric Information";
@@ -138,38 +46,38 @@
GUILayout.BeginVertical();
- this.precisionValues [idx]= (ushort)this.trueAltitude.DoGUIHorizontal (this.precisionValues [idx]);
+ this.precisionValues [idx]= (ushort)VOID_Data.trueAltitude.DoGUIHorizontal (this.precisionValues [idx]);
idx++;
- this.surfLatitude.DoGUIHorizontal ();
+ VOID_Data.surfLatitude.DoGUIHorizontal ();
- this.surfLongitude.DoGUIHorizontal ();
+ VOID_Data.surfLongitude.DoGUIHorizontal ();
- this.vesselHeading.DoGUIHorizontal ();
+ VOID_Data.vesselHeading.DoGUIHorizontal ();
- this.precisionValues [idx]= (ushort)this.terrainElevation.DoGUIHorizontal (this.precisionValues [idx]);
+ this.precisionValues [idx]= (ushort)VOID_Data.terrainElevation.DoGUIHorizontal (this.precisionValues [idx]);
idx++;
- this.precisionValues [idx]= (ushort)this.surfVelocity.DoGUIHorizontal (this.precisionValues [idx]);
+ this.precisionValues [idx]= (ushort)VOID_Data.surfVelocity.DoGUIHorizontal (this.precisionValues [idx]);
idx++;
- this.precisionValues [idx]= (ushort)this.vertVelocity.DoGUIHorizontal (this.precisionValues [idx]);
+ this.precisionValues [idx]= (ushort)VOID_Data.vertVelocity.DoGUIHorizontal (this.precisionValues [idx]);
idx++;
- this.precisionValues [idx]= (ushort)this.horzVelocity.DoGUIHorizontal (this.precisionValues [idx]);
+ this.precisionValues [idx]= (ushort)VOID_Data.horzVelocity.DoGUIHorizontal (this.precisionValues [idx]);
idx++;
- this.temperature.DoGUIHorizontal ("F2");
+ VOID_Data.temperature.DoGUIHorizontal ("F2");
- this.atmDensity.DoGUIHorizontal (3);
+ VOID_Data.atmDensity.DoGUIHorizontal (3);
- this.atmPressure.DoGUIHorizontal ("F2");
+ VOID_Data.atmPressure.DoGUIHorizontal ("F2");
- this.precisionValues [idx]= (ushort)this.atmLimit.DoGUIHorizontal (this.precisionValues [idx]);
+ this.precisionValues [idx]= (ushort)VOID_Data.atmLimit.DoGUIHorizontal (this.precisionValues [idx]);
idx++;
// Toadicus edit: added Biome
- this.currBiome.DoGUIHorizontal ();
+ VOID_Data.currBiome.DoGUIHorizontal ();
GUILayout.EndVertical();
GUI.DragWindow();
@@ -189,4 +97,100 @@
base._SaveToConfig (config);
}
}
+
+ public static partial class VOID_Data
+ {
+ public static VOID_DoubleValue trueAltitude = new VOID_DoubleValue(
+ "Altitude (true)",
+ delegate()
+ {
+ double alt_true = VOID_Core.Instance.vessel.orbit.altitude - VOID_Core.Instance.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 (VOID_Core.Instance.vessel.terrainAltitude < 0 && VOID_Core.Instance.vessel.mainBody.ocean )
+ alt_true = VOID_Core.Instance.vessel.orbit.altitude;
+ return alt_true;
+ },
+ "m"
+ );
+
+ public static VOID_StrValue surfLatitude = new VOID_StrValue(
+ "Latitude",
+ new Func<string> (() => Tools.GetLatitudeString(VOID_Core.Instance.vessel))
+ );
+
+ public static VOID_StrValue surfLongitude = new VOID_StrValue(
+ "Longitude",
+ new Func<string> (() => Tools.GetLongitudeString(VOID_Core.Instance.vessel))
+ );
+
+ public static VOID_StrValue vesselHeading = new VOID_StrValue(
+ "Heading",
+ delegate()
+ {
+ double heading = Tools.MuMech_get_heading(VOID_Core.Instance.vessel);
+ string cardinal = Tools.get_heading_text(heading);
+
+ return string.Format(
+ "{0}° {1}",
+ heading.ToString("F2"),
+ cardinal
+ );
+ }
+ );
+
+ public static VOID_DoubleValue terrainElevation = new VOID_DoubleValue(
+ "Terrain elevation",
+ new Func<double> (() => VOID_Core.Instance.vessel.terrainAltitude),
+ "m"
+ );
+
+ public static VOID_DoubleValue surfVelocity = new VOID_DoubleValue(
+ "Surface velocity",
+ new Func<double> (() => VOID_Core.Instance.vessel.srf_velocity.magnitude),
+ "m/s"
+ );
+
+ public static VOID_DoubleValue vertVelocity = new VOID_DoubleValue(
+ "Vertical speed",
+ new Func<double> (() => VOID_Core.Instance.vessel.verticalSpeed),
+ "m/s"
+ );
+
+ public static VOID_DoubleValue horzVelocity = new VOID_DoubleValue(
+ "Horizontal speed",
+ new Func<double> (() => VOID_Core.Instance.vessel.horizontalSrfSpeed),
+ "m/s"
+ );
+
+ public static VOID_FloatValue temperature = new VOID_FloatValue(
+ "Temperature",
+ new Func<float> (() => VOID_Core.Instance.vessel.flightIntegrator.getExternalTemperature()),
+ "°C"
+ );
+
+ public static VOID_DoubleValue atmDensity = new VOID_DoubleValue (
+ "Atmosphere Density",
+ new Func<double> (() => VOID_Core.Instance.vessel.atmDensity * 1000f),
+ "g/m³"
+ );
+
+ public static VOID_DoubleValue atmPressure = new VOID_DoubleValue (
+ "Pressure",
+ new Func<double> (() => VOID_Core.Instance.vessel.staticPressure),
+ "atm"
+ );
+
+ public static VOID_FloatValue atmLimit = new VOID_FloatValue(
+ "Atmosphere Limit",
+ new Func<float> (() => VOID_Core.Instance.vessel.mainBody.maxAtmosphereAltitude),
+ "m"
+ );
+
+ public static VOID_StrValue currBiome = new VOID_StrValue(
+ "Biome",
+ new Func<string> (() => Tools.Toadicus_GetAtt(VOID_Core.Instance.vessel).name)
+ );
+
+ }
}
--- a/VOID_Transfer.cs
+++ b/VOID_Transfer.cs
@@ -21,6 +21,7 @@
using KSP;
using System;
using System.Collections.Generic;
+using System.Linq;
using UnityEngine;
namespace VOID
--- a/VOID_VesselInfo.cs
+++ b/VOID_VesselInfo.cs
@@ -29,25 +29,105 @@
{
public class VOID_VesselInfo : VOID_WindowModule
{
- protected VOID_DoubleValue geeForce = new VOID_DoubleValue(
+ public VOID_VesselInfo() : base()
+ {
+ this._Name = "Vessel Information";
+
+ this.WindowPos.x = Screen.width - 260;
+ this.WindowPos.y = 450;
+ }
+
+ public override void ModuleWindow(int _)
+ {
+ base.ModuleWindow (_);
+
+ if ((TimeWarp.WarpMode == TimeWarp.Modes.LOW) || (TimeWarp.CurrentRate <= TimeWarp.MaxPhysicsRate))
+ {
+ SimManager.Instance.RequestSimulation();
+ }
+
+ GUILayout.BeginVertical();
+
+ GUILayout.Label(
+ vessel.vesselName,
+ VOID_Core.Instance.LabelStyles["center_bold"],
+ GUILayout.ExpandWidth(true));
+
+ Tools.PostDebugMessage("Starting VesselInfo window.");
+
+ VOID_Data.geeForce.DoGUIHorizontal ("F2");
+
+ Tools.PostDebugMessage("GeeForce done.");
+
+ VOID_Data.partCount.DoGUIHorizontal ();
+
+ Tools.PostDebugMessage("PartCount done.");
+
+ VOID_Data.totalMass.DoGUIHorizontal ("F1");
+
+ Tools.PostDebugMessage("TotalMass done.");
+
+ VOID_Data.resourceMass.DoGUIHorizontal ("F1");
+
+ Tools.PostDebugMessage("ResourceMass done.");
+
+ VOID_Data.stageDeltaV.DoGUIHorizontal (3, false);
+
+ Tools.PostDebugMessage("Stage deltaV done.");
+
+ VOID_Data.totalDeltaV.DoGUIHorizontal (3, false);
+
+ Tools.PostDebugMessage("Total deltaV done.");
+
+ VOID_Data.mainThrottle.DoGUIHorizontal ("F0");
+
+ Tools.PostDebugMessage("MainThrottle done.");
+
+ VOID_Data.currmaxThrust.DoGUIHorizontal ();
+
+ Tools.PostDebugMessage("CurrMaxThrust done.");
+
+ VOID_Data.currmaxThrustWeight.DoGUIHorizontal ();
+
+ Tools.PostDebugMessage("CurrMaxTWR done.");
+
+ VOID_Data.surfaceThrustWeight.DoGUIHorizontal ("F2");
+
+ Tools.PostDebugMessage("surfaceTWR done.");
+
+ VOID_Data.intakeAirStatus.DoGUIHorizontal();
+
+ Tools.PostDebugMessage("intakeAirStatus done.");
+
+ GUILayout.EndVertical();
+
+ Tools.PostDebugMessage("VesselInfo window done.");
+
+ GUI.DragWindow();
+ }
+ }
+
+ public static partial class VOID_Data
+ {
+ public static VOID_DoubleValue geeForce = new VOID_DoubleValue(
"G-force",
new Func<double>(() => VOID_Core.Instance.vessel.geeForce),
"gees"
);
- protected VOID_IntValue partCount = new VOID_IntValue(
+ public static VOID_IntValue partCount = new VOID_IntValue(
"Parts",
new Func<int>(() => VOID_Core.Instance.vessel.Parts.Count),
""
);
- protected VOID_DoubleValue totalMass = new VOID_DoubleValue(
+ public static VOID_DoubleValue totalMass = new VOID_DoubleValue(
"Total Mass",
- new Func<double>(() => VOID_Core.Instance.vessel.GetTotalMass()),
+ new Func<double> (() => SimManager.Instance.TryGetLastMass()),
"tons"
);
- protected VOID_DoubleValue resourceMass = new VOID_DoubleValue(
+ public static VOID_DoubleValue resourceMass = new VOID_DoubleValue(
"Resource Mass",
delegate()
{
@@ -61,20 +141,20 @@
"tons"
);
- protected VOID_DoubleValue stageDeltaV = new VOID_DoubleValue(
+ public static VOID_DoubleValue stageDeltaV = new VOID_DoubleValue(
"DeltaV (Current Stage)",
delegate()
{
if (SimManager.Instance.Stages == null ||
- SimManager.Instance.Stages.Length <= Staging.lastStage
- )
+ SimManager.Instance.Stages.Length <= Staging.lastStage
+ )
return double.NaN;
return SimManager.Instance.Stages[Staging.lastStage].deltaV;
},
"m/s"
);
- protected VOID_DoubleValue totalDeltaV = new VOID_DoubleValue(
+ public static VOID_DoubleValue totalDeltaV = new VOID_DoubleValue(
"DeltaV (Total)",
delegate()
{
@@ -85,13 +165,13 @@
"m/s"
);
- protected VOID_FloatValue mainThrottle = new VOID_FloatValue(
+ public static VOID_FloatValue mainThrottle = new VOID_FloatValue(
"Throttle",
new Func<float>(() => VOID_Core.Instance.vessel.ctrlState.mainThrottle * 100f),
"%"
);
- protected VOID_StrValue currmaxThrust = new VOID_StrValue(
+ public static VOID_StrValue currmaxThrust = new VOID_StrValue(
"Thrust (curr/max)",
delegate()
{
@@ -109,7 +189,7 @@
}
);
- protected VOID_StrValue currmaxThrustWeight = new VOID_StrValue(
+ public static VOID_StrValue currmaxThrustWeight = new VOID_StrValue(
"T:W (curr/max)",
delegate()
{
@@ -118,12 +198,12 @@
double currThrust = SimManager.Instance.LastStage.actualThrust;
double maxThrust = SimManager.Instance.LastStage.thrust;
- double mass = VOID_Core.Instance.vessel.GetTotalMass();
+ double mass = SimManager.Instance.TryGetLastMass();
double gravity = VOID_Core.Instance.vessel.mainBody.gravParameter /
- Math.Pow(
- VOID_Core.Instance.vessel.mainBody.Radius + VOID_Core.Instance.vessel.altitude,
- 2
- );
+ Math.Pow(
+ VOID_Core.Instance.vessel.mainBody.Radius + VOID_Core.Instance.vessel.altitude,
+ 2
+ );
double weight = mass * gravity;
return string.Format(
@@ -134,7 +214,7 @@
}
);
- protected VOID_DoubleValue surfaceThrustWeight = new VOID_DoubleValue(
+ public static VOID_DoubleValue surfaceThrustWeight = new VOID_DoubleValue(
"Max T:W @ surface",
delegate()
{
@@ -142,9 +222,9 @@
return double.NaN;
double maxThrust = SimManager.Instance.LastStage.thrust;
- double mass = VOID_Core.Instance.vessel.GetTotalMass();
+ double mass = SimManager.Instance.TryGetLastMass();
double gravity = (VOID_Core.Constant_G * VOID_Core.Instance.vessel.mainBody.Mass) /
- Math.Pow(VOID_Core.Instance.vessel.mainBody.Radius, 2);
+ Math.Pow(VOID_Core.Instance.vessel.mainBody.Radius, 2);
double weight = mass * gravity;
return maxThrust / weight;
@@ -152,7 +232,7 @@
""
);
- protected VOID_StrValue intakeAirStatus = new VOID_StrValue(
+ public static VOID_StrValue intakeAirStatus = new VOID_StrValue(
"Intake Air (Curr / Req)",
delegate()
{
@@ -196,59 +276,6 @@
return string.Format("{0:F3} / {1:F3}", currentAmount, currentRequirement);
}
);
-
- public VOID_VesselInfo() : base()
- {
- this._Name = "Vessel Information";
-
- this.WindowPos.x = Screen.width - 260;
- this.WindowPos.y = 450;
- }
-
- public override void ModuleWindow(int _)
- {
- base.ModuleWindow (_);
-
- if ((TimeWarp.WarpMode == TimeWarp.Modes.LOW) || (TimeWarp.CurrentRate <= TimeWarp.MaxPhysicsRate))
- {
- SimManager.Instance.RequestSimulation();
- }
-
- Stage[] stages = SimManager.Instance.Stages;
-
- GUILayout.BeginVertical();
-
- GUILayout.Label(
- vessel.vesselName,
- VOID_Core.Instance.LabelStyles["center_bold"],
- GUILayout.ExpandWidth(true));
-
- this.geeForce.DoGUIHorizontal ("F2");
-
- this.partCount.DoGUIHorizontal ();
-
- this.totalMass.DoGUIHorizontal ("F1");
-
- this.resourceMass.DoGUIHorizontal ("F1");
-
- this.stageDeltaV.DoGUIHorizontal (3, false);
-
- this.totalDeltaV.DoGUIHorizontal (3, false);
-
- this.mainThrottle.DoGUIHorizontal ("F0");
-
- this.currmaxThrust.DoGUIHorizontal ();
-
- this.currmaxThrustWeight.DoGUIHorizontal ();
-
- this.surfaceThrustWeight.DoGUIHorizontal ("F2");
-
- this.intakeAirStatus.DoGUIHorizontal();
-
- GUILayout.EndVertical();
- GUI.DragWindow();
- }
}
}
-