Advertisement
Whiplash141

KAPUT Fire System

Jul 26th, 2015
678
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.97 KB | None | 0 0
  1. /*    
  2. WHIPLASH'S KAPUT SYSTEM SCRIPT - revision 2 - 7/19/15    
  3.     Torpedo 1
  4.    
  5. DESCRIPTION:    
  6. This script covers the launching system of the KAPUT weapon platform designed for the      
  7. Shortbow Torpedo Bomber    
  8.      
  9. - Whiplash141    
  10. */      
  11. static string torpedo_no = "1";    
  12. string forwardThrustName = "Forward Thrust - Torpedo - " + torpedo_no;      
  13. string maneuveringThrustersName = "Small Thruster - Maneuvering - " + torpedo_no;      
  14. string detachThrustName = "Small Thruster - Detach - " + torpedo_no;    
  15.  
  16. List<IMyTerminalBlock> forwardThrusters = new List<IMyTerminalBlock>();      
  17. List<IMyTerminalBlock> maneuveringThrusters = new List<IMyTerminalBlock>();    
  18. List<IMyTerminalBlock> Spaceballs = new List<IMyTerminalBlock>();    
  19. List<IMyTerminalBlock> detachThrusters = new List<IMyTerminalBlock>();  
  20.  
  21. int timeElapsed = 0;          
  22.      
  23. void Main()          
  24. {      
  25.     GridTerminalSystem.SearchBlocksOfName(detachThrustName,detachThrusters);    
  26.    
  27.     if (timeElapsed == 0)    
  28.     {    
  29.         for(int i = 0 ; i < detachThrusters.Count ; i++)  
  30.         {  
  31.             IMyThrust Thrust = detachThrusters[i] as IMyThrust;  
  32.             Thrust.ApplyAction("OnOff_On");  
  33.         }      
  34.         Echo("Detach Thrust On");    
  35.          
  36.     }else if(timeElapsed == 1){    
  37.         for(int i = 0 ; i < detachThrusters.Count ; i++)  
  38.         {  
  39.             IMyThrust Thrust = detachThrusters[i] as IMyThrust;  
  40.             Thrust.ApplyAction("OnOff_Off");  
  41.         }      
  42.         ThrusterOverride();    
  43.         ManeuveringThrust();    
  44.         Echo("Detach Thrust Off");    
  45.         Echo("Thruster Override On");    
  46.          
  47.     }else if(timeElapsed == 5){    
  48.         SpaceballMass();    
  49.         Echo("Spaceballs Mass Maxed");    
  50.     }    
  51.     timeElapsed++;    
  52.          
  53.     //debug    
  54.     Echo("Time Elapsed: " + timeElapsed);    
  55. }        
  56.          
  57. void ManeuveringThrust()    
  58. {    
  59.     GridTerminalSystem.SearchBlocksOfName(maneuveringThrustersName,maneuveringThrusters);    
  60.     for(int i = 0 ; i < maneuveringThrusters.Count ; i++)    
  61.     {    
  62.         IMyThrust Thrust = maneuveringThrusters[i] as IMyThrust;                  
  63.         Thrust.ApplyAction("OnOff_On");    
  64.     }    
  65. }    
  66.          
  67. void ThrusterOverride()    
  68. {    
  69.     GridTerminalSystem.SearchBlocksOfName(forwardThrustName,forwardThrusters);          
  70.     for(int i = 0; i < forwardThrusters.Count;i++)          
  71.     {          
  72.         IMyThrust Thrust = forwardThrusters[i] as IMyThrust;                  
  73.         Thrust.SetValue<float>("Override", float.MaxValue);          
  74.     }      
  75. }    
  76.      
  77. void SpaceballMass()    
  78. {              
  79.     GridTerminalSystem.GetBlocksOfType<IMySpaceBall>(Spaceballs);            
  80.     for (int i = 0; i < Spaceballs.Count; i++)      
  81.     {                      
  82.         Spaceballs[i].SetValueFloat("VirtualMass",float.MaxValue);          
  83.     }                
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement