コード例 #1
0
        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
ファイル: Addon.cs プロジェクト: hashashin/kOS_MiscUtils
        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
ファイル: AscentAP.cs プロジェクト: trueppp/krpcmj
        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
ファイル: AscentAP.cs プロジェクト: trueppp/krpcmj
        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
ファイル: AscentAP.cs プロジェクト: trueppp/krpcmj
        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;
                }
            }
        }
コード例 #7
0
        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);
        }