public bool HasConnectionToHome(Vessel vessel)
 {
     if (!RemoteTechHook.IsAvailable())
     {
         return(false); // default to no connection if RT itself isn't available.
     }
     return(RemoteTechHook.Instance.HasConnectionToKSC(vessel.id));
 }
Example #2
0
 public double GetDelayToControl(Vessel vessel)
 {
     if (!RemoteTechHook.IsAvailable(vessel.id))
     {
         return(-1); // default to no connection if the vessel isn't configured for RT.
     }
     return(RemoteTechUtility.GetInputWaitTime(vessel));
 }
Example #3
0
 public bool HasConnectionToHome(Vessel vessel)
 {
     if (!RemoteTechHook.IsAvailable(vessel.id))
     {
         return(false); // default to no connection if the vessel isn't configured for RT.
     }
     return(RemoteTechHook.Instance.HasConnectionToKSC(vessel.id));
 }
 public bool HasConnectionToControl(Vessel vessel)
 {
     if (!RemoteTechHook.IsAvailable())
     {
         return(vessel.CurrentControlLevel >= Vessel.ControlLevel.PARTIAL_MANNED); // default to checking for local control if RT itself isn't available.
     }
     return(RemoteTechHook.Instance.HasAnyConnection(vessel.id) || RemoteTechHook.Instance.HasLocalControl(vessel.id));
 }
 public RemoteTechConnectivityManager()
 {
     // It is safe to only check the hook's availability once when loading because the
     // in game setting to disable RemoteTech function is only available at the space
     // center scene.  This manager is only created when initializing a new processor
     // in the flight scene.
     hookAvailable = RemoteTechHook.IsAvailable();
 }
Example #6
0
        public double GetDelayToHome(Vessel vessel)
        {
            if (!RemoteTechHook.IsAvailable(vessel.id))
            {
                return(-1); // default to no connection if the vessel isn't configured for RT.
            }
            double delay = RemoteTechHook.Instance.GetSignalDelayToKSC(vessel.id);

            return(delay != double.PositiveInfinity ? delay : -1);
        }
        public double GetDelay(Vessel vessel1, Vessel vessel2)
        {
            if (!(RemoteTechHook.IsAvailable()))
            {
                return(-1); // default to no connection if RT itself isn't available.
            }
            double delay = RemoteTechHook.Instance.GetSignalDelayToSatellite(vessel1.id, vessel2.id);

            return(Double.IsPositiveInfinity(delay) ? -1 : delay);
        }
Example #8
0
        public double GetDelay(Vessel vessel1, Vessel vessel2)
        {
            if (!(RemoteTechHook.IsAvailable(vessel1.id) && RemoteTechHook.IsAvailable(vessel2.id)))
            {
                return(-1); // default to no connection if one of the vessels isn't configured for RT.
            }
            double delay = RemoteTechHook.Instance.GetSignalDelayToSatellite(vessel1.id, vessel2.id);

            return(delay != double.PositiveInfinity ? delay : -1);
        }
        public double GetDelayToHome(Vessel vessel)
        {
            if (!RemoteTechHook.IsAvailable())
            {
                return(-1); // default to no connection if RT itself isn't available.
            }
            double delay = RemoteTechHook.Instance.GetSignalDelayToKSC(vessel.id);

            return(Double.IsPositiveInfinity(delay) ? -1 : delay);
        }
Example #10
0
        private static ScalarValue RTGetDelay(VesselTarget tgtVessel)
        {
            double waitTotal = 0;

            if (RemoteTechHook.IsAvailable())
            {
                waitTotal = RemoteTechHook.Instance.GetShortestSignalDelay(tgtVessel.Vessel.id);
            }
            return(Double.IsPositiveInfinity(waitTotal) ? -1 : waitTotal);
        }
Example #11
0
        public void RemoveAutopilotHook(Vessel vessel, FlightInputCallback hook)
        {
            Action <FlightCtrlState> action;

            if (RemoteTechHook.IsAvailable(vessel.id) && callbacks.TryGetValue(hook, out action))
            {
                RemoteTechHook.Instance.RemoveSanctionedPilot(vessel.id, action);
                callbacks.Remove(hook);
            }
        }
Example #12
0
        private static BooleanValue RTAntennaHasConnection(PartValue part)
        {
            bool result = false;

            if (RemoteTechHook.IsAvailable(part.Part.vessel.id))
            {
                result = RemoteTechHook.Instance.AntennaHasConnection(part.Part);
            }

            return(result);
        }
Example #13
0
        private static ScalarValue RTGetKSCDelay(VesselTarget tgtVessel)
        {
            double waitTotal = 0;

            if (RemoteTechHook.IsAvailable() && tgtVessel.Vessel.GetVesselCrew().Count == 0)
            {
                waitTotal = RemoteTechHook.Instance.GetSignalDelayToKSC(tgtVessel.Vessel.id);
            }

            return(Double.IsPositiveInfinity(waitTotal) ? -1 : waitTotal);
        }
Example #14
0
File: Addon.cs Project: jonored/KOS
        private static BooleanValue RTHasConnection(VesselTarget tgtVessel)
        {
            bool result = false;

            if (RemoteTechHook.IsAvailable(tgtVessel.Vessel.id))
            {
                result = RemoteTechHook.Instance.HasAnyConnection(tgtVessel.Vessel.id);
            }

            return(result);
        }
Example #15
0
        private static bool RTHasKSCConnection(VesselTarget tgtVessel)
        {
            bool result = false;

            if (RemoteTechHook.IsAvailable(tgtVessel.Vessel.id))
            {
                result = RemoteTechHook.Instance.HasConnectionToKSC(tgtVessel.Vessel.id);
            }

            return(result);
        }
Example #16
0
        private static double RTGetKSCDelay(VesselTarget tgtVessel)
        {
            double waitTotal = 0;

            if (RemoteTechHook.IsAvailable(tgtVessel.Vessel.id) && tgtVessel.Vessel.GetVesselCrew().Count == 0)
            {
                waitTotal = RemoteTechHook.Instance.GetSignalDelayToKSC(tgtVessel.Vessel.id);
            }

            return(waitTotal);
        }
Example #17
0
        private static bool RTHasLocalControl(VesselTarget tgtVessel)
        {
            bool result = false;

            if (RemoteTechHook.IsAvailable(tgtVessel.Vessel.id))
            {
                result = RemoteTechHook.Instance.HasLocalControl(tgtVessel.Vessel.id);
            }

            return(result);
        }
Example #18
0
 public double GetDelayToControl(Vessel vessel)
 {
     if (!RemoteTechHook.IsAvailable(vessel.id))
     {
         return(-1); // default to no connection if the vessel isn't configured for RT.
     }
     if (RemoteTechHook.Instance.HasLocalControl(vessel.id))
     {
         return(0d);
     }
     return(RemoteTechHook.Instance.GetShortestSignalDelay(vessel.id));
 }
Example #19
0
 public void AddAutopilotHook(Vessel vessel, FlightInputCallback hook)
 {
     if (RemoteTechHook.IsAvailable(vessel.id))
     {
         Action <FlightCtrlState> action;
         if (!callbacks.TryGetValue(hook, out action))
         {
             action          = new Action <FlightCtrlState>(hook);
             callbacks[hook] = action;
         }
         RemoteTechHook.Instance.AddSanctionedPilot(vessel.id, action);
     }
 }
Example #20
0
        private static BooleanValue RTAntennaHasConnection(PartValue part)
        {
            bool result = false;

            // IsAvailable(Id) is only able to return True on loaded vessels, but this
            // is a test for a specific PART on a vessel, and individual parts on
            // vessels don't exist when the vessel is unloaded anyway.
            if (RemoteTechHook.IsAvailable(part.Part.vessel.id))
            {
                result = RemoteTechHook.Instance.AntennaHasConnection(part.Part);
            }

            return(result);
        }
        public double GetDelayToControl(Vessel vessel)
        {
            if (!RemoteTechHook.IsAvailable())
            {
                return(-1); // default to no connection if RT itself isn't available.
            }
            if (RemoteTechHook.Instance.HasLocalControl(vessel.id))
            {
                return(0d);
            }
            double delay = RemoteTechHook.Instance.GetShortestSignalDelay(vessel.id);

            return(Double.IsPositiveInfinity(delay) ? -1 : delay);
        }
        public void RemoveAutopilotHook(Vessel vessel, FlightInputCallback hook)
        {
            Action <FlightCtrlState> action;

            if (RemoteTechHook.IsAvailable(vessel.id) && callbacks.TryGetValue(hook, out action))
            {
                RemoteTechHook.Instance.RemoveSanctionedPilot(vessel.id, action);
                callbacks.Remove(hook);
                // removing the callback from stock if not already added doesn't throw an error
                vessel.OnPreAutopilotUpdate -= hook;
            }
            else // remove fallback event hook
            {
                vessel.OnPreAutopilotUpdate -= hook;
            }
        }
Example #23
0
 public void AddAutopilotHook(Vessel vessel, FlightInputCallback hook)
 {
     if (RemoteTechHook.IsAvailable(vessel.id))
     {
         Action <FlightCtrlState> action;
         if (!callbacks.TryGetValue(hook, out action))
         {
             action          = new Action <FlightCtrlState>(hook);
             callbacks[hook] = action;
         }
         RemoteTechHook.Instance.AddSanctionedPilot(vessel.id, action);
     }
     else // fallback to stock events when RT isn't available, this may have unexpected results if RT availability changes
     {
         // removing the callback if not already added doesn't throw an error
         // but adding it a 2nd time will result in 2 calls.  Remove to be safe.
         vessel.OnPreAutopilotUpdate -= hook;
         vessel.OnPreAutopilotUpdate += hook;
     }
 }
Example #24
0
 public override bool Available()
 {
     return(RemoteTechHook.IsAvailable());
 }
Example #25
0
File: Addon.cs Project: jonored/KOS
 public override BooleanValue Available()
 {
     return(RemoteTechHook.IsAvailable());
 }