Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function checkForGravel()
- local block = turtle.detect(front)
- if(block == true) then
- while(turtle.detect(front) == true) do
- turtle.dig()
- end
- end
- end
- function tunnel()
- turtle.dig()
- checkForGravel()
- turtle.forward()
- turtle.turnLeft()
- turtle.dig()
- checkForGravel()
- turtle.forward()
- turtle.digUp()
- turtle.up()
- turtle.digUp()
- turtle.up()
- turtle.turnRight()
- turtle.turnRight()
- turtle.dig()
- checkForGravel()
- turtle.forward()
- turtle.dig()
- checkForGravel()
- turtle.forward()
- turtle.digDown()
- turtle.down()
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.dig()
- turtle.digDown()
- turtle.down()
- turtle.forward()
- turtle.turnRight()
- end
- local count = 0
- local back_count = 0
- local torch = 0
- rednet.open("left")
- local sender, message, protocol = rednet.receive("miner")
- print(message)
- local start = true
- while(start) do
- if message == "start" then
- start = false
- end
- end
- while(turtle.getItemCount(1) > 0) do
- while(turtle.getItemCount(16) <= 0) do
- print("I have traveled " .. count + 1 .. " blocks")
- tunnel()
- if (torch == 6) then
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.select(1)
- turtle.place()
- turtle.turnLeft()
- turtle.turnLeft()
- torch = 0
- print("Placing a torch")
- end
- count = count + 1
- torch = torch + 1
- print("I have dug out " .. count * 9 .. " blocks")
- if(turtle.getFuelLevel() == 0) then
- print("Refueling!")
- turtle.refuel()
- print("Fuel level at " .. turtle.getFuelLevel())
- end
- end
- turtle.turnRight()
- turtle.turnRight()
- print("Time to go back " .. count .. " blocks")
- turtle.up()
- back_count = count
- while(count > 0) do
- turtle.forward()
- count = count - 1
- end
- turtle.down()
- for i=16,3,-1 do
- turtle.select(i)
- turtle.drop()
- end
- turtle.turnRight()
- turtle.turnRight()
- turtle.up()
- while(back_count > 0) do
- turtle.forward()
- back_count = back_count - 1
- end
- turtle.down()
- end
- print("All done!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement