diff --git a/MechJeb2/MechJebModuleHoverslamSimulation.cs b/MechJeb2/MechJebModuleHoverslamSimulation.cs index 83f8a4b53..2190908eb 100644 --- a/MechJeb2/MechJebModuleHoverslamSimulation.cs +++ b/MechJeb2/MechJebModuleHoverslamSimulation.cs @@ -57,8 +57,7 @@ public string Touchdown() => // TODO: This counts down even if you don't ignite and i'm not entirely certain what to do about it // TODO: this doesn't account for planned vertical descent deltaV [ValueInfoItem("#MechJeb_HoverslamDeltaV", InfoItem.Category.Hoverslam, tooltip = "#MechJeb_HoverslamDeltaV_tooltip")] //Hoverslam Δv - public string HoverslamDeltaV() => - IsFinite(LandingUT) ? DeltaV(LandingCountdown - (IgnitionUT < VesselState.time ? 0 : IgnitionCountdown)).ToSI() + "m/s" : "N/A"; + public string HoverslamDeltaV() => IsFinite(DeltaV) ? DeltaV.ToSI() + "m/s" : "N/A"; [ValueInfoItem("#MechJeb_HoverslamCoordinates", InfoItem.Category.Hoverslam, width = 90, tooltip = "#MechJeb_HoverslamCoordinates_tooltip")] //Coordinates public string HoverslamCoordinates() => Coordinates.ToStringDMS(Lat, Lng, true); @@ -111,6 +110,7 @@ public string HoverslamDeltaV() => public double Lng; public double IgnitionCountdown => IgnitionUT - VesselState.time; public double LandingCountdown => LandingUT - VesselState.time; + public double DeltaV; public double FinalDescentSpeed; // should be positive public Vector3d IgnitionAttitude; // ReSharper restore MemberCanBePrivate.Global @@ -150,6 +150,7 @@ private void Reset() LandingPosition = new Vector3d(double.NaN, double.NaN, double.NaN); IgnitionUT = double.NaN; LandingUT = double.NaN; + DeltaV = double.NaN; IgnitionAttitude = new Vector3d(double.NaN, double.NaN, double.NaN); Lat = 0; Lng = 0; @@ -158,7 +159,7 @@ private void Reset() _lastCycleUT = 0; } - private double DeltaV(double burnTime) + private double CalculateDeltaV(double burnTime) { Core.StageStats.RequestUpdate(); @@ -224,6 +225,7 @@ public override void OnFixedUpdate() MainBody.GetLatLngAltAtUT(LandingUT, LandingPosition, out Lat, out Lng, out _); TerrainAltitude = MainBody.TerrainAltitude(Lat, Lng, true); Slope = MainBody.GetPQSSlopeDegrees(Lat, Lng); + DeltaV = CalculateDeltaV(LandingCountdown - (IgnitionUT < VesselState.time ? 0 : IgnitionCountdown)); } if (_hoverslam.IsFaulted && _hoverslam.ExceptionMessage != null) diff --git a/MechJebKos/HoverslamSimulationBinding.cs b/MechJebKos/HoverslamSimulationBinding.cs index 206990702..1b76efb8d 100644 --- a/MechJebKos/HoverslamSimulationBinding.cs +++ b/MechJebKos/HoverslamSimulationBinding.cs @@ -37,6 +37,8 @@ protected override void InitializeSuffixes() "Predicted landing latitude in degrees.")); AddSuffix("LONGITUDE", new Suffix(() => Module.Lng, "Predicted landing longitude in degrees.")); + AddSuffix("BIOME", new Suffix(() => Module.Biome(), + "Biome name at the predicted landing site (\"N/A\" if no solution).")); AddSuffix("TERRAINALTITUDE", new Suffix(() => Module.TerrainAltitude, "Terrain altitude at the predicted landing site in meters.")); AddSuffix("SLOPE", new Suffix(() => Module.Slope, @@ -45,6 +47,8 @@ protected override void InitializeSuffixes() "Planned final descent speed in m/s.")); AddSuffix("FINALTHRUSTACCEL", new Suffix(() => Module.FinalThrustAccel, "Final thrust acceleration in m/s^2 (-1 if no solution).")); + AddSuffix("DELTAV", new Suffix(() => Module.DeltaV, + "Estimated hoverslam delta-v in m/s (NaN if no solution).")); AddSuffix("MAPLANDINGPREDICTION", new SetSuffix(() => Module.MapLandingPrediction, value => Module.MapLandingPrediction = value, "Draw the predicted landing site marker on the map."));