TitanChase

Untitled

Mar 28th, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. function startReactor()
  2. while true do
  3. reactor = peripheral.wrap("back");
  4. if reactor ~= nil then
  5. if reactor.getConnected() then
  6. if reactor.getEnergyStored() > 4000000 then
  7. print("At 4000000RF Turning Off")
  8. reactor.setActive(false);
  9. end
  10. if reactor.getEnergyStored() < 1000000 then
  11. print("At 1000000RF Turning On")
  12. reactor.setActive(true);
  13. end
  14. end
  15. end
  16. sleep(0);
  17. end
  18. end
  19.  
  20. quit = false
  21.  
  22. function quitProgram()
  23. local event, name = os.pullEvent("quit")
  24. if name == "powerMonitor" then
  25. quit = true
  26. end
  27. end
  28.  
  29. while true do
  30. parallel.waitForAny(quitProgram, startReactor)
  31.  
  32. if quit then
  33. print("Quitting....")
  34. break
  35. end
  36. end
Add Comment
Please, Sign In to add comment