Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Created by: pastebin.com/u/Gamboodle
- --Edited by: pastebin.com/u/AlexanderHaffer
- --Version: 1.2.4 e2
- term.clear()
- term.setCursorPos(1,1)
- print("Please ensure that the turtle has enough fuel!")
- print("Current fuel level: " .. turtle.getFuelLevel())
- print("Maximum fuel levels are 20k for a regular and 100k for a mining turtle.")
- sleep(5)
- term.clear()
- term.setCursorPos(1,1)
- io.write("Select 'quarry' or 'bore': ")
- quarrybore = io.read()
- term.clear()
- term.setCursorPos(1,1)
- io.write("Blocks forward: ")
- rows = io.read()
- io.write("Blocks sideways: ")
- columns = io.read()
- iniY = 2
- limitY = 5
- if quarrybore == "quarry" then
- term.clear()
- term.setCursorPos(1,1)
- io.write("Current 'y' level: ")
- iniY = io.read()
- term.clear()
- term.setCursorPos(1,1)
- io.write("Lowest 'y' level: ")
- limitY = io.read()
- end
- term.clear()
- term.setCursorPos(1,1)
- io.write("Toss garbage blocks like Cobblestone?")
- io.write("Select 'yes' or 'no': ")
- tossGarbage = io.read()
- term.clear()
- term.setCursorPos(1,1)
- posX = 0
- posY = 0
- posZ = 0
- rotation = 0
- fullSlots = 0
- function info()
- term.clear()
- term.setCursorPos(1,1)
- print("---------------------------------------")
- print("Mining size: " .. rows .. " by " .. columns)
- print("Mining down to level " .. limitY)
- -- print("Total distance: " .. posX + posY + posZ)
- -- print("X: " .. posX)
- -- print("Y: " .. posY)
- -- print("Z: " .. posZ)
- -- print("Orientation: " .. rotation)
- if tossGarbage == "yes" then
- print("Tossing garbage.")
- else
- print("Keeping garbage.")
- end
- print("")
- print("Fuel level: " .. turtle.getFuelLevel())
- end
- function rotate()
- if rotation == 0 then
- turtle.turnLeft()
- elseif rotation == 1 then
- turtle.turnLeft()
- turtle.turnLeft()
- elseif rotation == 2 then
- turtle.turnRight()
- end
- end
- function recover()
- rotate()
- local step = 0
- for step = posY - 1, 0, -1 do
- turtle.up()
- end
- for step = posX - 1, 0, -1 do
- turtle.forward()
- end
- turtle.turnLeft()
- for step = posZ - 1, 0, -1 do
- turtle.forward()
- end
- end
- function resume()
- turtle.turnLeft()
- turtle.turnLeft()
- local step = 0
- for step = 0, posZ - 1, 1 do
- turtle.forward()
- end
- turtle.turnRight()
- for step = 0, posX - 1, 1 do
- turtle.forward()
- end
- for step = 0, posY - 1, 1 do
- turtle.down()
- end
- if rotation == 0 then
- turtle.turnLeft()
- elseif rotation == 2 then
- turtle.turnRight()
- elseif rotation == 3 then
- turtle.turnRight()
- turtle.turnRight()
- end
- end
- function checkFuel()
- turtle.select(1)
- turtle.refuel()
- if turtle.getFuelLevel() <= posX + posY + posZ + 1 then
- refill = 1
- empty()
- refill = 0
- end
- end
- function empty()
- recover()
- if quarrybore == "bore" then
- turtle.down()
- end
- local search = 0
- for search = 16, 1, -1 do
- turtle.select(search)
- turtle.drop()
- end
- if refill == 1 then
- turtle.turnRight()
- while turtle.getFuelLevel() <= posX + posY + posZ + 1 do
- if turtle.suck() == true then
- turtle.suck()
- turtle.select(1)
- turtle.refuel()
- elseif turtle.suck() == false then
- turtle.select(1)
- turtle.refuel()
- term.clear()
- term.setCursorPos(1,1)
- io.write("Please add fuel to slot '1' or fuel chest.")
- end
- end
- turtle.turnLeft()
- resume()
- end
- if done ~= 1 then
- if quarrybore == "bore" then
- turtle.up()
- end
- resume()
- end
- end
- function checkFull()
- fullSlots = 0
- local search = 0
- for search = 16, 1, -1 do
- turtle.select(search)
- if turtle.getItemCount() > 0 then
- if tossGarbage == "yes" then
- if turtle.getItemDetail().name == "minecraft:cobblestone" then
- turtle.drop()
- elseif turtle.getItemDetail().name == "minecraft:stone" then
- turtle.drop()
- elseif turtle.getItemDetail().name == "minecraft:dirt" then
- turtle.drop()
- elseif turtle.getItemDetail().name == "minecraft:gravel" then
- turtle.drop()
- elseif turtle.getItemDetail().name == "chisel:marble2" then
- turtle.drop()
- elseif turtle.getItemDetail().name == "chisel:limestone2" then
- turtle.drop()
- elseif turtle.getItemDetail().name == "minecraft:netherrack" then
- turtle.drop()
- elseif turtle.getItemDetail().name == "natura:nether_tainted_soil" then
- turtle.drop()
- end
- end
- end
- if turtle.getItemCount() > 0 then
- fullSlots = fullSlots + 1
- end
- end
- if fullSlots == 16 then
- empty()
- end
- end
- function nextRow()
- if turn == 0 then
- turtle.turnRight()
- rotation = 1
- digStraight()
- turtle.turnRight()
- rotation = 2
- turn = 1
- elseif turn == 1 then
- turtle.turnLeft()
- rotation = 1
- digStraight()
- turtle.turnLeft()
- rotation = 0
- turn = 0
- elseif turn == 2 then
- turtle.turnRight()
- rotation = 3
- digStraight()
- turtle.turnRight()
- rotation = 0
- turn = 3
- elseif turn == 3 then
- turtle.turnLeft()
- rotation = 3
- digStraight()
- turtle.turnLeft()
- rotation = 2
- turn = 2
- end
- end
- function digDown()
- checkFuel()
- local step = 0
- for step = 2, 0, -1 do
- turtle.digDown()
- if turtle.down() == true then
- posY = posY + 1
- end
- info()
- end
- end
- function digStraight()
- checkFuel()
- turtle.digDown()
- turtle.dig()
- turtle.dig()
- turtle.forward()
- if rotation == 0 then
- posZ = posZ + 1
- elseif rotation == 1 then
- posX = posX + 1
- elseif rotation == 2 then
- posZ = posZ - 1
- elseif rotation == 3 then
- posX = posX - 1
- end
- turtle.digUp()
- info()
- end
- function quarry()
- turn = 0
- done = 0
- iniY = tonumber (iniY)
- limitY = tonumber (limitY)
- checkFuel()
- turtle.digUp()
- turtle.up()
- posY = posY - 1
- while posY < iniY - 2 do
- if quarrybore == "quarry" then
- digDown()
- end
- for c = columns, 1, -1 do
- for r = rows, 2, -1 do
- digStraight()
- end
- checkFull()
- if c == 1 then
- turtle.turnRight()
- turtle.turnRight()
- if rotation == 0 then
- rotation = 2
- elseif rotation == 2 then
- rotation = 0
- end
- if turn == 0 then
- turn = 2
- elseif turn == 1 then
- turn = 3
- elseif turn == 2 then
- turn = 0
- elseif turn == 3 then
- turn = 1
- end
- elseif c > 1 then
- nextRow()
- end
- end
- if quarrybore == "bore" then
- posY = posY + 1
- end
- end
- turtle.digDown()
- done = 1
- empty()
- term.clear()
- term.setCursorPos(1,1)
- print("Done!")
- print("---------------------------------------")
- end
- quarry()
Add Comment
Please, Sign In to add comment