Exemple #1
0
 public void FixedUpdate()
 {
     if (!HighLogic.LoadedSceneIsFlight)
     {
         return;
     }
     if (shutdownUnder == true) //shut down a submerged engine
     {
         if (this.part.WaterContact && MPFunctions.findAltitude(this.part.transform) <= -1)
         {
             for (int i = this.part.Modules.Count - 1; i >= 0; --i)
             {
                 PartModule M = this.part.Modules[i];
                 if (M.isActiveAndEnabled)
                 {
                     if (M is ModuleEnginesFX)
                     {
                         ModuleEnginesFX E = M as ModuleEnginesFX;
                         if (!E.flameout)
                         {
                             E.Flameout("Flooded");
                             E.Shutdown();
                         }
                     }
                     if (M is ModuleEngines)
                     {
                         ModuleEngines F = M as ModuleEngines;
                         if (!F.flameout)
                         {
                             F.Flameout("Flooded");
                             F.Shutdown();
                         }
                     }
                 }
             }
         }
     }
     else
     {
         if (!this.part.WaterContact)
         {
             for (int i = this.part.Modules.Count - 1; i >= 0; --i)
             {
                 PartModule M = this.part.Modules[i];
                 {
                     if (M is ModuleEnginesFX)
                     {
                         ModuleEnginesFX E = M as ModuleEnginesFX;
                         if (!E.flameout)
                         {
                             E.Flameout("Engine out of the water");
                             E.Shutdown();
                         }
                     }
                     if (M is ModuleEngines)
                     {
                         ModuleEngines F = M as ModuleEngines;
                         if (!F.flameout)
                         {
                             F.Flameout("Engine out of the water");
                             F.Shutdown();
                         }
                     }
                 }
             }
         }
     }
 }