SHARE
TWEET

Untitled

a guest Feb 14th, 2020 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public Program() {
  2.    Runtime.UpdateFrequency = UpdateFrequency.Update100;
  3. }
  4. public void Save() {
  5. // Called to save its state to the Storage field
  6. }
  7.  
  8. int count=0;
  9. bool jobActive=false;
  10.  
  11. public void Main(string argument, UpdateType updateSource) {
  12.    
  13.    if(!jobActive) {
  14.    IMySensorBlock sensor1;
  15.    sensor1 = GridTerminalSystem.GetBlockWithName("ReloadSensor1") as IMySensorBlock;  
  16.    if(!sensor1.IsActive) {
  17.        IMyProgrammableBlock pistonControlBlock = GridTerminalSystem.GetBlockWithName("PistonControl PB") as IMyProgrammableBlock;
  18.        pistonControlBlock.TryRun("-g Reload -s 5.0 -p 0.0");
  19.        jobActive = true;
  20.    } else {
  21.    IMySensorBlock sensor2 = GridTerminalSystem.GetBlockWithName("ReloadSensor2") as IMySensorBlock;
  22.    if(!sensor2.IsActive) {
  23.        IMyProgrammableBlock pistonControlBlock = GridTerminalSystem.GetBlockWithName("PistonControl PB") as IMyProgrammableBlock;
  24.        pistonControlBlock.TryRun("-g Reload -s 5.0 -p 2.5");
  25.        jobActive = true;
  26.    } else {
  27.    IMySensorBlock sensor3 = GridTerminalSystem.GetBlockWithName("ReloadSensor3") as IMySensorBlock;
  28.    if(!sensor3.IsActive) {
  29.        IMyProgrammableBlock pistonControlBlock = GridTerminalSystem.GetBlockWithName("PistonControl PB") as IMyProgrammableBlock;
  30.        pistonControlBlock.TryRun("-g Reload -s 5.0 -p 5.0");
  31.        jobActive = true;
  32.    } else {
  33.    IMySensorBlock sensor4 = GridTerminalSystem.GetBlockWithName("ReloadSensor4") as IMySensorBlock;
  34.    if(!sensor4.IsActive) {
  35.        IMyProgrammableBlock pistonControlBlock = GridTerminalSystem.GetBlockWithName("PistonControl PB") as IMyProgrammableBlock;
  36.        pistonControlBlock.TryRun("-g Reload -s 5.0 -p 7.5");
  37.        jobActive = true;
  38.    } else {  
  39.    IMySensorBlock sensor5 = GridTerminalSystem.GetBlockWithName("ReloadSensor5") as IMySensorBlock;
  40.    if(!sensor5.IsActive) {
  41.        IMyProgrammableBlock pistonControlBlock = GridTerminalSystem.GetBlockWithName("PistonControl PB") as IMyProgrammableBlock;
  42.        pistonControlBlock.TryRun("-g Reload -s 5.0 -p 10.0");
  43.        jobActive = true;
  44.    }
  45.    }
  46. }
  47. }
  48. }
  49. } else {
  50. if(count >= 21) {
  51.    jobActive = false;
  52. count=0;
  53. }
  54. }
  55. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top