Advertisement
Moimus

OrbitalStrikePlatform

May 26th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.29 KB | None | 0 0
  1. public void Main(string argument, UpdateType updateSource)
  2. {
  3.     launch();
  4.  
  5. }
  6.  
  7.  
  8. List<IMyShipMergeBlock> getMerge()
  9. {
  10.      List<IMyTerminalBlock> blocks = new List<IMyTerminalBlock>();
  11.      GridTerminalSystem.GetBlocksOfType<IMyShipMergeBlock>(blocks);
  12.      List<IMyShipMergeBlock> mergeBlocks = new List<IMyShipMergeBlock>();
  13.      for(int n = 0; n < blocks.Count; n++)
  14.     {
  15.         if(blocks[n].CustomName.Equals("Decoupler"))
  16.         {
  17.             mergeBlocks.Add(blocks[n] as IMyShipMergeBlock);
  18.         }
  19.     }
  20.     return mergeBlocks;
  21. }
  22.  
  23. List<IMyTimerBlock> getRocketLaunchTimers()
  24. {
  25.      List<IMyTerminalBlock> blocks = new List<IMyTerminalBlock>();
  26.      GridTerminalSystem.GetBlocksOfType<IMyTimerBlock>(blocks);
  27.      List<IMyTimerBlock> timerBlocks = new List<IMyTimerBlock>();
  28.      for(int n = 0; n < blocks.Count; n++)
  29.     {
  30.         if(blocks[n].CustomName.Equals("RocketLaunch"))
  31.         {
  32.             timerBlocks.Add(blocks[n] as IMyTimerBlock);
  33.         }
  34.     }
  35.     return timerBlocks;
  36. }
  37.  
  38. void launch()
  39. {
  40.     List<IMyTimerBlock> timerBlocks = getRocketLaunchTimers();
  41.     float delay = 2.0f;
  42.     for(int n = 0; n < timerBlocks.Count; n++)
  43.     {
  44.         timerBlocks[n].TriggerDelay = delay;
  45.         delay += 2.0f;
  46.         timerBlocks[n].ApplyAction("Start");
  47.     }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement