Ejemplo n.º 1
0
        public static ServoGroup ServoGroupWithName(KRPC.SpaceCenter.Services.Vessel vessel, string name)
        {
            CheckAPI();
            var servoGroup = IRWrapper.IRController.ServoGroups.FirstOrDefault(x => x.Vessel.id == vessel.Id && x.Name == name);

            return(servoGroup != null ? new ServoGroup(servoGroup) : null);
        }
Ejemplo n.º 2
0
        public static void ClearRotation(KRPC.SpaceCenter.Services.Vessel vessel = null)
        {
            Vessel internalVessel = vessel == null ? FlightGlobals.ActiveVessel : vessel.InternalVessel;

            internalVessel.GoOnRails();
            internalVessel.SetRotation(ZeroRotation);
        }
Ejemplo n.º 3
0
 internal Comms(KRPC.SpaceCenter.Services.Vessel innerVessel)
 {
     if (!API.IsAvailable)
     {
         throw new InvalidOperationException("RemoteTech is not installed");
     }
     vessel   = innerVessel;
     vesselId = vessel.InternalVessel.id;
 }
Ejemplo n.º 4
0
        public static Servo ServoWithName(KRPC.SpaceCenter.Services.Vessel vessel, string name)
        {
            CheckAPI();
            var servo = IRWrapper.IRController.ServoGroups
                        .Where(x => x.Vessel.id == vessel.Id)
                        .SelectMany(x => x.Servos)
                        .FirstOrDefault(x => x.Name == name);

            return(servo != null ? new Servo(servo) : null);
        }
Ejemplo n.º 5
0
        public static void AscentRdzv(KRPC.SpaceCenter.Services.Vessel Targ)
        {
            MechJebCore activejeb = GetJeb();

            if (activejeb != null)
            {
                MechJebModuleAscentAutopilot activeasc = activejeb.GetComputerModule("MechJebModuleAscentAutopilot") as MechJebModuleAscentAutopilot;
                if (activeasc != null)
                {
                    activeasc.core.target.Set(Targ.InternalVessel);
                    activeasc.core.vessel.targetObject = Targ.InternalVessel;
                    activeasc.StartCountdown(activeasc.vesselState.time + LaunchTiming.TimeToPhaseAngle(activeasc.launchPhaseAngle, activeasc.vessel.mainBody, activeasc.vessel.longitude, activeasc.core.target.TargetOrbit));
                    activeasc.enabled = true;
                }
            }
        }
Ejemplo n.º 6
0
 public static IList <ServoGroup> ServoGroups(KRPC.SpaceCenter.Services.Vessel vessel)
 {
     CheckAPI();
     return(IRWrapper.IRController.ServoGroups.Where(x => x.Vessel.id == vessel.Id).Select(x => new ServoGroup(x)).ToList());
 }
Ejemplo n.º 7
0
        public static void ApplyRotation(float angle, KRPC.Utils.Tuple <float, float, float> axis, KRPC.SpaceCenter.Services.Vessel vessel = null)
        {
            Vessel internalVessel = vessel == null ? FlightGlobals.ActiveVessel : vessel.InternalVessel;
            var    axisVector     = new Vector3(axis.Item1, axis.Item2, axis.Item3).normalized;
            var    rotation       = internalVessel.transform.rotation * Quaternion.AngleAxis(angle, axisVector);

            internalVessel.SetRotation(rotation);
        }
Ejemplo n.º 8
0
 public double SignalDelayToVessel(KRPC.SpaceCenter.Services.Vessel other)
 {
     return(API.GetSignalDelayToSatellite(vesselId, other.Id));
 }
Ejemplo n.º 9
0
 public static Comms Comms(KRPC.SpaceCenter.Services.Vessel vessel)
 {
     CheckAPI();
     return(new Comms(vessel));
 }