Ejemplo n.º 1
0
        private void EngageTranslatronControl(MechJebModuleThrustController.TMode mode)
        {
            MechJebCore masterMechJeb = vessel.GetMasterMechJeb();

            if (masterMechJeb != null)
            {
                MechJebModuleTranslatron moduleTranslatron = masterMechJeb.GetComputerModule <MechJebModuleTranslatron>();

                if (moduleTranslatron != null && !moduleTranslatron.hidden)
                {
                    if ((thrust.users.Count > 1) && !thrust.users.Contains(moduleTranslatron))
                    {
                        return;
                    }

                    moduleTranslatron.SetMode(mode);
                }
                else
                {
                    Debug.LogError("MechJeb couldn't find MechJebModuleTranslatron for translatron control via action group.");
                }
            }
            else
            {
                Debug.LogError("MechJeb couldn't find the master MechJeb module for the current vessel.");
            }
        }
Ejemplo n.º 2
0
        [KSPAction("#MechJeb_PANIC")]//PANIC!
        public void OnPanicAction(KSPActionParam param)
        {
            MechJebCore masterMechJeb = vessel.GetMasterMechJeb();

            if (masterMechJeb != null)
            {
                MechJebModuleTranslatron moduleTranslatron = masterMechJeb.GetComputerModule <MechJebModuleTranslatron>();
                if (moduleTranslatron != null && !moduleTranslatron.hidden)
                {
                    moduleTranslatron.PanicSwitch();
                }
            }
        }
Ejemplo n.º 3
0
        public MechJebModuleJoke(MechJebCore core)
            : base(core)
        {
            hidden  = true;
            enabled = true;

            sorry = core.part.gameObject.AddComponent <AudioSource>();
            WWW www = new WWW("file://" + KSPUtil.ApplicationRootPath.Replace("\\", "/") + "Parts/mumech_MechJebPod/snd1.wav");

            if ((sorry != null) && (www != null))
            {
                sorry.clip   = www.GetAudioClip(false);
                sorry.volume = 0;
                sorry.Stop();
            }

            glitch      = core.part.gameObject.AddComponent <AudioSource>();
            glitchClips = new AudioClip[NUM_GLITCH_SOUNDS];
            for (int i = 0; i < NUM_GLITCH_SOUNDS; i++)
            {
                www = new WWW("file://" + KSPUtil.ApplicationRootPath.Replace("\\", "/") + "Parts/mumech_MechJebPod/glitch" + i + ".wav");
                if (www != null)
                {
                    glitchClips[i] = www.GetAudioClip(false);
                }
            }

            foreach (ComputerModule module in core.modules)
            {
                if (module is MechJebModuleAscentAutopilot)
                {
                    ascent = (MechJebModuleAscentAutopilot)module;
                }
                if (module is MechJebModuleLandingAutopilot)
                {
                    landing = (MechJebModuleLandingAutopilot)module;
                }
                if (module is MechJebModuleTranslatron)
                {
                    translatron = (MechJebModuleTranslatron)module;
                }
            }
        }
Ejemplo n.º 4
0
        public MechJebModuleJoke(MechJebCore core)
            : base(core)
        {
            hidden = true;
            enabled = true;

            sorry = core.part.gameObject.AddComponent<AudioSource>();
            WWW www = new WWW("file://" + KSPUtil.ApplicationRootPath.Replace("\\", "/") + "Parts/mumech_MechJebPod/snd1.wav");
            if ((sorry != null) && (www != null))
            {
                sorry.clip = www.GetAudioClip(false);
                sorry.volume = 0;
                sorry.Stop();
            }

            glitch = core.part.gameObject.AddComponent<AudioSource>();
            glitchClips = new AudioClip[NUM_GLITCH_SOUNDS];
            for (int i = 0; i < NUM_GLITCH_SOUNDS; i++)
            {
                www = new WWW("file://" + KSPUtil.ApplicationRootPath.Replace("\\", "/") + "Parts/mumech_MechJebPod/glitch" + i + ".wav");
                if (www != null)
                {
                    glitchClips[i] = www.GetAudioClip(false);
                }
            }

            foreach (ComputerModule module in core.modules)
            {
                if (module is MechJebModuleAscentAutopilot)
                {
                    ascent = (MechJebModuleAscentAutopilot)module;
                }
                if (module is MechJebModuleLandingAutopilot)
                {
                    landing = (MechJebModuleLandingAutopilot)module;
                }
                if (module is MechJebModuleTranslatron)
                {
                    translatron = (MechJebModuleTranslatron)module;
                }
            }
        }
Ejemplo n.º 5
0
        private void SetTranslatronSpeed(float speed, bool relative = false)
        {
            MechJebCore masterMechJeb = vessel.GetMasterMechJeb();

            if (masterMechJeb != null)
            {
                MechJebModuleTranslatron moduleTranslatron = masterMechJeb.GetComputerModule <MechJebModuleTranslatron>();

                if (moduleTranslatron != null && !moduleTranslatron.hidden)
                {
                    thrust.trans_spd_act = (relative ? thrust.trans_spd_act : 0) + speed;
                }
                else
                {
                    Debug.LogError("MechJeb couldn't find MechJebModuleTranslatron for translatron control via action group.");
                }
            }
            else
            {
                Debug.LogError("MechJeb couldn't find the master MechJeb module for the current vessel.");
            }
        }
Ejemplo n.º 6
0
        [KSPAction("#MechJeb_TranslatronToggleHS")]//Translatron Toggle H/S
        public void OnTranslatronToggleHSAction(KSPActionParam param)
        {
            MechJebCore masterMechJeb = vessel.GetMasterMechJeb();

            if (masterMechJeb != null)
            {
                MechJebModuleTranslatron moduleTranslatron = masterMechJeb.GetComputerModule <MechJebModuleTranslatron>();

                if (moduleTranslatron != null && !moduleTranslatron.hidden)
                {
                    thrust.trans_kill_h = !thrust.trans_kill_h;
                }
                else
                {
                    Debug.LogError(Localizer.Format("#MechJeb_LogError_msg2"));//"MechJeb couldn't find MechJebModuleTranslatron for translatron control via action group."
                }
            }
            else
            {
                Debug.LogError("MechJeb couldn't find the master MechJeb module for the current vessel.");
            }
        }