Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- baleTunnel length tunnels gap
- --
- -- OOOOOOOOOOOOOOO
- -- C C C
- -- T t t
- -- OXXXOOXXXOOXXXO
- -- OXXXOOXXXOOXXXO
- -- OXXXOOXXXOOXXXO
- -- ---
- -- O - Unmined block
- -- C - Chest
- -- T - Turtle starting point
- -- t - Turtle starting points of subsequent tunnels beyond the first
- -- X - Desgnated for mining
- -- ---
- -- The concept behind this is to have the turtle do the lion's share of mining and to manually spot
- -- check the unmined blocks that are remaining. A very effective method is to work in tandem with two
- -- turtles in the following manner:
- --
- -- OXXXOOXXXOOXXXO
- -- OXXXOOXXXOOXXXO
- -- OXXXOOXXXOOXXXO
- -- t t T
- -- C C C
- -- T t t
- -- OXXXOOXXXOOXXXO
- -- OXXXOOXXXOOXXXO
- -- OXXXOOXXXOOXXXO
- -- ---
- -- Two directions are mined at the same time while you mine along with them, cleaning the floors,
- -- ceilings, and walls in between.
- local tArgs = { ... }
- length = tonumber(tArgs[1]) or 24
- tunnels = tonumber(tArgs[2]) or 1
- gap = tonumber(tArgs[3]) or 2
- gap = gap + 3 -- takes into account tunnel width
- counter = 0
- function betterDig()
- success = false
- while turtle.detect() do
- if turtle.dig() then
- success = true
- counter = counter + 1
- elseif turtle.attack() then
- else
- return success
- end
- -- waits for falling blocks
- sleep(.5)
- end
- return success
- end
- function betterDigUp()
- success = false
- while turtle.detectUp() do
- if turtle.digUp() then
- success = true
- counter = counter + 1
- elseif turtle.attackUp() then
- else
- return success
- end
- -- waits for falling blocks
- sleep(.5)
- end
- return success
- end
- function digLeftRight()
- turtle.turnLeft()
- betterDig()
- turtle.turnRight()
- turtle.turnRight()
- betterDig()
- turtle.turnLeft()
- end
- function digForward()
- betterDig()
- turtle.forward()
- end
- function digUp()
- betterDigUp()
- turtle.up()
- end
- function returnHome()
- turtle.turnLeft()
- turtle.turnLeft()
- for i = 1,length do
- turtle.forward()
- end
- end
- function placeTorch()
- turtle.select(16)
- turtle.turnRight()
- turtle.place()
- turtle.turnLeft()
- turtle.select(1)
- end
- for t = 1,tunnels do
- for i = 1,length do
- digForward()
- digUp()
- digUp()
- digLeftRight()
- turtle.down()
- digLeftRight()
- turtle.down()
- digLeftRight()
- if i%8 == 0 then
- placeTorch()
- end
- end
- returnHome()
- for i = 1,15 do
- if turtle.getItemCount(i) > 0 then
- turtle.select(i)
- turtle.drop()
- end
- end
- if t < tunnels then
- turtle.turnRight()
- for i = 1,gap do
- digForward()
- end
- turtle.turnRight()
- end
- end
- print("Job's done.")
- print(counter .. " total blocks mined.")
Advertisement
Add Comment
Please, Sign In to add comment