Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local bank = peripheral.wrap("right")
- local monitor = peripheral.wrap("left")
- local chest = peripheral.wrap("top")
- function signalOn(direction)
- if chest.pullItemIntoSlot(direction,1,1,1) > 0 then
- print("sent signalbeans - signal ON")
- else
- print("beans failed")
- end
- end
- function signalOff(direction)
- if chest.pushItemIntoSlot(direction,1,1,1) > 0 then
- print("sent signalbeans - signal OFF")
- else
- print("beans failed")
- end
- end
- local signal = "top"
- function getPercent()
- local stored = bank.getEnergyStored("right")
- local maxRF = bank.getMaxEnergyStored("right")
- print(stored/maxRF)
- return stored/maxRF
- end
- --print("Current energy: "..tostring(stored).."/"..tostring(maxRF))
- function readyToFarm()
- print(percent)
- if chest.getStackInSlot(1) ~= nil then
- signalOff("west")
- end
- if getPercent() < 0.1 then
- print("less than 10% power, start farming")
- signalOn("west")
- --rs.setOutput(signal, true)
- while getPercent() < 0.95 do
- print("not 100% full")
- --rs.setOutput(signal, true)
- os.sleep(10)
- end
- signalOff("west")
- --rs.setOutput(signal, false)
- print("energy full, stop farming")
- readyToFarm()
- else
- rs.setOutput(signal, false)
- print("above 10% power, no need to farm")
- os.sleep(10)
- readyToFarm()
- end
- end
- readyToFarm()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement