AntennaRange.cfg: Added EVA_MODULE and EVA_RESOURCE definitions for EVA Kerbal transmitters and electric charge, with an MM patch to avoid duplicating ElectricCharge when TACLS is installed.
AntennaRange.cfg: Added EVA_MODULE and EVA_RESOURCE definitions for EVA Kerbal transmitters and electric charge, with an MM patch to avoid duplicating ElectricCharge when TACLS is installed.

--- a/AntennaRange.cfg
+++ b/AntennaRange.cfg
@@ -100,3 +100,30 @@
 	}
 }
 
+EVA_MODULE
+{
+	name = ModuleLimitedDataTransmitter
+
+	nominalRange = 5000
+	maxPowerFactor = 8
+	maxDataFactor = 4
+
+	packetInterval = 0.5
+	packetSize = 2
+	packetResourceCost = .1
+
+	requiredResource = ElectricCharge
+}
+
+EVA_RESOURCE
+{
+	name = ElectricCharge
+	amount = 100
+	maxAmount = 100
+}
+
+@EVA_RESOURCE[ElectricCharge]:AFTER[AntennaRange]:NEEDS[TacLifeSupport]
+{
+	!name = DELETE
+}
+

--- a/AntennaRelay.cs
+++ b/AntennaRelay.cs
@@ -97,15 +97,6 @@
 		}
 
 		/// <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>
@@ -160,13 +151,12 @@
 				this.transmitDistance > this.maxTransmitDistance ||
 				(
 					requireLineOfSight &&
-					this.nearestRelay == null
+					this.nearestRelay == null &&
+					!this.vessel.hasLineOfSightTo(this.Kerbin, out this._firstOccludingBody, radiusRatio)
 				)
 			)
 			{
-				this.losStatus = this.vessel.getLineOfSightTo(this.Kerbin, out this._firstOccludingBody, radiusRatio);
-
-				return this.losStatus != LineOfSightStatus.Blocked;
+				return false;
 			}
 			else
 			{
@@ -242,19 +232,15 @@
 				}
 
 				// Skip vessels to which we do not have line of sight.
-				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;
-					}
+				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;
 				}
 
 				// Find the distance from here to the vessel...
@@ -319,8 +305,6 @@
 			// 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
@@ -227,32 +227,9 @@
 			this.packetThrottle = 100f;
 		}
 
-		// At least once, when the module starts with a state on the launch pad or later, go find Kerbin.
-		public override void OnStart (StartState state)
-		{
-			base.OnStart (state);
-
-			if (state >= StartState.PreLaunch)
-			{
-				this.relay = new AntennaRelay(this);
-				this.relay.maxTransmitDistance = this.maxTransmitDistance;
-
-				this.UImaxTransmitDistance = Tools.MuMech_ToSI(this.maxTransmitDistance) + "m";
-
-				GameEvents.onPartActionUICreate.Add(this.onPartActionUICreate);
-				GameEvents.onPartActionUIDismiss.Add(this.onPartActionUIDismiss);
-			}
-		}
-
-		// When the module loads, fetch the Squad KSPFields from the base.  This is necessary in part because
-		// overloading packetSize and packetResourceCostinto a property in ModuleLimitedDataTransmitter didn't
-		// work.
-		public override void OnLoad(ConfigNode node)
-		{
-			this.Fields.Load(node);
-			base.Fields.Load(node);
-
-			base.OnLoad (node);
+		public override void OnAwake()
+		{
+			base.OnAwake();
 
 			this._basepacketSize = base.packetSize;
 			this._basepacketResourceCost = base.packetResourceCost;
@@ -273,6 +250,34 @@
 			));
 		}
 
+		// At least once, when the module starts with a state on the launch pad or later, go find Kerbin.
+		public override void OnStart (StartState state)
+		{
+			base.OnStart (state);
+
+			if (state >= StartState.PreLaunch)
+			{
+				this.relay = new AntennaRelay(this);
+				this.relay.maxTransmitDistance = this.maxTransmitDistance;
+
+				this.UImaxTransmitDistance = Tools.MuMech_ToSI(this.maxTransmitDistance) + "m";
+
+				GameEvents.onPartActionUICreate.Add(this.onPartActionUICreate);
+				GameEvents.onPartActionUIDismiss.Add(this.onPartActionUIDismiss);
+			}
+		}
+
+		// When the module loads, fetch the Squad KSPFields from the base.  This is necessary in part because
+		// overloading packetSize and packetResourceCostinto a property in ModuleLimitedDataTransmitter didn't
+		// work.
+		public override void OnLoad(ConfigNode node)
+		{
+			this.Fields.Load(node);
+			base.Fields.Load(node);
+
+			base.OnLoad (node);
+		}
+
 		// Post an error in the communication messages describing the reason transmission has failed.  Currently there
 		// is only one reason for this.
 		protected void PostCannotTransmitError()
@@ -304,8 +309,17 @@
 			}
 			else
 			{
+				double rangeFactor = (this.transmitDistance / this.nominalRange);
+				rangeFactor *= rangeFactor;
+
 				base.packetResourceCost = this._basepacketResourceCost
-					* (float)Math.Pow (this.transmitDistance / this.nominalRange, 2);
+					* (float)rangeFactor;
+
+				Tools.PostDebugMessage(
+					this,
+					"Pretransmit: packet cost set to {0} before throttle (rangeFactor = {1}).",
+					base.packetResourceCost,
+					rangeFactor);
 			}
 
 			base.packetResourceCost *= this.packetThrottle / 100f;
@@ -321,9 +335,18 @@
 			}
 			else
 			{
+				double rangeFactor = (this.nominalRange / this.transmitDistance);
+				rangeFactor *= rangeFactor;
+
 				base.packetSize = Math.Min(
-					this._basepacketSize * (float)Math.Pow (this.nominalRange / this.transmitDistance, 2),
+					this._basepacketSize * (float)rangeFactor,
 					this._basepacketSize * this.maxDataFactor);
+
+				Tools.PostDebugMessage(
+					this,
+					"Pretransmit: packet size set to {0} before throttle (rangeFactor = {1}).",
+					base.packetSize,
+					rangeFactor);
 			}
 
 			base.packetSize *= this.packetThrottle / 100f;
@@ -522,7 +545,7 @@
 			{
 				if (this.CanTransmit())
 				{
-					this.UIrelayStatus = string.Format("Connected via {0}", this.relay);
+					this.UIrelayStatus = string.Intern("Connected");
 					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,16 +558,7 @@
 					}
 					else
 					{
-						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.UIrelayStatus = string.Format("Blocked by {0}", this.relay.firstOccludingBody.bodyName);
 					}
 					this.UImaxTransmitDistance = "N/A";
 					this.UIpacketSize = "N/A";