Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---------------------------
- --- CONFIG SECTION ---
- ---------------------------
- fillOuterRing = true -- Enables block filling ( Fills in gaps in the 3x3's walls )
- placeTorches = true -- Enables torch placing on the LEFT side
- excavateStyle = true -- Tunnels 3x3 then down 3x3 until it can't mine anymore
- tunnelXbyY = false -- Tunnels 6x3 ( 3x3 -> Right -> 3x3 back -> Start )
- enderchestDump = false -- Enables use of enderchest ( Slot 3 ) for dropping off items
- enderchestRefill = false -- Enables use of enderchest ( Slot 4 ) for refueling
- -- NOTE: WHEN USING ENDERCHESTS OPTIONS, TURTLE WON'T RETURN TO START UNTIL FINISHED --
- presetLength = 0 -- Tired of always putting in a length? Put the length here to make it stick to this program
- editablePreset = false -- Decided you want to have X as your length, but you changed your mind this one time?
- -----------------------
- --- VARIABLES ---
- -----------------------
- local distance = 0
- ------------------------
- --- Disclaimer ---
- ------------------------
- term.clear()
- term.setCursorPos(1, 1)
- print("WARNING: NOT FOR USE NEAR LAVA!")
- print("RANDOM INC IS NOT RESPONSIBLE FOR YOUR RESOURCES LOST!")
- print("PROGRAM MADE BY RANDOMSHOVEL!")
- print("USEABLE AS REFERENCE, NOT FOR REDISTRIBUTE!")
- print("CANNOT BE LOCATED SOMEWHERE OTHER THAN MY PASTEBIN PROFILE!")
- print("Press any button to continue")
- event,param1=os.pullEvent()
- if event == "key" then
- term.clear()
- term.setCursorPos(1, 1)
- end
- --------------------------------------------------------------------
- --- Printing Info, Gathering Length, and Gathering Y Level ---
- --------------------------------------------------------------------
- print("Slots:")
- print("1) Torches")
- print("2) Building Material")
- print("3) EnderChest Dump Chest")
- print("4) EnderChest Refuel Chest")
- print("")
- print("VERSION 1.0")
- print("")
- print("Look through options before using!")
- print("")
- write("Enter Tunnel Lenth: ")
- length = tonumber(read())
- if excavateStyle == true then
- write("Enter Y Level Turtle Is On: ")
- y = tonumber(read())
- end
- ----------------------------------------------
- --- Check Length, and Process Y Level ---
- ----------------------------------------------
- if length < 1 then
- term.clear()
- term.setCursorPos(1, 1)
- print("Length must be greater than 1")
- elseif presetLength > 0 then
- print("You have a preset length of "..presetLength)
- if presetLength >= 0 and editablePreset == true then
- print("You have editable preset enabled, you current preset is "..presetLength)
- print("Multiply, Division, Addition, Subtraction")
- write("Operation? ")
- operation = read()
- write("Number? ")
- number = read()
- end
- -------------------------
- --- Process Y ---
- -------------------------
- y = math.floor(y / 3)
- -------------------------------
- --- Check Operation ---
- -------------------------------
- if operation == "Multiply" or operation == "multiply" then
- presetLength = presetLength * number
- elseif operation == "Division" or operation == "division" then
- presetLength = presetLength / number
- elseif operation == "Addition" or operation == "addition" then
- presetLength = presetLength + number
- elseif operation == "Subtraction" or operation == "subtraction" then
- presetLength = presetLength - number
- end
- end
- ---------------------------------
- --- Essential Functions ---
- ---------------------------------
- function checkT()
- turtle.select(1)
- if turtle.getItemCount(1) == 0 and enderchestRefill == true then
- turtle.select(4)
- turtle.place()
- turtle.select(1)
- turtle.suck(1)
- if turtle.getItemCount(1) > 0 then
- turtle.select(4)
- turtle.dig()
- elseif turtle.getItemCount(1) == 0 then
- repeat
- turtle.suck(1)
- until turtle.getItemCount(1) > 0
- turtle.select(4)
- turtle.dig()
- end
- end
- end
- function turn()
- turtle.turnLeft()
- turtle.turnLeft()
- end
- ----------------------------------
- --- Chooseable Functions ---
- ----------------------------------
- function enderDump()
- if enderchestDump == true then
- turtle.select(3)
- turtle.place()
- for i=5,16 do
- turtle.select(i)
- turtle.drop()
- end
- turtle.select(3)
- turtle.dig()
- end
- end
- function enderRefill()
- if enderchestRefill == true then
- cFuel = turtle.getFuelLevel()
- if cFuel <= 100 then
- turtle.select(4)
- turtle.place()
- turtle.suck()
- fuel = turtle.getItemCount(4)
- turtle.refuel(8)
- turtle.select(4)
- turtle.dig()
- checkT()
- end
- end
- end
- function torchPlacing()
- distance = distance + 1
- if placeTorches == true then
- if distance == 5 then
- turtle.select(1)
- turtle.up()
- turtle.turnLeft()
- turtle.place()
- turtle.turnRight()
- turtle.down()
- distance = distance - 5
- end
- end
- end
- function fillRing()
- if fillOuterRing == true then
- repeat
- turtle.down()
- until turtle.down() == false
- turtle.turnRight()
- turtle.select(2)
- turtle.forward()
- turtle.place()
- turtle.placeDown()
- turtle.up()
- turtle.place()
- turtle.up()
- turtle.placeUp()
- turtle.place()
- turtle.back()
- turtle.placeUp()
- turtle.back()
- turtle.placeUp()
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.place()
- turtle.down()
- turtle.place()
- turtle.down()
- turtle.place()
- turtle.placeDown()
- turtle.back()
- turtle.placeDown()
- turtle.turnRight()
- end
- end
- function home()
- if excavateStyle == false then
- turn()
- for i=1, length do
- turtle.forward()
- end
- elseif excavateStyle == true then
- for i=1, down*3 do
- turtle.digUp()
- turtle.up()
- end
- if math.floor(down)/2 == 1 then
- for i=1, length do
- turtle.forward()
- end
- elseif math.floor(down)/2 == 2 then
- turn()
- for i=1, length do
- turtle.forward()
- end
- end
- end
- function emptyInventory()
- if enderchestDump == false and enderchestRefill == false then
- for i=3, 16 do
- turtle.select(i)
- turtle.drop()
- end
- elseif enderchestDump == true or enderchestRefill == true then
- for i=5, 16 do
- turtle.select(i)
- turtle.drop()
- end
- end
- end
- function digTunnel()
- for i=1, 3 do
- if i < 3 then
- repeat
- turtle.dig()
- until turtle.dig() == false
- end
- end
- end
- turtle.turnLeft()
- repeat
- turtle.dig()
- sleep(0.5)
- until turtle.dig() == false
- turn()
- repeat
- turtle.dig()
- sleep(0.5)
- until turtle.dig() == false
- turtle.turnLeft()
- if i < 3 then
- repeat
- turtle.digUp()
- sleep(0.5)
- until turtle.digUp() == false
- end
- if i < 3 then
- turtle.up()
- end
- end
- function excavatingStyle()
- for i = 1, y do
- for l = 1, length do
- digTunnel()
- fillRing()
- torchPlacing()
- enderDump()
- enderRefill()
- if turtle.forward() == false then
- repeat
- turtle.dig()
- until turtle.forward() == true
- end
- end
- turtle.back()
- for i=1, 3 do
- turtle.digDown()
- turtle.back()
- turtle.digDown()
- turtle.back()
- turtle.digDown()
- turtle.turnLeft()
- turtle.forward()
- turtle.turnRight()
- turtle.digDown()
- turtle.forward()
- turtle.digDown()
- turtle.forward()
- turtle.digDown()
- turtle.turnRight()
- turtle.forward()
- turtle.forward()
- turtle.turnRight()
- turtle.digDown()
- turtle.forward()
- turtle.digDown()
- turtle.forward()
- turtle.digDown()
- turtle.turnRight()
- turtle.forward()
- turtle.turnLeft()
- turtle.down()
- end
- repeat
- turtle.dig()
- until turtle.dig() == false
- turtle.forward()
- down = down + 1
- end
- home()
- emptyInventory()
- end
- -------------------------
- --- Main Code ---
- -------------------------
- if excavateStyle == false then
- for l = 1, length do
- digTunnel()
- fillRing()
- torchPlacing()
- enderDump()
- enderRefill()
- if turtle.forward() == false then
- repeat
- turtle.dig()
- until turtle.forward() == true
- end
- end
- home()
- emptyInventory()
- elseif excavateStyle == true then
- excavatingStyle()
- end
Advertisement
Add Comment
Please, Sign In to add comment