Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Turtle in the front with pickaxe and gate reader
- local version = "1.0"
- local function doScreen(str)
- term.clear()
- term.setCursorPos(1,1)
- write("Mining Well Turtle - v")
- print(version)
- print("------------------------------")
- write("Fuel: ")
- print(turtle.getFuelLevel())
- print()
- print(str)
- end
- local stopAt16 = true
- -- Special functions to handle gravel/sand
- local function forward()
- while not turtle.forward() do
- turtle.dig()
- end
- end
- local function digUp()
- while turtle.detectUp() do
- turtle.digUp()
- os.sleep(0.5)
- end
- end
- -- Empty into Ender Chest
- local function empty()
- doScreen("Emptying turtle...")
- -- Place ender chest
- if turtle.detectUp() then
- digUp()
- end
- turtle.select(15)
- turtle.placeUp()
- for i=1,16 do
- while turtle.getItemCount(i) > 0 do
- turtle.select(i)
- turtle.dropUp()
- end
- end
- turtle.select(15)
- turtle.digUp()
- end
- -- Wrap the gate detector
- local gate = peripheral.wrap("right")
- doScreen("Place items as follows...")
- print("-------------------------")
- print("| EnderChest in 15")
- print("| Mining Well in 16")
- while (turtle.getItemCount(15)==0) or (turtle.getItemCount(16)==0) do
- os.sleep(0.1)
- end
- rs.setBundledOutput("back", colors.red)
- while true do
- for i=1,16 do
- turtle.digDown()
- turtle.select(16)
- turtle.placeDown()
- doScreen("Mining...")
- turtle.select(1)
- digUp()
- while not gate.get()["Work Done"] do
- os.sleep(0.1)
- end
- if turtle.getItemCount(12) > 0 then
- empty()
- end
- doScreen("Moving...")
- turtle.select(16)
- turtle.digDown()
- turtle.select(1)
- forward()
- end
- if stopAt16 then
- print("Mined 16 blocks. Press any key...")
- os.pullEvent("char")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment