コード例 #1
0
        bool OtherEngineModeActive()
        {
            string s;

            // Check to see if any other engine mode is on
            int cnt = 0;

            foreach (PartModule pm in part.Modules)   //change from part to partmodules
            {
                if (pm.moduleName == "ModuleEngines") //find partmodule engine on the part
                {
                    if (cnt == EngineIndex)
                    {
                        continue;
                    }
                    cnt++;
                    ModuleEngines em = pm as ModuleEngines;

                    bool deprived = em.CheckDeprived(.01, out s);
                    if (em.EngineIgnited == true && !em.flameout && !deprived)
                    {
                        oldEngineThrottle = em.requestedThrottle;
                        return(true);
                    }
                }
                if (pm.moduleName == "ModuleEnginesFX") //find partmodule engine on the part
                {
                    if (cnt == EngineIndex)
                    {
                        continue;
                    }
                    cnt++;
                    ModuleEnginesFX emfx = pm as ModuleEnginesFX;

                    bool deprived = emfx.CheckDeprived(.01, out s);
                    if (emfx.EngineIgnited == true && !emfx.flameout && !deprived)
                    {
                        oldEngineThrottle = emfx.requestedThrottle;
                        return(true);
                    }
                }
            }
            return(false);
        }