Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function clearInv()
- --drop all non essential items [cobble, diorite, andesite ect..]
- for n=1,15 do
- p = turtle.getItemDetail(n)
- if p ~= nil then
- if p.name == "minecraft:cobblestone" or p.name == "minecraft:stone" then
- turtle.select(n)
- turtle.dropDown()
- end
- end
- end
- turtle.select(16)
- end
- function miniTunnel(l, b, t)
- for n=1,l do
- if b then
- while turtle.detect() do
- turtle.dig()
- os.sleep(0.5)
- end
- end
- if n % 8 == 3 and t then
- turtle.select(16)
- turtle.placeDown()
- clearInv()
- end
- turtle.forward()
- if b then
- --mine block above and below turtle [height of 3]
- while turtle.detectUp() or turtle.detectDown() do
- turtle.digUp()
- turtle.digDown()
- end
- end
- end
- end
- function checkSpace(m)
- clearInv()
- storage = 0
- for n=1,15 do
- p = turtle.getItemDetail(n)
- if p ~= nil then
- storage = storage + 1
- end
- end
- if storage >= 10 then
- --move back to start to drop off items if not at end
- if length ~= 1 then
- turtle.turnLeft()
- turtle.turnLeft()
- for n=1,m do
- turtle.forward()
- end
- for n=1,15 do
- turtle.select(n)
- turtle.dropDown()
- end
- turtle.turnLeft()
- turtle.turnLeft()
- for n=1,m do
- turtle.forward()
- end
- end
- end
- end
- function Tunnel(l, st)
- local length = tonumber(l)
- local tunnelLength = length
- local sideTunnels = tonumber(st) + 1
- local moved = 1
- while (turtle.detect() and length >= 1) or length >= 1 do
- --main tunnel section
- miniTunnel(1,true, false)
- turtle.turnLeft()
- miniTunnel(1,true, false)
- turtle.turnRight()
- turtle.turnRight()
- miniTunnel(1, false, false)
- miniTunnel(1, true, false)
- turtle.turnLeft()
- turtle.turnLeft()
- miniTunnel(1, false, false)
- turtle.turnRight()
- --check if torch needed
- if length % 3 == 1 then
- turtle.turnLeft()
- miniTunnel(sideTunnels, true, true)
- turtle.turnRight()
- turtle.turnRight()
- miniTunnel(sideTunnels, false, false)
- turtle.turnLeft()
- checkSpace(moved)
- turtle.turnRight()
- miniTunnel(sideTunnels, true, true)
- turtle.turnLeft()
- turtle.turnLeft()
- miniTunnel(sideTunnels, false, false)
- turtle.turnRight()
- checkSpace(moved)
- end
- length = length - 1
- moved = moved + 1
- end
- returnHome(tunnelLength)
- end
- function returnHome(l)
- clearInv()
- turtle.turnRight()
- turtle.turnRight()
- for n=1,l do
- turtle.forward()
- end
- for n=1,15 do
- turtle.select(n)
- turtle.dropDown()
- end
- end
- local tArgs = { ... }
- local size = tonumber( tArgs[1] )
- if #tArgs ~= 2 then
- print( "Usage: mine <length> <strip's length>" )
- return
- end
- local size = tonumber( tArgs[1] )
- if size < 1 then
- print( "Mine length must be positive" )
- return
- end
- size = tonumber( tArgs[2] )
- if size < 1 then
- print( "Strip length must be positive" )
- return
- end
- Tunnel(tArgs[1], tArgs[2])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement