Moved all configuration items to ARConfiguration, because that makes sense.
[AntennaRange.git] / AntennaRelay.cs
blob:a/AntennaRelay.cs -> blob:b/AntennaRelay.cs
--- a/AntennaRelay.cs
+++ b/AntennaRelay.cs
@@ -35,9 +35,6 @@
 {
 	public class AntennaRelay
 	{
-		public static bool requireLineOfSight;
-		public static double radiusRatio;
-
 		// We don't have a Bard, so we'll hide Kerbin here.
 		protected CelestialBody Kerbin;
 
@@ -150,9 +147,9 @@
 			if (
 				this.transmitDistance > this.maxTransmitDistance ||
 				(
-					requireLineOfSight &&
+					ARConfiguration.RequireLineOfSight &&
 					this.nearestRelay == null &&
-					!this.vessel.hasLineOfSightTo(this.Kerbin, out this._firstOccludingBody, radiusRatio)
+					!this.vessel.hasLineOfSightTo(this.Kerbin, out this._firstOccludingBody, ARConfiguration.RadiusRatio)
 				)
 			)
 			{
@@ -232,8 +229,8 @@
 				}
 
 				// Skip vessels to which we do not have line of sight.
-				if (requireLineOfSight &&
-					!this.vessel.hasLineOfSightTo(potentialVessel, out this._firstOccludingBody, radiusRatio))
+				if (ARConfiguration.RequireLineOfSight &&
+					!this.vessel.hasLineOfSightTo(potentialVessel, out this._firstOccludingBody, ARConfiguration.RadiusRatio))
 				{
 					Tools.PostDebugMessage(
 						this,
@@ -306,17 +303,6 @@
 			// we hope it is safe enough.
 			this.Kerbin = FlightGlobals.Bodies.FirstOrDefault(b => b.name == "Kerbin");
 		}
-
-		static AntennaRelay()
-		{
-			var config = KSP.IO.PluginConfiguration.CreateForType<AntennaRelay>();
-
-			config.load();
-
-			AntennaRelay.requireLineOfSight = config.GetValue<bool>("requireLineOfSight", false);
-
-			config.save();
-		}
 	}
 }