public void disableEvaEvents(Vessel v, bool isEvaEnabled)
        {
            if (null == v.evaController)
            {
                return;
            }

            KerbalEVA evaCtl = v.evaController;

            foreach (BaseEvent e in evaCtl.Events)
            {
                // Preserving the actions needed for EVA. These events should not be preserved if the Tourist can't EVA!
                if (EVENT_WHITELIST.Contains(e.name))
                {
                    continue;
                }

                Log.dbg("disabling event {0} -- {1}", e.name, e.guiName);
                e.guiActive          = false;
                e.guiActiveUnfocused = false;
                e.guiActiveUncommand = false;
            }

            // ModuleScienceExperiment is only supported on KSP 1.7 **with** Breaking Ground installed, but it does not hurt
            // saving a DLL by shoving the code here.
            foreach (PartModule m in evaCtl.part.Modules)
            {
                if (!m.ClassName.Equals("ModuleScienceExperiment"))
                {
                    continue;
                }
                Log.dbg("science module id: {0}", ((ModuleScienceExperiment)m).experimentID);
                // Disable all science
                foreach (BaseEvent e in m.Events)
                {
                    Log.dbg("disabling event {0}", e.guiName);
                    e.guiActive          = false;
                    e.guiActiveUnfocused = false;
                    e.guiActiveUncommand = false;
                }

                foreach (BaseAction a in m.Actions)
                {
                    Log.dbg("disabling action {0}", a.guiName);
                    a.active = false;
                }
            }
        }
        private void disablePartEvents(Part p, bool isEvaEnabled)
        {
            foreach (BaseEvent e in p.Events)
            {
                // Everything not in the Black List will stay
                if (!EVENT_BLACKLIST.Contains(e.name))
                {
                    continue;
                }

                Log.dbg("disabling event {0} -- {1}", e.name, e.guiName);
                e.guiActive          = false;
                e.guiActiveUnfocused = false;
                e.guiActiveUncommand = false;
            }
        }
        public void disableEvaEvents(Vessel v, bool isEvaEnabled)
        {
            if (null == v.evaController)
            {
                return;
            }

            KerbalEVA evaCtl = v.evaController;

            foreach (BaseEvent e in evaCtl.Events)
            {
                Log.dbg("disabling event {0} -- {1}", e.name, e.guiName);
                e.guiActive          = false;
                e.guiActiveUnfocused = false;
                e.guiActiveUncommand = false;
            }
        }
        private void disablePartEvents(Part p, bool isEvaEnabled)
        {
            foreach (BaseEvent e in p.Events)
            {
                // Preserving the actions needed for EVA. These events should not be preserved if the Tourist can't EVA!
                if (isEvaEnabled && EVENT_WHITELIST.Contains(e.name))
                {
                    continue;
                }

                // Everything not in the Black List will stay
                if (!EVENT_BLACKLIST.Contains(e.name))
                {
                    continue;
                }

                Log.dbg("disabling event {0} -- {1}", e.name, e.guiName);
                e.guiActive          = false;
                e.guiActiveUnfocused = false;
                e.guiActiveUncommand = false;
            }
        }
Beispiel #5
0
        public IEnumerator deployChute(Vessel v, float paraglidingDeployDelay, float paraglidingChutePitch)
        {
            Log.detail("Priming chute - KSP14.RealChute");
            if (!v.evaController.part.Modules.Contains("RealChuteModule"))
            {
                Log.detail("No RealChuteModule!!! Oops...");
                yield  break;
            }
            Log.detail("checking chute module...");
            RealChuteModule chuteModule = (RealChuteModule)v.evaController.part.Modules["RealChuteModule"];

            Log.detail("deployment state: armed {0}; enabled: {1}", chuteModule.armed, chuteModule.enabled);
            //chuteModule.deploymentSafeState = ModuleParachute.deploymentSafeStates.UNSAFE; // FIXME: is it immediate???

            Log.detail("counting {0} sec...", paraglidingDeployDelay);
            yield return(new WaitForSeconds(paraglidingDeployDelay));             // 5 seconds to deploy chute. TODO: Make configurable

            Log.detail("Deploying chute");
            chuteModule.ActivateRC();

            // Set low forward pitch so uncontrolled kerbal doesn't gain lot of speed
            //chuteModule.chuteDefaultForwardPitch = paraglidingChutePitch;
        }