Advertisement
Guest User

Untitled

a guest
Nov 21st, 2014
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.88 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using ippo;
  6. using UnityEngine;
  7. using KSP;
  8.  
  9. namespace coffeeman
  10. {
  11.     public class ModuleIntakeReliability : ippo.ModuleEngineReliability
  12.     {
  13.         ModuleResourceIntake intake;
  14.  
  15.         string screenname="Intake[ON]";
  16.  
  17.         public override string DebugName { get { return "Intake"; } }
  18.         public override string ScreenName { get { return screenname; } }
  19.         public override string FailureMessage { get { return "An intake has become clogged"; } }
  20.         public override string RepairMessage { get { return "You have repaired the intake"; } }
  21.         public override string FailGuiName { get { return "Overload intake"; } }
  22.         public override string EvaRepairGuiName { get { return "Repair intake"; } }
  23.         public override string MaintenanceString { get { return "Clean intake"; } }
  24.  
  25.         protected override void DI_Update ()
  26.         {
  27.             print ("DI UPDATE");
  28.         }
  29.  
  30.         public override bool PartIsActive()
  31.         {
  32.             // A intake is active if its not landed and in atmosphere
  33.             print("DANGIT checking for active");
  34.             print ("landed");
  35.             print (part.vessel.LandedOrSplashed);
  36.             print ("atm");
  37.             print (part.vessel.atmDensity);
  38.             print ("intakeenb");
  39.             print (intake.intakeEnabled);
  40.             if (!part.vessel.LandedOrSplashed & part.vessel.atmDensity>0 & intake.intakeEnabled){
  41.                 screenname = "Intake[ON]";
  42.             }else{
  43.                 screenname = "Intake[OFF]";
  44.             }
  45.             return !part.vessel.LandedOrSplashed & part.vessel.atmDensity>0 & intake.intakeEnabled;
  46.         }
  47.  
  48.         protected override void DI_Start(StartState state)
  49.         {
  50.             intake = this.part.Modules.OfType<ModuleResourceIntake>().Single();
  51.         }
  52.  
  53.  
  54.         protected override bool DI_FailBegin()
  55.         {
  56.             return true;
  57.         }
  58.  
  59.         protected override void DI_Disable()
  60.         {
  61.             intake.enabled = false;
  62.         }
  63.  
  64.  
  65.         protected override void DI_EvaRepair()
  66.         {
  67.             intake.enabled = true;          
  68.         }
  69.     }
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement