Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tunnelLength = 50
- local length = 50
- local currentTunnelLength = 0
- local currentLength = 0
- function refuel()
- for i=1,15,1 do
- turtle.select(i)
- if(turtle.getFuelLevel() < (length*3)+tunnelLength) then
- while (turtle.refuel(1) and turtle.getFuelLevel() < (length*3)+tunnelLength) do
- end
- end
- end
- end
- function foundEmptySlots()
- foundEmpty = 0
- for i=1,15,1 do
- if(turtle.getItemCount(i) == 0) then
- foundEmpty = foundEmpty + 1
- end
- end
- if(turtle.getItemCount(16) == 0) then
- foundEmpty = -1
- end
- return foundEmpty
- end
- function mine()
- while(currentTunnelLength < tunnelLength) do
- refuel()
- if(currentTunnelLength%3==0) then
- turtle.turnLeft()
- while(currentLength < length) do
- turtle.dig()
- moveForward()
- turtle.digUp()
- currentLength = currentLength+1
- end
- turtle.turnLeft()
- turtle.turnLeft()
- while(currentLength > 0) do
- moveForward()
- if(currentLength%8==0) then
- turtle.select(16)
- turtle.placeUp()
- turtle.select(1)
- end
- currentLength = currentLength-1
- end
- while(currentLength < length) do
- turtle.dig()
- moveForward()
- turtle.digUp()
- currentLength = currentLength+1
- end
- turtle.turnLeft()
- turtle.turnLeft()
- while(currentLength > 0) do
- moveForward()
- if(currentLength%8==0) then
- turtle.select(16)
- turtle.placeUp()
- turtle.select(1)
- end
- currentLength = currentLength-1
- end
- turtle.turnRight()
- empties = foundEmptySlots()
- if(empties < 3 or empties == -1) then
- turtle.turnLeft()
- turtle.turnLeft()
- for i=1,currentTunnelLength,1 do
- moveForward()
- end
- for i=1,15,1 do
- turtle.select(i)
- turtle.drop()
- end
- while(foundEmptySlots() == -1) do
- print("Waiting for Torches: ")
- end
- turtle.turnLeft()
- turtle.turnLeft()
- for i=1,currentTunnelLength,1 do
- moveForward()
- end
- end
- end
- turtle.dig()
- moveForward()
- turtle.digUp()
- currentTunnelLength = currentTunnelLength + 1
- end
- turtle.turnLeft()
- turtle.turnLeft()
- while(currentTunnelLength > 0) do
- moveForward()
- currentTunnelLength = currentTunnelLength - 1
- end
- end
- function moveForward()
- while not turtle.forward() do turtle.attack() end
- end
- function moveDown()
- while not turtle.down() do turtle.attackDown() end
- end
- print("TunnelLength:")
- tunnelLength = tonumber(read())
- print("Length:")
- length = tonumber(read())
- mine()
Advertisement
Add Comment
Please, Sign In to add comment