ToolbarButtonWrapper: Added EffectivelyVisible.
VesselInfo: Added IntakeAir status indication.
--- a/ToolbarButtonWrapper.cs
+++ b/ToolbarButtonWrapper.cs
@@ -131,6 +131,7 @@
protected PropertyInfo ButtonToolTip;
protected PropertyInfo ButtonVisible;
protected PropertyInfo ButtonVisibility;
+ protected PropertyInfo ButtonEffectivelyVisible;
protected PropertyInfo ButtonEnalbed;
protected PropertyInfo ButtonImportant;
protected EventInfo ButtonOnClick;
@@ -243,6 +244,22 @@
}
/// <summary>
+ /// Whether this button is currently effectively visible or not. This is a combination of
+ /// <see cref="Visible"/> and <see cref="Visibility"/>.
+ /// </summary>
+ /// <remarks>
+ /// Note that the toolbar is not visible in certain game scenes, for example the loading screens. This property
+ /// does not reflect button invisibility in those scenes.
+ /// </remarks>
+ public bool EffectivelyVisible
+ {
+ get
+ {
+ return (bool)this.ButtonEffectivelyVisible.GetValue(this.Button, null);
+ }
+ }
+
+ /// <summary>
/// Whether this button is currently enabled (clickable) or not. This will not affect the player's ability to
/// position the button on their screen.
/// </summary>
@@ -348,6 +365,13 @@
));
this.ButtonVisibility = this.IButton.GetProperty("Visibility");
+
+ Tools.PostDebugMessage(string.Format(
+ "{0}: Got 'Visibility' property. Getting 'EffectivelyVisible' property.",
+ this.GetType().Name
+ ));
+
+ this.ButtonEffectivelyVisible = this.IButton.GetProperty("EffectivelyVisible");
Tools.PostDebugMessage(string.Format(
"{0}: Got 'Visibility' property. Getting 'Enabled' property.",
--- a/VOID_VesselInfo.cs
+++ b/VOID_VesselInfo.cs
@@ -23,6 +23,7 @@
using System.Collections.Generic;
using UnityEngine;
using Engineer.VesselSimulator;
+using Engineer.Extensions;
namespace VOID
{
@@ -151,6 +152,51 @@
""
);
+ protected VOID_StrValue intakeAirStatus = new VOID_StrValue(
+ "Intake Air (Curr / Req)",
+ delegate()
+ {
+ double currentAmount;
+ double currentRequirement;
+
+ currentAmount = 0d;
+ currentRequirement = 0d;
+
+ foreach (Part part in VOID_Core.Instance.vessel.Parts)
+ {
+ if (part.HasModule<ModuleEngines>() && part.enabled)
+ {
+ foreach (Propellant propellant in part.GetModule<ModuleEngines>().propellants)
+ {
+ if (propellant.name == "IntakeAir")
+ {
+ // currentAmount += propellant.currentAmount;
+ currentRequirement += propellant.currentRequirement / TimeWarp.fixedDeltaTime;
+ break;
+ }
+ }
+ }
+
+ if (part.HasModule<ModuleResourceIntake>() && part.enabled)
+ {
+ ModuleResourceIntake intakeModule = part.GetModule<ModuleResourceIntake>();
+
+ if (intakeModule.resourceName == "IntakeAir")
+ {
+ currentAmount += intakeModule.airFlow;
+ }
+ }
+ }
+
+ if (currentAmount == 0 && currentRequirement == 0)
+ {
+ return "N/A";
+ }
+
+ return string.Format("{0:F3} / {1:F3}", currentAmount, currentRequirement);
+ }
+ );
+
public VOID_VesselInfo() : base()
{
this._Name = "Vessel Information";
@@ -196,6 +242,8 @@
this.currmaxThrustWeight.DoGUIHorizontal ();
this.surfaceThrustWeight.DoGUIHorizontal ("F2");
+
+ this.intakeAirStatus.DoGUIHorizontal();
GUILayout.EndVertical();
GUI.DragWindow();