Version 1.3 1.3
Version 1.3

--- a/ARFlightController.cs
+++ b/ARFlightController.cs
@@ -130,6 +130,8 @@
 
 		protected void FixedUpdate()
 		{
+			Tools.DebugLogger log = Tools.DebugLogger.New(this);
+
 			// 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 (
@@ -156,20 +158,39 @@
 
 			if (this.toolbarButton != null && HighLogic.LoadedSceneIsFlight && FlightGlobals.ActiveVessel != null)
 			{
+				log.Append("Checking vessel relay status.\n");
+
 				List<ModuleLimitedDataTransmitter> relays =
 					FlightGlobals.ActiveVessel.getModulesOfType<ModuleLimitedDataTransmitter>();
 
+				log.AppendFormat("\t...found {0} relays\n", relays.Count);
+
 				bool vesselCanTransmit = false;
 				bool vesselHasOptimalRelay = false;
 
 				foreach (ModuleLimitedDataTransmitter relay in relays)
 				{
-					if (!vesselCanTransmit && relay.CanTransmit())
+					log.AppendFormat("\tvesselCanTransmit: {0}, vesselHasOptimalRelay: {1}\n",
+						vesselCanTransmit, vesselHasOptimalRelay);
+
+					log.AppendFormat("\tChecking relay {0}\n" +
+						"\t\tCanTransmit: {1}, transmitDistance: {2}, nominalRange: {3}\n",
+						relay,
+						relay.CanTransmit(),
+						relay.transmitDistance,
+						relay.nominalRange
+					);
+
+					bool relayCanTransmit = relay.CanTransmit();
+
+					if (!vesselCanTransmit && relayCanTransmit)
 					{
 						vesselCanTransmit = true;
 					}
 
-					if (!vesselHasOptimalRelay && relay.transmitDistance <= (double)relay.nominalRange)
+					if (!vesselHasOptimalRelay &&
+						relayCanTransmit &&
+						relay.transmitDistance <= (double)relay.nominalRange)
 					{
 						vesselHasOptimalRelay = true;
 					}
@@ -180,6 +201,9 @@
 					}
 				}
 
+				log.AppendFormat("Done checking.  vesselCanTransmit: {0}, vesselHasOptimalRelay: {1}\n",
+					vesselCanTransmit, vesselHasOptimalRelay);
+
 				if (vesselHasOptimalRelay)
 				{
 					this.currentConnectionStatus = ConnectionStatus.Optimal;
@@ -193,11 +217,16 @@
 					this.currentConnectionStatus = ConnectionStatus.None;
 				}
 
+				log.AppendFormat("currentConnectionStatus: {0}, setting texture to {1}",
+					this.currentConnectionStatus, this.currentConnectionTexture);
+
 				this.toolbarButton.TexturePath = this.currentConnectionTexture;
 			}
-		}
-
-		protected void Destroy()
+
+			log.Print();
+		}
+
+		protected void OnDestroy()
 		{
 			InputLockManager.RemoveControlLock(this.lockID);
 
@@ -208,6 +237,8 @@
 
 			GameEvents.onGameSceneLoadRequested.Remove(this.onSceneChangeRequested);
 			GameEvents.onVesselChange.Remove(this.onVesselChange);
+
+			print("ARFlightController: Destroyed.");
 		}
 		#endregion
 
@@ -216,6 +247,7 @@
 		{
 			if (scene != GameScenes.FLIGHT)
 			{
+				print("ARFlightController: Requesting Destruction.");
 				MonoBehaviour.Destroy(this);
 			}
 		}

--- a/AntennaRange.csproj
+++ b/AntennaRange.csproj
@@ -9,7 +9,7 @@
     <OutputType>Library</OutputType>
     <RootNamespace>AntennaRange</RootNamespace>
     <AssemblyName>AntennaRange</AssemblyName>
-    <ReleaseVersion>1.1</ReleaseVersion>
+    <ReleaseVersion>1.3</ReleaseVersion>
     <SynchReleaseVersion>false</SynchReleaseVersion>
     <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
     <UseMSBuildEngine>False</UseMSBuildEngine>

--- a/AntennaRelay.cs
+++ b/AntennaRelay.cs
@@ -38,7 +38,7 @@
 		public static bool requireLineOfSight;
 
 		// We don't have a Bard, so we'll hide Kerbin here.
-		public static CelestialBody Kerbin;
+		protected CelestialBody Kerbin;
 
 		protected CelestialBody _firstOccludingBody;
 
@@ -109,7 +109,7 @@
 				if (this.nearestRelay == null)
 				{
 					// .. return the distance to Kerbin
-					return this.DistanceTo(Kerbin);
+					return this.DistanceTo(this.Kerbin);
 				}
 				else
 				{
@@ -151,7 +151,7 @@
 				(
 					requireLineOfSight &&
 					this.nearestRelay == null &&
-					!this.vessel.hasLineOfSightTo(Kerbin, out this._firstOccludingBody)
+					!this.vessel.hasLineOfSightTo(this.Kerbin, out this._firstOccludingBody)
 				)
 			)
 			{
@@ -298,14 +298,11 @@
 			this.moduleRef = module;
 
 			this.searchTimer = new System.Diagnostics.Stopwatch();
-			this.millisecondsBetweenSearches = 1250;
+			this.millisecondsBetweenSearches = 5000;
 
 			// HACK: This might not be safe in all circumstances, but since AntennaRelays are not built until Start,
 			// we hope it is safe enough.
-			if (AntennaRelay.Kerbin == null)
-			{
-				AntennaRelay.Kerbin = FlightGlobals.Bodies.FirstOrDefault(b => b.name == "Kerbin");
-			}
+			this.Kerbin = FlightGlobals.Bodies.FirstOrDefault(b => b.name == "Kerbin");
 		}
 
 		static AntennaRelay()

--- a/IAntennaRelay.cs
+++ b/IAntennaRelay.cs
@@ -42,8 +42,6 @@
 		/// <value>The parent Vessel.</value>
 		Vessel vessel { get; }
 
-		IAntennaRelay nearestRelay { get; }
-
 		/// <summary>
 		/// Gets the distance to the nearest relay or Kerbin, whichever is closer.
 		/// </summary>

--- a/ModuleLimitedDataTransmitter.cs
+++ b/ModuleLimitedDataTransmitter.cs
@@ -123,19 +123,6 @@
 			get
 			{
 				return base.vessel;
-			}
-		}
-
-		public IAntennaRelay nearestRelay
-		{
-			get
-			{
-				if (this.relay == null)
-				{
-					return null;
-				}
-
-				return this.relay.nearestRelay;
 			}
 		}
 

--- 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.2.*")]
+[assembly: AssemblyVersion("1.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)]

file:b/toolbarIcon.xcf (new)
 Binary files /dev/null and b/toolbarIcon.xcf differ