Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function fuel ()
- if turtle.getFuelLevel() < 128 then
- turtle.refuel(16)
- end
- end
- function dig ()
- while turtle.detect() == true do
- turtle.dig()
- sleep(.5)
- end
- while turtle.detectUp() == true do
- turtle.digUp()
- sleep(.5)
- end
- end
- function move ()
- if turtle.detect() == false then
- turtle.up()
- if turtle.detect() == false then
- turtle.down()
- if turtle.detect() == false then
- turtle.turnRight()
- if turtle.detect() == true then
- turtle.turnLeft()
- mine()
- elseif turtle.detect() == false then
- turtle.turnLeft()
- turtle.turnLeft()
- if turtle.detect() == true then
- turtle.turnRight()
- mine()
- elseif turtle.detect() == false then
- turtle.turnRight()
- end
- end
- elseif turtle.detect() == true then
- mine()
- end
- elseif turtle.detect() == true then
- turtle.down()
- mine()
- end
- elseif turtle.detect() == true then
- mine()
- end
- turtle.forward()
- if turtle.detectDown() == false then
- turtle.select(3)
- turtle.placeDown()
- turtle.select(1)
- end
- end
- function mine ()
- fuel()
- if full() == true then
- return
- end
- dig()
- turtle.turnRight()
- dig()
- turtle.turnLeft()
- turtle.turnLeft()
- dig()
- turtle.turnRight()
- turtle.up()
- dig()
- turtle.turnRight()
- dig()
- turtle.turnLeft()
- turtle.turnLeft()
- dig()
- turtle.turnRight()
- turtle.down()
- dig()
- turtle.turnLeft()
- dig()
- turtle.turnRight()
- turtle.turnRight()
- dig()
- turtle.turnLeft()
- end
- function full ()
- if turtle.getItemCount(15) > 0 then
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.up()
- turtle.select(16)
- drop()
- end
- end
- function drop ()
- while turtle.compareDown(16) == false do
- turtle.forward()
- end
- for y = 4, 15, 1 do
- turtle.select(y)
- turtle.dropDown()
- end
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.forward()
- turtle.down()
- turtle.select(1)
- while x < 3 do
- x = x + 1
- print(x)
- on()
- end
- print("Press any key to continue")
- local event, key = os.pullEvent("key")
- print("Rebooting")
- os.reboot()
- end
- function torch ()
- for x = 0, 8, 1 do
- move()
- end
- if full() == true then
- return
- end
- turtle.turnRight()
- turtle.turnRight()
- turtle.select(2)
- turtle.place()
- turtle.select(1)
- turtle.turnRight()
- turtle.turnRight()
- end
- function on ()
- while true do
- torch()
- full()
- sleep(3)
- end
- end
- x = 0
- while true do
- on()
- end
Add Comment
Please, Sign In to add comment