New module that 'fixes' the AltitudeRecords progress system to count progress made with unmanned vessels.
New module that 'fixes' the AltitudeRecords progress system to count progress made with unmanned vessels.

--- /dev/null
+++ b/NSSAltitudeRecordFixer.cs
@@ -1,1 +1,107 @@
+// NSScientific
+// by toadicus, dudecon
+//
+// NSSAltitudeRecordFixer.cs
+//
+// This work is released into the Public Domain.
+//
 
+using KSP;
+using KSPAchievements;
+using System;
+using System.Reflection;
+using ToadicusTools;
+using UnityEngine;
+
+namespace NSScientific
+{
+	[KSPAddon(KSPAddon.Startup.EveryScene, false)]
+	public class NSSAltitudeRecordFixer : MonoBehaviour
+	{
+		private static FieldInfo AltRecordsVesselField;
+		private static FieldInfo ProgressNodeAchieveDateField;
+
+		private bool runOnce;
+
+		public void Awake()
+		{
+			this.runOnce = true;
+		}
+
+		public void Update()
+		{
+			if (runOnce && ProgressTracking.Instance != null)
+			{
+				RecordsAltitude altRecords = ProgressTracking.Instance.altitudeRecords;
+
+				this.LogDebug("Got altRecords ({0}).", altRecords);
+
+				foreach (var field in typeof(RecordsAltitude).GetFields(
+					BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance))
+				{
+					if (field.FieldType == typeof(Vessel))
+					{
+						AltRecordsVesselField = field;
+						this.LogDebug("Found RecordsAltitude Vessel field ({0}).", AltRecordsVesselField);
+						break;
+					}
+				}
+
+				ProgressNodeAchieveDateField = typeof(ProgressNode)
+					.GetField("AchieveDate", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
+
+				this.LogDebug("Found ProgressNode AchieveDate field ({0}).", ProgressNodeAchieveDateField);
+
+				altRecords.OnIterateVessels = AltRecordsOnIterateVessels;
+
+				this.LogDebug("RecordsAltitude OnIterateVessels clobbered ({0}).", altRecords.OnIterateVessels);
+
+				this.runOnce = false;
+			}
+		}
+
+		public static void AltRecordsOnIterateVessels(Vessel vessel)
+		{
+			vessel.LogDebug("NSSAltitudeRecordFixer.AltRecordsOnIterateVessels called.");
+
+			RecordsAltitude altRecords = ProgressTracking.Instance.altitudeRecords;
+
+			if (vessel != FlightGlobals.ActiveVessel)
+			{
+				return;
+			}
+
+			vessel.LogDebug("NSSAltitudeRecordFixer.AltRecordsOnIterateVessels: vessel is current vessel, continuing.");
+
+			if (vessel.mainBody == Planetarium.fetch.Home)
+			{
+				vessel.LogDebug("NSSAltitudeRecordFixer.AltRecordsOnIterateVessels: vessel is at Kerbin, continuing.");
+				if (vessel.altitude > altRecords.record)
+				{
+					vessel.LogDebug("NSSAltitudeRecordFixer.AltRecordsOnIterateVessels: set new record.");
+
+					altRecords.record = vessel.altitude;
+
+					Vessel altRecordsVessel = AltRecordsVesselField.GetValue(altRecords) as Vessel;
+
+					if (altRecordsVessel != vessel)
+					{
+						vessel.LogDebug("NSSAltitudeRecordFixer.AltRecordsOnIterateVessels: record is new vessel.");
+						altRecords.Reach();
+						AltRecordsVesselField.SetValue(altRecords, vessel);
+					}
+					else
+					{
+						vessel.LogDebug("NSSAltitudeRecordFixer.AltRecordsOnIterateVessels: record is not new vessel.");
+						ProgressNodeAchieveDateField.SetValue(altRecords, Planetarium.GetUniversalTime());
+						altRecords.Achieve();
+					}
+				}
+			}
+
+			vessel.LogDebug("NSSAltitudeRecordFixer.AltRecordsOnIterateVessels: recorded new record!");
+		}
+	}
+}
+
+

--- a/NSScientific.csproj
+++ b/NSScientific.csproj
@@ -94,6 +94,7 @@
       <Link>Tools.cs</Link>
     </Compile>
     <Compile Include="ModuleKerbalMassTracker.cs" />
+    <Compile Include="NSSAltitudeRecordFixer.cs" />
   </ItemGroup>
   <ProjectExtensions>
     <MonoDevelop>