Guest User

SimulateKerbal

a guest
Jan 7th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.91 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using UnityEngine;
  7.  
  8. namespace SimulateKerbl
  9. {
  10.     public class SimulateKerbalSeat : PartModule, IPartMassModifier
  11.     {
  12.         public bool kerbalInSeat = false;
  13.  
  14.         public float GetModuleMass(float defaultMass, ModifierStagingSituation sit)
  15.         {
  16.             return kerbalInSeat ? 0.09375f : 0f;
  17.         }
  18.  
  19.         public ModifierChangeWhen GetModuleMassChangeWhen()
  20.         {
  21.             return ModifierChangeWhen.FIXED;
  22.         }
  23.  
  24.         [KSPEvent(active = true, advancedTweakable = true, guiActive = false, guiActiveEditor = true, guiName = "Kerbal in Seat: False")]
  25.         public void ToggleWeight()
  26.         {
  27.             kerbalInSeat = !kerbalInSeat;
  28.             Events["ToggleWeight"].guiName = "Kerbal in Seat: " + (kerbalInSeat ? "True" : "False");
  29.         }
  30.     }
  31. }
Add Comment
Please, Sign In to add comment