xilyflob

OnOff

Oct 7th, 2016
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 10.51 KB | None | 0 0
  1. reactorID = 52
  2.  
  3. turbine1 = peripheral.wrap("BigReactors-Turbine_0")
  4. turbine2 = peripheral.wrap("BigReactors-Turbine_1")
  5. turbine3 = peripheral.wrap("BigReactors-Turbine_2")
  6. turbine4 = peripheral.wrap("BigReactors-Turbine_3")
  7. turbine5 = peripheral.wrap("BigReactors-Turbine_4")
  8. turbine6 = peripheral.wrap("BigReactors-Turbine_5")
  9. turbine7 = peripheral.wrap("BigReactors-Turbine_6")
  10. turbine8 = peripheral.wrap("BigReactors-Turbine_7")
  11. turbine9 = peripheral.wrap("BigReactors-Turbine_8")
  12. turbine10 = peripheral.wrap("BigReactors-Turbine_9")
  13. turbine11 = peripheral.wrap("BigReactors-Turbine_12")
  14. turbine12 = peripheral.wrap("BigReactors-Turbine_13")
  15. turbine13 = peripheral.wrap("BigReactors-Turbine_14")
  16. turbine14 = peripheral.wrap("BigReactors-Turbine_15")
  17. turbine15 = peripheral.wrap("BigReactors-Turbine_16")
  18. turbine16 = peripheral.wrap("BigReactors-Turbine_17")
  19. turbine17 = peripheral.wrap("BigReactors-Turbine_19")
  20. turbine18 = peripheral.wrap("BigReactors-Turbine_20")
  21. turbine19 = peripheral.wrap("BigReactors-Turbine_21")
  22. turbine20 = peripheral.wrap("BigReactors-Turbine_22")
  23. turbine21 = peripheral.wrap("BigReactors-Turbine_23")
  24. turbine22 = peripheral.wrap("BigReactors-Turbine_24")
  25. turbine23 = peripheral.wrap("BigReactors-Turbine_25")
  26. turbine24 = peripheral.wrap("BigReactors-Turbine_26")
  27. turbine25 = peripheral.wrap("BigReactors-Turbine_27")
  28.  
  29.  
  30. while true do
  31.     write("Startup or Shutdown? ")
  32.     local response = read()
  33.     if string.lower(response) == "startup" then
  34.         rednet.send(reactorID, "startup")
  35.         local senderID, message, protocol = rednet.receive()
  36.         if senderID == reactorID and message == "OK" then
  37.             print("Starting Reactor...")
  38.         else print("Reactor already running.")
  39.         end
  40.         sleep(0.5)
  41.         if turbine1.getActive() == false then
  42.             turbine1.setActive(true)
  43.             print("Starting Turbine 1...")
  44.         else print("Turbine 1 already running.")
  45.         end
  46.         sleep(0.5)
  47.         if turbine2.getActive() == false then
  48.             turbine2.setActive(true)
  49.             print("Starting Turbine 2...")
  50.         else print("Turbine 2 already running.")
  51.         end
  52.         sleep(0.5)
  53.         if turbine3.getActive() == false then
  54.             turbine3.setActive(true)
  55.             print("Starting Turbine 3...")
  56.         else print("Turbine 3 already running.")
  57.         end
  58.         sleep(0.5)
  59.         if turbine4.getActive() == false then
  60.             turbine4.setActive(true)
  61.             print("Starting Turbine 4...")
  62.         else print("Turbine 4 already running.")
  63.         end
  64.         sleep(0.5)
  65.         if turbine5.getActive() == false then
  66.             turbine5.setActive(true)
  67.             print("Starting Turbine 5...")
  68.         else print("Turbine 5 already running.")
  69.         end
  70.         sleep(0.5)
  71.         if turbine6.getActive() == false then
  72.             turbine6.setActive(true)
  73.             print("Starting Turbine 6...")
  74.         else print("Turbine 6 already running.")
  75.         end
  76.         sleep(0.5)
  77.         if turbine7.getActive() == false then
  78.             turbine7.setActive(true)
  79.             print("Starting Turbine 7...")
  80.         else print("Turbine 7 already running.")
  81.         end
  82.         sleep(0.5)
  83.         if turbine8.getActive() == false then
  84.             turbine8.setActive(true)
  85.             print("Starting Turbine 8...")
  86.         else print("Turbine 8 already running.")
  87.         end
  88.         sleep(0.5)
  89.         if turbine9.getActive() == false then
  90.             turbine9.setActive(true)
  91.             print("Starting Turbine 9...")
  92.         else print("Turbine 9 already running.")
  93.         end
  94.         sleep(0.5)
  95.         if turbine10.getActive() == false then
  96.             turbine10.setActive(true)
  97.             print("Starting Turbine 10...")
  98.         else print("Turbine 10 already running.")
  99.         end
  100.         sleep(0.5)
  101.         if turbine11.getActive() == false then
  102.             turbine11.setActive(true)
  103.             print("Starting Turbine 11...")
  104.         else print("Turbine 11 already running.")
  105.         end
  106.         sleep(0.5)
  107.         if turbine12.getActive() == false then
  108.             turbine12.setActive(true)
  109.             print("Starting Turbine 12...")
  110.         else print("Turbine 12 already running.")
  111.         end
  112.         sleep(0.5)
  113.         if turbine13.getActive() == false then
  114.             turbine13.setActive(true)
  115.             print("Starting Turbine 13...")
  116.         else print("Turbine 13 already running.")
  117.         end
  118.         sleep(0.5)
  119.         if turbine14.getActive() == false then
  120.             turbine14.setActive(true)
  121.             print("Starting Turbine 14...")
  122.         else print("Turbine 14 already running.")
  123.         end
  124.         sleep(0.5)
  125.         if turbine15.getActive() == false then
  126.             turbine15.setActive(true)
  127.             print("Starting Turbine 15...")
  128.         else print("Turbine 15 already running.")
  129.         end
  130.         sleep(0.5)
  131.         if turbine16.getActive() == false then
  132.             turbine16.setActive(true)
  133.             print("Starting Turbine 16...")
  134.         else print("Turbine 16 already running.")
  135.         end
  136.         sleep(0.5)
  137.         if turbine17.getActive() == false then
  138.             turbine17.setActive(true)
  139.             print("Starting Turbine 17...")
  140.         else print("Turbine 17 already running.")
  141.         end
  142.         sleep(0.5)
  143.         if turbine18.getActive() == false then
  144.             turbine18.setActive(true)
  145.             print("Starting Turbine 18...")
  146.         else print("Turbine 18 already running.")
  147.         end
  148.         sleep(0.5)
  149.         if turbine19.getActive() == false then
  150.             turbine19.setActive(true)
  151.             print("Starting Turbine 19...")
  152.         else print("Turbine 19 already running.")
  153.         end
  154.         sleep(0.5)
  155.         if turbine20.getActive() == false then
  156.             turbine20.setActive(true)
  157.             print("Starting Turbine 20...")
  158.         else print("Turbine 20 already running.")
  159.         end
  160.         sleep(0.5)
  161.         if turbine21.getActive() == false then
  162.             turbine21.setActive(true)
  163.             print("Starting Turbine 21...")
  164.         else print("Turbine 21 already running.")
  165.         end
  166.         sleep(0.5)
  167.         if turbine22.getActive() == false then
  168.             turbine22.setActive(true)
  169.             print("Starting Turbine 22...")
  170.         else print("Turbine 22 already running.")
  171.         end
  172.         sleep(0.5)
  173.         if turbine23.getActive() == false then
  174.             turbine23.setActive(true)
  175.             print("Starting Turbine 23...")
  176.         else print("Turbine 23 already running.")
  177.         end
  178.         sleep(0.5)
  179.         if turbine24.getActive() == false then
  180.             turbine24.setActive(true)
  181.             print("Starting Turbine 24...")
  182.         else print("Turbine 24 already running.")
  183.         end
  184.         sleep(0.5)
  185.         if turbine25.getActive() == false then
  186.             turbine25.setActive(true)
  187.             print("Starting Turbine 25...")
  188.         else print("Turbine 25 already running.")
  189.         end
  190.         sleep(0.5)
  191.         print("Startup complete.")
  192.     elseif string.lower(response) == "shutdown" then
  193.         rednet.send(reactorID, "shutdown")
  194.         local senderID, message, protocol = rednet.receive()
  195.         if senderID == reactorID and message == "OK" then
  196.             print("Stopping Reactor...")
  197.         else print("Reactor already offline.")
  198.         end
  199.         sleep(0.5)
  200.         if turbine1.getActive() == true then
  201.             turbine1.setActive(false)
  202.             print("Stopping Turbine 1...")
  203.         else print("Turbine 1 already offline.")
  204.         end
  205.         sleep(0.5)
  206.         if turbine2.getActive() == true then
  207.             turbine2.setActive(false)
  208.             print("Stopping Turbine 2...")
  209.         else print("Turbine 2 already offline.")
  210.         end
  211.         sleep(0.5)
  212.         if turbine3.getActive() == true then
  213.             turbine3.setActive(false)
  214.             print("Stopping Turbine 3...")
  215.         else print("Turbine 3 already offline.")
  216.         end
  217.         sleep(0.5)
  218.         if turbine4.getActive() == true then
  219.             turbine4.setActive(false)
  220.             print("Stopping Turbine 4...")
  221.         else print("Turbine 4 already offline.")
  222.         end
  223.         sleep(0.5)
  224.         if turbine5.getActive() == true then
  225.             turbine5.setActive(false)
  226.             print("Stopping Turbine 5...")
  227.             else print("Turbine 5 already offline.")
  228.         end
  229.         sleep(0.5)
  230.         if turbine6.getActive() == true then
  231.             turbine6.setActive(false)
  232.             print("Stopping Turbine 6...")
  233.         else print("Turbine 6 already offline.")
  234.         end
  235.         sleep(0.5)
  236.         if turbine7.getActive() == true then
  237.             turbine7.setActive(false)
  238.             print("Stopping Turbine 7...")
  239.         else print("Turbine 7 already offline.")
  240.         end
  241.         sleep(0.5)
  242.         if turbine8.getActive() == true then
  243.             turbine8.setActive(false)
  244.             print("Stopping Turbine 8...")
  245.         else print("Turbine 8 already offline.")
  246.         end
  247.         sleep(0.5)
  248.         if turbine9.getActive() == true then
  249.             turbine9.setActive(false)
  250.             print("Stopping Turbine 9...")
  251.         else print("Turbine 9 already offline.")
  252.         end
  253.         sleep(0.5)
  254.         if turbine10.getActive() == true then
  255.             turbine10.setActive(false)
  256.             print("Stopping Turbine 10...")
  257.         else print("Turbine 10 already offline.")
  258.         end
  259.         sleep(0.5)
  260.         if turbine11.getActive() == true then
  261.             turbine11.setActive(false)
  262.             print("Stopping Turbine 11...")
  263.         else print("Turbine 11 already offline.")
  264.         end
  265.         sleep(0.5)
  266.         if turbine12.getActive() == true then
  267.             turbine12.setActive(false)
  268.             print("Stopping Turbine 12...")
  269.         else print("Turbine 12 already offline.")
  270.         end
  271.         sleep(0.5)
  272.         if turbine13.getActive() == true then
  273.             turbine13.setActive(false)
  274.             print("Stopping Turbine 13...")
  275.         else print("Turbine 13 already offline.")
  276.         end
  277.         sleep(0.5)
  278.         if turbine14.getActive() == true then
  279.             turbine14.setActive(false)
  280.             print("Stopping Turbine 14...")
  281.         else print("Turbine 14 already offline.")
  282.         end
  283.         sleep(0.5)
  284.         if turbine15.getActive() == true then
  285.             turbine15.setActive(false)
  286.             print("Stopping Turbine 15...")
  287.         else print("Turbine 15 already offline.")
  288.         end
  289.         sleep(0.5)
  290.         if turbine16.getActive() == true then
  291.             turbine16.setActive(false)
  292.             print("Stopping Turbine 16...")
  293.         else print("Turbine 16 already offline.")
  294.         end
  295.         sleep(0.5)
  296.         if turbine17.getActive() == true then
  297.             turbine17.setActive(false)
  298.             print("Stopping Turbine 17...")
  299.         else print("Turbine 17 already offline.")
  300.         end
  301.         sleep(0.5)
  302.         if turbine18.getActive() == true then
  303.             turbine18.setActive(false)
  304.             print("Stopping Turbine 18...")
  305.         else print("Turbine 18 already offline.")
  306.         end
  307.         sleep(0.5)
  308.         if turbine19.getActive() == true then
  309.             turbine19.setActive(false)
  310.             print("Stopping Turbine 19...")
  311.         else print("Turbine 19 already offline.")
  312.         end
  313.         sleep(0.5)
  314.         if turbine20.getActive() == true then
  315.             turbine20.setActive(false)
  316.             print("Stopping Turbine 20...")
  317.         else print("Turbine 20 already offline.")
  318.         end
  319.         sleep(0.5)
  320.         if turbine21.getActive() == true then
  321.             turbine21.setActive(false)
  322.             print("Stopping Turbine 21...")
  323.         else print("Turbine 21 already offline.")
  324.         end
  325.         sleep(0.5)
  326.         if turbine22.getActive() == true then
  327.             turbine22.setActive(false)
  328.             print("Stopping Turbine 22...")
  329.         else print("Turbine 22 already offline.")
  330.         end
  331.         sleep(0.5)
  332.         if turbine23.getActive() == true then
  333.             turbine23.setActive(false)
  334.             print("Stopping Turbine 23...")
  335.         else print("Turbine 23 already offline.")
  336.         end
  337.         sleep(0.5)
  338.         if turbine24.getActive() == true then
  339.             turbine24.setActive(false)
  340.             print("Stopping Turbine 24...")
  341.         else print("Turbine 24 already offline.")
  342.         end
  343.         sleep(0.5)
  344.         if turbine25.getActive() == true then
  345.             turbine25.setActive(false)
  346.             print("Stopping Turbine 25...")
  347.         else print("Turbine 25 already offline.")
  348.         end
  349.         sleep(0.5)
  350.         print("Shutdown complete.")
  351.     else print("Please try again.")
  352.     end
  353. end
Add Comment
Please, Sign In to add comment