Example #1
0
        public static double GetREALSignal(CommNet.CommLink link, bool aIsRelay = true)
        {
            Vessel  vesselA = link.a.transform.GetComponent <Vessel> ();
            double  powerA  = GetActualVesselPower(vesselA, aIsRelay);
            double  powerB;
            Vector3 positionB;

            if (link.b.isHome)
            {
                positionB = link.b.position;
                powerB    = GameVariables.Instance.GetDSNRange
                                (ScenarioUpgradeableFacilities.GetFacilityLevel
                                    (SpaceCenterFacility.TrackingStation));
            }
            else
            {
                Vessel vesselB = link.b.transform.GetComponent <Vessel> ();
                powerB    = GetActualVesselPower(vesselB, true);
                positionB = vesselB.GetTransform().position;
            }

            double maxRange = GetRange(powerA, powerB);

            double distance = Vector3.Distance(vesselA.GetTransform().position, positionB);

            return(GetSignalStrength(maxRange, distance));
        }
Example #2
0
 /// <summary>
 /// Construct from a KSP CommLink object.
 /// </summary>
 public CommLink(CommNet.CommLink link)
 {
     if (ReferenceEquals(link, null))
     {
         throw new ArgumentNullException(nameof(link));
     }
     InternalLink = link;
 }