IsAvailable() public static method

public static IsAvailable ( ) : bool
return bool
 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));
 }
示例#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));
 }
示例#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();
 }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
            }
        }
示例#12
0
文件: Addon.cs 项目: pand5461/KOS-1
        private static BooleanValue RTAntennaHasConnection(PartValue part)
        {
            bool result = false;

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

            return(result);
        }
示例#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);
        }
示例#14
0
文件: Addon.cs 项目: 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);
        }
示例#15
0
文件: Addon.cs 项目: tfischer4765/KOS
        private static bool RTHasKSCConnection(VesselTarget tgtVessel)
        {
            bool result = false;

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

            return(result);
        }
示例#16
0
文件: Addon.cs 项目: tfischer4765/KOS
        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);
        }
示例#17
0
文件: Addon.cs 项目: tfischer4765/KOS
        private static bool RTHasLocalControl(VesselTarget tgtVessel)
        {
            bool result = false;

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

            return(result);
        }
示例#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));
 }
示例#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);
     }
 }
示例#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;
            }
        }
示例#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;
     }
 }
示例#24
0
文件: Addon.cs 项目: tfischer4765/KOS
 public override bool Available()
 {
     return(RemoteTechHook.IsAvailable());
 }
示例#25
0
文件: Addon.cs 项目: jonored/KOS
 public override BooleanValue Available()
 {
     return(RemoteTechHook.IsAvailable());
 }