// and these are the two functions that actually do the work.
        private static void EnactTargetAction(MechJebModuleSmartASS.Target action, Vessel ourVessel)
        {
            MechJebCore activeJeb = ourVessel.GetMasterMechJeb();

            if (activeJeb == null)
            {
                return;
            }
            MechJebModuleSmartASS activeSmartass = activeJeb.GetComputerModule <MechJebModuleSmartASS>();

            if (activeSmartass == null)
            {
                return;
            }
            activeSmartass.target = action;
            activeSmartass.Engage();
        }
        /// <summary>
        /// Toggles SmartASS Force Roll mode.
        /// </summary>
        /// <param name="state"></param>
        public void ButtonForceRoll(bool state)
        {
            MechJebCore activeJeb = vessel.GetMasterMechJeb();

            if (activeJeb == null)
            {
                return;
            }

            MechJebModuleSmartASS activeSmartass = activeJeb.GetComputerModule <MechJebModuleSmartASS>();

            if (activeSmartass != null)
            {
                activeSmartass.forceRol = state;
                activeSmartass.Engage();
            }
        }
Пример #3
0
        public static void SASurface(float hdg, float pit, float rol)
        {
            MechJebCore activejeb = krpcmj.GetJeb();

            if (activejeb != null)
            {
                MechJebModuleSmartASS activeass = activejeb.GetComputerModule("MechJebModuleSmartASS") as MechJebModuleSmartASS;
                if (activeass != null)
                {
                    activeass.mode   = MechJebModuleSmartASS.Mode.SURFACE;
                    activeass.srfHdg = hdg;
                    activeass.srfPit = pit;
                    activeass.srfRol = rol;
                    activeass.target = MechJebModuleSmartASS.Target.SURFACE;
                    activeass.Engage();
                }
            }
        }
Пример #4
0
 public void ClickProcessor(int buttonID)
 {
     if (buttonID == buttonUp)
     {
         activeMenu.PreviousItem();
     }
     if (buttonID == buttonDown)
     {
         activeMenu.NextItem();
     }
     if (buttonID == buttonEnter)
     {
         activeMenu.SelectItem();
     }
     if (buttonID == buttonEsc)
     {
         activeMenu  = topMenu;
         currentMenu = MJMenu.RootMenu;
     }
     if (buttonID == buttonHome)
     {
         if (currentMenu == MJMenu.RootMenu && activeMenu.currentSelection == 5 && activeSmartass != null)
         {
             // If Force Roll is highlighted, the Home key will increment the
             // roll value.
             double currentRoll = (double)activeSmartass.rol + forceRollStep;
             if (currentRoll > 180.0)
             {
                 currentRoll -= 360.0;
             }
             else if (currentRoll < -180.0)
             {
                 currentRoll += 360.0;
             }
             activeSmartass.rol = currentRoll;
             if (forceRollMenuItem.isSelected)
             {
                 activeSmartass.Engage();
             }
         }
     }
 }