ModuleLimitedDataTransmitter: Preliminary work for stashing data passed from experiments when transmission is impossible.
ModuleLimitedDataTransmitter: Preliminary work for stashing data passed from experiments when transmission is impossible.

--- a/ARFlightController.cs
+++ b/ARFlightController.cs
@@ -160,31 +160,44 @@
 
 			Tools.DebugLogger log = Tools.DebugLogger.New(this);
 
+			VesselCommand availableCommand;
+
+			if (requireConnectionForControl)
+			{
+				availableCommand = this.vessel.CurrentCommand();
+			}
+			else
+			{
+				availableCommand = VesselCommand.Crew;
+			}
+
+			log.AppendFormat("availableCommand: {0}\n\t" +
+				"(availableCommand & VesselCommand.Crew) == VesselCommand.Crew: {1}\n\t" +
+				"(availableCommand & VesselCommand.Probe) == VesselCommand.Probe: {2}\n\t" +
+				"vessel.HasConnectedRelay(): {3}",
+				(int)availableCommand,
+				(availableCommand & VesselCommand.Crew) == VesselCommand.Crew,
+				(availableCommand & VesselCommand.Probe) == VesselCommand.Probe,
+				vessel.HasConnectedRelay()
+			);
+
 			// If we are requiring a connection for control, the vessel does not have any adequately staffed pods,
 			// and the vessel does not have any connected relays...
 			if (
 				HighLogic.LoadedSceneIsFlight &&
 				requireConnectionForControl &&
 				this.vessel != null &&
-				this.vessel.vesselType != VesselType.EVA
-			)
-			{
-				VesselCommand availableCommand = this.vessel.CurrentCommand();
-
-				Tools.PostDebugMessage(this, "availableCommand: {0}", (int)availableCommand);
-
-				if (
-					!(
-						(availableCommand & VesselCommand.Crew) == VesselCommand.Crew ||
-						(availableCommand & VesselCommand.Probe) == VesselCommand.Probe && vessel.HasConnectedRelay()
-					)
-				)
-				{// ...and if the controls are not currently locked...
-					if (currentControlLock == ControlTypes.None)
-					{
-						// ...lock the controls.
-						InputLockManager.SetControlLock(this.lockSet, this.lockID);
-					}
+				this.vessel.vesselType != VesselType.EVA &&
+				!(
+				    (availableCommand & VesselCommand.Crew) == VesselCommand.Crew ||
+				    (availableCommand & VesselCommand.Probe) == VesselCommand.Probe && vessel.HasConnectedRelay()
+				))
+			{
+				// ...and if the controls are not currently locked...
+				if (currentControlLock == ControlTypes.None)
+				{
+					// ...lock the controls.
+					InputLockManager.SetControlLock(this.lockSet, this.lockID);
 				}
 			}
 			// ...otherwise, if the controls are locked...

--- a/ModuleLimitedDataTransmitter.cs
+++ b/ModuleLimitedDataTransmitter.cs
@@ -394,6 +394,44 @@
 			}
 			else
 			{
+				foreach (ModuleScienceContainer	scienceContainer in this.vessel.getModulesOfType<ModuleScienceContainer>())
+				{
+					if (scienceContainer.GetScienceCount() >= scienceContainer.capacity)
+					{
+						continue;
+					}
+
+					foreach (ScienceData data in dataQueue)
+					{
+						if (scienceContainer.HasData(data))
+						{
+							break;
+						}
+
+						if (scienceContainer.AddData(data))
+						{
+							dataQueue.Remove(data);
+						}
+					}
+				}
+
+				if (dataQueue.Count > 0)
+				{
+					StringBuilder msg = new StringBuilder();
+
+					msg.Append('[');
+					msg.Append(this.part.partInfo.title);
+					msg.AppendFormat("]: {0} data items could not be saved: no space available in data containers.\n");
+					msg.Append("Data to be discarded:\n");
+
+					foreach (ScienceData data in dataQueue)
+					{
+						msg.AppendFormat("\n{0}\n", data.title);
+					}
+
+					ScreenMessages.PostScreenMessage(msg.ToString(), 4f, ScreenMessageStyle.UPPER_LEFT);
+				}
+
 				this.PostCannotTransmitError ();
 			}
 

--- a/Properties/AssemblyInfo.cs
+++ b/Properties/AssemblyInfo.cs
@@ -39,7 +39,7 @@
 // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
 // The form "{Major}.{Minor}.*" will automatically update the build and revision,
 // and "{Major}.{Minor}.{Build}.*" will update just the revision.
-[assembly: AssemblyVersion("1.4.2.*")]
+[assembly: AssemblyVersion("1.4.3.*")]
 // The following attributes are used to specify the signing key for the assembly,
 // if desired. See the Mono documentation for more information about signing.
 //[assembly: AssemblyDelaySign(false)]