Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- shell.run('clear')
- local arg1,arg2 = ...
- local length = 0
- local torch = false
- local torchcount = 0
- if (arg1 ~= nill) then
- length = arg1
- end
- if (arg2 ~= nill) then
- if (arg2 == "y") then
- torch = true
- end
- end
- local invalid = true
- function checkFuel()
- if turtle.getFuelLevel() < 100 then
- shell.run("refuel","all")
- end
- end
- function mineTunnel()
- checkFuel()
- if turtle.detect() then
- repeat turtle.dig() until turtle.forward()
- else
- repeat until turtle.forward()
- end
- if turtle.detectDown() then turtle.digDown() end
- if (torch == true) then
- torchcount = torchcount + 1
- if (torchcount == 7) then
- turtle.select(1)
- turtle.placeDown()
- torchcount = 0
- end
- end
- while turtle.detectUp() do
- turtle.digUp()
- sleep(0.5)
- end
- end
- if (length == 0) then
- repeat
- print( "How many blocks to mine?" )
- length = tonumber(io.read())
- if (length == 0) then
- shell.run('clear')
- print( "Entry must be larger than " .. length .. ".")
- invalid = true
- end
- if (length > 0) then
- invalid = false
- end
- until invalid == false
- end
- shell.run('clear')
- for i=1,3 do
- mineTunnel()
- end
- turtle.turnLeft()
- for i=1,length do
- mineTunnel()
- end
- turtle.turnLeft()
- for i=1,2 do
- mineTunnel()
- end
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.forward()
- turtle.forward()
- for i=1,3 do
- mineTunnel()
- end
- turtle.turnRight()
- torchcount = 0
- for i=1,length do
- mineTunnel()
- end
- turtle.turnRight()
- for i=1,2 do
- mineTunnel()
- end
- turtle.turnRight()
- turtle.turnRight()
- turtle.forward()
- turtle.forward()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement