Jharakn

Untitled

May 10th, 2013
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. --Power Balancer mk2
  2.  
  3. local topGate = peripheral.wrap("top")
  4. local bottomGate = peripheral.wrap("bottom")
  5. local currentState = 0
  6.  
  7. math.randomseed(os.time())
  8.  
  9. while true do
  10. local bottomData = bottomGate.get()
  11. local topData = topGate.get()
  12.  
  13. if bottomData["Full Energy"] == false then
  14. redstone.setOutput("left", true)
  15. redstone.setOutput("right", true)
  16. if currentState ~= 1 then
  17. print("["..os.time().."] Lvl 1 power channel open")
  18. end
  19. currentState = 1
  20.  
  21. elseif bottomData["Full Energy"] == true and topData["Full Energy"] == false then
  22. redstone.setOutput("left", false)
  23. redstone.setOutput("right", true)
  24. if currentState ~= 2 then
  25. print("["..os.time().."] Lvl 1 & 2 power channels open")
  26. end
  27. currentState = 2
  28.  
  29. elseif bottomData["Full Energy"] == true and topData["Full Energy"] == true then
  30. redstone.setOutput("left", false)
  31. redstone.setOutput("right", false)
  32. if currentState ~= 3 then
  33. print("["..os.time().."] Lvl 1, 2 & 3 power channels open")
  34. end
  35. currentState = 3
  36.  
  37. end
  38.  
  39. local sleepTime = 30 + math.random(10)
  40. sleep(30)
  41.  
  42. end
Advertisement
Add Comment
Please, Sign In to add comment