Advertisement
An93l0fD3ath

Reactor Control

Jul 12th, 2018
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.89 KB | None | 0 0
  1. local component = require("component")
  2. local rs = component.redstone
  3. local colors = require("colors")
  4. local sides = require("sides")
  5. local Reactor_1 = component.proxy(component.get("e8e8"))
  6.  
  7. local reactoroff
  8. local reactor1check
  9. local reactoron
  10. local MaxHeat = Reactor_1.getMaxHeat()
  11. local Safe = MaxHeat/2
  12. local Heat = Reactor_1.getHeat()
  13. print(MaxHeat)
  14. print(Safe)
  15.  
  16. reactoroff = function()
  17.   rs.setOutput(sides.up, 0)
  18.   os.sleep(1)
  19.   print("Reactor_Off")
  20.   reactor1check()
  21.   os.sleep(1)
  22. end
  23.  
  24.  
  25. reactor1check = function()
  26.  while Heat < Safe do
  27.     Heat = Reactor_1.getHeat()
  28.     print(Heat)
  29.     print(Safe)
  30.     print(MaxHeat)
  31.     os.sleep(1)
  32.     reactoron()
  33.   end
  34. end
  35.  
  36. reactoron = function()
  37.   if Heat < Safe then
  38.     rs.setOutput(sides.up, 253)
  39.     os.sleep(1)
  40.     print(Heat)
  41.     print("Reactor_On")
  42.     os.sleep(1)
  43.     reactor1check()
  44.   else
  45.     reactoroff()
  46.   end
  47. end
  48.  
  49.  
  50. reactoron()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement