Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function SwitchREC()
- if not turtle.attack() then
- print "Couldn't dismantle the Redstone Energy Cell"
- return false
- end
- sleep(1)
- if not turtle.place() then
- print "Couldn't place a Redstone Energy Cell"
- return false
- end
- tries = 0
- while not turtle.suckDown() do
- sleep(1)
- tries = tries + 1
- if tries>10 then
- print "Couldn't get the Redstone Energy Cell from the inventory under me"
- return false
- end
- end
- return true
- end
- function CheckRefuel()
- if turtle.getFuelLevel() < 5000 then
- print "Refueling"
- turtle.select(2)
- if not turtle.suckUp() then
- print "Couldn't find any (fuel)items in the inventory above me"
- return false
- end
- if not turtle.refuel() then
- print "Couldn't use the items I got from the inventory above me to refuel"
- return false
- end
- turtle.select(1)
- end
- return true
- end
- function Tele()
- if not peripheral.call("back", "teleport") then
- print "Teleporting failed"
- return false
- end
- sleep(1)
- return true
- end
- function WaitUntilFull()
- print "Waiting for a full Redstone Energy Cell"
- while not peripheral.call("right", "get")["Full Energy"] do
- sleep(10)
- end
- end
- function WaitUntilEmpty()
- print "Waiting for an empty Redstone Energy Cell"
- while not peripheral.call("right", "get")["No Energy"] do
- sleep(10)
- end
- end
- while true do
- WaitUntilFull()
- if not SwitchREC() then
- break
- end
- if not CheckRefuel() then
- break
- end
- if not Tele() then
- break
- end
- WaitUntilEmpty()
- if not SwitchREC() then
- break
- end
- if not Tele() then
- break
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement