AntennaRelay, ModuleLimitedDataTransmitter: Integrated getLineOfSight methods to detect when LOS is almost lost. ARdev-LOS
AntennaRelay, ModuleLimitedDataTransmitter: Integrated getLineOfSight methods to detect when LOS is almost lost.

--- a/AntennaRange.cfg
+++ b/AntennaRange.cfg
@@ -46,6 +46,16 @@
 		maxPowerFactor = 8
 		maxDataFactor = 4
 	}
+
+	MODULE
+	{
+		name = ModuleScienceContainer
+
+		dataIsCollectable = true
+		dataIsStorable = false
+
+		storageRange = 2
+	}
 }
 
 @PART[mediumDishAntenna]:FOR[AntennaRange]:NEEDS[!RemoteTech2]
@@ -56,6 +66,16 @@
 		nominalRange = 30000000
 		maxPowerFactor = 8
 		maxDataFactor = 4
+	}
+
+	MODULE
+	{
+		name = ModuleScienceContainer
+
+		dataIsCollectable = true
+		dataIsStorable = false
+
+		storageRange = 2
 	}
 }
 
@@ -68,5 +88,15 @@
 		maxPowerFactor = 8
 		maxDataFactor = 4
 	}
+
+	MODULE
+	{
+		name = ModuleScienceContainer
+
+		dataIsCollectable = true
+		dataIsStorable = false
+
+		storageRange = 2
+	}
 }
 

--- a/AntennaRelay.cs
+++ b/AntennaRelay.cs
@@ -97,6 +97,15 @@
 		}
 
 		/// <summary>
+		/// Gets the <see cref="ToadicusTools.LineOfSightStatus"/> of this relay.
+		/// </summary>
+		public LineOfSightStatus losStatus
+		{
+			get;
+			protected set;
+		}
+
+		/// <summary>
 		/// Gets the transmit distance.
 		/// </summary>
 		/// <value>The transmit distance.</value>
@@ -151,12 +160,13 @@
 				this.transmitDistance > this.maxTransmitDistance ||
 				(
 					requireLineOfSight &&
-					this.nearestRelay == null &&
-					!this.vessel.hasLineOfSightTo(this.Kerbin, out this._firstOccludingBody, radiusRatio)
+					this.nearestRelay == null
 				)
 			)
 			{
-				return false;
+				this.losStatus = this.vessel.getLineOfSightTo(this.Kerbin, out this._firstOccludingBody, radiusRatio);
+
+				return this.losStatus != LineOfSightStatus.Blocked;
 			}
 			else
 			{
@@ -232,15 +242,19 @@
 				}
 
 				// Skip vessels to which we do not have line of sight.
-				if (requireLineOfSight &&
-					!this.vessel.hasLineOfSightTo(potentialVessel, out this._firstOccludingBody, radiusRatio))
-				{
-					Tools.PostDebugMessage(
-						this,
-						"Vessel {0} discarded because we do not have line of sight.",
-						potentialVessel.vesselName
-					);
-					continue;
+				if (requireLineOfSight)
+				{
+					this.losStatus = this.vessel.getLineOfSightTo(potentialVessel, out this._firstOccludingBody, radiusRatio);
+
+					if (this.losStatus == LineOfSightStatus.Blocked)
+					{
+						Tools.PostDebugMessage(
+							this,
+							"Vessel {0} discarded because we do not have line of sight.",
+							potentialVessel.vesselName
+						);
+						continue;
+					}
 				}
 
 				// Find the distance from here to the vessel...
@@ -305,6 +319,8 @@
 			// HACK: This might not be safe in all circumstances, but since AntennaRelays are not built until Start,
 			// we hope it is safe enough.
 			this.Kerbin = FlightGlobals.Bodies.FirstOrDefault(b => b.name == "Kerbin");
+
+			this.losStatus = LineOfSightStatus.Clear;
 		}
 
 		static AntennaRelay()

--- a/ModuleLimitedDataTransmitter.cs
+++ b/ModuleLimitedDataTransmitter.cs
@@ -522,7 +522,7 @@
 			{
 				if (this.CanTransmit())
 				{
-					this.UIrelayStatus = string.Intern("Connected");
+					this.UIrelayStatus = string.Format("Connected via {0}", this.relay);
 					this.UItransmitDistance = Tools.MuMech_ToSI(this.transmitDistance) + "m";
 					this.UIpacketSize = Tools.MuMech_ToSI(this.DataRate) + "MiT";
 					this.UIpacketCost = Tools.MuMech_ToSI(this.DataResourceCost) + "E";
@@ -535,7 +535,16 @@
 					}
 					else
 					{
-						this.UIrelayStatus = string.Format("Blocked by {0}", this.relay.firstOccludingBody.bodyName);
+						if (this.relay.losStatus == LineOfSightStatus.Blocked)
+						{
+							this.UIrelayStatus =
+								string.Format("Blocked by {0}", this.relay.firstOccludingBody.bodyName);
+						}
+						else if (this.relay.losStatus == LineOfSightStatus.Marginal)
+						{
+							this.UIrelayStatus =
+								string.Format("Almost blocked by {0}", this.relay.firstOccludingBody.bodyName);
+						}
 					}
 					this.UImaxTransmitDistance = "N/A";
 					this.UIpacketSize = "N/A";

--- 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.3.*")]
+[assembly: AssemblyVersion("1.5.*")]
 // 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)]