public void ButtonAscentGuidance(bool state)
        {
            MechJebCore activeJeb = vessel.GetMasterMechJeb();

            if (activeJeb == null)
            {
                return;
            }

            MechJebModuleAscentAutopilot ap = activeJeb.GetComputerModule <MechJebModuleAscentAutopilot>();

            if (ap == null)
            {
                return;
            }

            var agPilot = activeJeb.GetComputerModule <MechJebModuleAscentGuidance>();

            if (agPilot != null)
            {
                if (ap.enabled)
                {
                    ap.users.Remove(agPilot);
                }
                else
                {
                    ap.users.Add(agPilot);
                }
            }
        }
示例#2
0
        private void AscentGuidance(int index, TextMenu.Item tmi)
        {
            UpdateJebReferences();
            if (activeJeb != null)
            {
                MechJebModuleAscentAutopilot ap = activeJeb.GetComputerModule <MechJebModuleAscentAutopilot>();
                if (ap == null)
                {
                    return;
                }

                var agPilot = activeJeb.GetComputerModule <MechJebModuleAscentGuidance>();
                if (agPilot != null)
                {
                    if (ap.enabled)
                    {
                        ap.users.Remove(agPilot);
                    }
                    else
                    {
                        ap.users.Add(agPilot);
                    }
                }
            }
        }
示例#3
0
        StringValue LaunchWithMechJeb(ScalarValue alt)
        {
            MechJebCore activejeb = utils.GetJeb();
            MechJebModuleAscentAutopilot activeasc =
                activejeb?.GetComputerModule("MechJebModuleAscentAutopilot") as MechJebModuleAscentAutopilot;

            if (activeasc != null)
            {
                activeasc.desiredOrbitAltitude.val = alt;
                activeasc.enabled = true;
                return("");
            }
            return("error: no Mechjeb found in this vessel");
        }
示例#4
0
        public static void AscentIntoPlane()
        {
            MechJebCore activejeb = GetJeb();

            if (activejeb != null)
            {
                MechJebModuleAscentAutopilot activeasc = activejeb.GetComputerModule("MechJebModuleAscentAutopilot") as MechJebModuleAscentAutopilot;
                if (activeasc != null)
                {
                    activeasc.StartCountdown(activeasc.vesselState.time + LaunchTiming.TimeToPlane(activeasc.launchLANDifference, activeasc.vessel.mainBody, activeasc.vesselState.latitude, activeasc.vesselState.longitude, activeasc.core.target.TargetOrbit));
                    activeasc.enabled = true;
                }
            }
        }
示例#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;
                }
            }
        }
示例#6
0
        public static void AscentNow(double Alt, float Inc)
        {
            MechJebCore activejeb = GetJeb();

            if (activejeb != null)
            {
                MechJebModuleAscentAutopilot activeasc = activejeb.GetComputerModule("MechJebModuleAscentAutopilot") as MechJebModuleAscentAutopilot;
                MechJebModuleAscentGuidance  activegui = activejeb.GetComputerModule("MechJebModuleAscentGuidance") as MechJebModuleAscentGuidance;
                if (activeasc != null)
                {
                    activegui.desiredInclination       = Inc;
                    activeasc.desiredOrbitAltitude.val = Alt;
                    activeasc.desiredInclination       = Inc;
                    activeasc.enabled = true;
                }
            }
        }
        public bool ButtonAscentGuidanceState()
        {
            MechJebCore activeJeb = vessel.GetMasterMechJeb();

            if (activeJeb == null)
            {
                return(false);
            }

            MechJebModuleAscentAutopilot ap = activeJeb.GetComputerModule <MechJebModuleAscentAutopilot>();

            if (ap == null)
            {
                return(false);
            }

            return(ap.enabled);
        }