Removed the old ARmaxTransmitDistance hokum in favor of just fetching the value from the partPrefab. 0.6.0
[AntennaRange.git] / ModuleLimitedDataTransmitter.cs
blob:a/ModuleLimitedDataTransmitter.cs -> blob:b/ModuleLimitedDataTransmitter.cs
--- a/ModuleLimitedDataTransmitter.cs
+++ b/ModuleLimitedDataTransmitter.cs
@@ -77,10 +77,6 @@
 		[KSPField(isPersistant = false)]
 		public float maxDataFactor;
 
-		// This field exists to get saved to the persistence file so that relays can be found on unloaded Vessels.
-		[KSPField(isPersistant = true)]
-		protected float ARmaxTransmitDistance;
-
 		/*
 		 * Properties
 		 * */
@@ -107,7 +103,7 @@
 		{
 			get
 			{
-				return this.ARmaxTransmitDistance;
+				return Mathf.Sqrt (this.maxPowerFactor) * this.nominalRange;
 			}
 		}
 
@@ -213,7 +209,6 @@
 			this.Fields.Load(node);
 			base.Fields.Load(node);
 
-			this.ARmaxTransmitDistance = Mathf.Sqrt (this.maxPowerFactor) * this.nominalRange;
 			this.IsAntenna = true;
 
 			base.OnLoad (node);
@@ -243,7 +238,7 @@
 		{
 			string ErrorText = string.Format (
 				"Unable to transmit: out of range!  Maximum range = {0}m; Current range = {1}m.",
-				Tools.MuMech_ToSI((double)this.ARmaxTransmitDistance, 2),
+				Tools.MuMech_ToSI((double)this.maxTransmitDistance, 2),
 				Tools.MuMech_ToSI((double)this.transmitDistance, 2)
 				);
 
@@ -289,7 +284,7 @@
 		{
 			string text = base.GetInfo();
 			text += "Nominal Range: " + Tools.MuMech_ToSI((double)this.nominalRange, 2) + "m\n";
-			text += "Maximum Range: " + Tools.MuMech_ToSI((double)this.ARmaxTransmitDistance, 2) + "m\n";
+			text += "Maximum Range: " + Tools.MuMech_ToSI((double)this.maxTransmitDistance, 2) + "m\n";
 			return text;
 		}
 
@@ -382,7 +377,7 @@
 				base.packetSize,
 				this._basepacketResourceCost,
 				base.packetResourceCost,
-				this.ARmaxTransmitDistance,
+				this.maxTransmitDistance,
 				this.transmitDistance,
 				this.nominalRange,
 				this.CanTransmit(),