Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Power Balancer mk2
- local topGate = peripheral.wrap("top")
- local bottomGate = peripheral.wrap("bottom")
- local currentState = 0
- math.randomseed(os.time())
- while true do
- local bottomData = bottomGate.get()
- local topData = topGate.get()
- if bottomData["Full Energy"] == false then
- redstone.setOutput("left", true)
- redstone.setOutput("right", true)
- if currentState ~= 1 then
- print("["..os.time().."] Lvl 1 power channel open")
- end
- currentState = 1
- elseif bottomData["Full Energy"] == true and topData["Full Energy"] == false then
- redstone.setOutput("left", false)
- redstone.setOutput("right", true)
- if currentState ~= 2 then
- print("["..os.time().."] Lvl 1 & 2 power channels open")
- end
- currentState = 2
- elseif bottomData["Full Energy"] == true and topData["Full Energy"] == true then
- redstone.setOutput("left", false)
- redstone.setOutput("right", false)
- if currentState ~= 3 then
- print("["..os.time().."] Lvl 1, 2 & 3 power channels open")
- end
- currentState = 3
- end
- local sleepTime = 30 + math.random(10)
- sleep(30)
- end
Advertisement
Add Comment
Please, Sign In to add comment