Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local distance = 0
- local torches = -1
- local TD = nil
- local length = nil
- term.clear()
- term.setCursorPos(4,7)
- print("**Minenassist Scrayos**")
- term.setCursorPos(12,15)
- print("*ALPHA*")
- os.sleep(2)
- term.clear()
- term.setCursorPos(1,1)
- while not length do
- print("Tunnel length?")
- length = tonumber(read())
- if not length then
- print("Please enter a Integer 1,2,3...")
- end
- end
- while not TD do
- print("Blocks between torches?")
- TD = tonumber(read())
- if not TD then
- print("Please enter a Integer 1,2,3...")
- end
- end
- term.clear()
- term.setCursorPos(1,1)
- local torchNum = turtle.getItemCount(15)
- print("Ok starting tunnel...")
- term.setCursorPos(1,3)
- print(length .. " blocks long torches every " .. (TD)+1 .. " blocks")
- term.setCursorPos(1,5)
- print("Hold Ctrl + T at any time to cancel")
- os.sleep(1)
- term.setCursorPos(1,7)
- turtle.select(1)
- function d()
- while turtle.detect(true) do
- turtle.dig()
- end
- end
- --Custom digUp function
- function du()
- while turtle.detectUp(true) do
- turtle.digUp()
- end
- end
- --Custom forward function
- function mf()
- while not turtle.forward() do
- if not turtle.dig() then
- turtle.attack()
- end
- end
- end
- --Custom up function
- function mu()
- while not turtle.up() do
- if not turtle.digUp() then
- turtle.attackUp()
- end
- end
- end
- --Custom down function
- function md()
- while not turtle.down() do
- if not turtle.digDown() then
- turtle.attackDown()
- end
- end
- end
- --Return function
- function back()
- if distance ~= nil then
- distance = tonumber(distance)
- while turtle.getFuelLevel() < distance do
- refuel()
- end
- for i = 1, distance do
- mf()
- end
- end
- end
- --Empty function
- function empty()
- if turtle.getItemCount(14) ~= 0 then
- mu()
- mu()
- turtle.turnRight()
- turtle.turnRight()
- back()
- md()
- md()
- for i = 1,14 do
- turtle.select(i)
- if turtle.detect(true) then
- turtle.drop()
- end
- end
- mu()
- mu()
- turtle.turnRight()
- turtle.turnRight()
- back()
- md()
- md()
- turtle.select(1)
- end
- end
- --Refuel function
- function refuel()
- end
- --Torch placing function
- function placeTorch()
- if torchNum > 0 then
- if tonumber(TD) == tonumber(torches) then
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.select(15)
- turtle.place()
- torchNum = torchNum - 1
- turtle.select(1)
- turtle.turnLeft()
- turtle.turnLeft()
- torches = -1
- print("Fuel level is " .. turtle.getFuelLevel())
- end
- else
- local i = 0
- print("NO TORCHES")
- print("Place torches in slot 15 and press ENTER")
- while i == 0 do
- local sEvent, keystroke = os.pullEvent("key")
- if sEvent == "key" then
- if keystroke == 28 then
- torchNum = tonumber(turtle.getItemCount(15))
- placeTorch()
- i = 1
- end
- end
- end
- end
- end
- --Main Loop
- while tonumber(distance) < tonumber(length) do
- placeTorch()
- refuel()
- empty()
- d()
- mf()
- torches = torches + 1
- distance = distance + 1
- print("Tunneled " .. distance .. " blocks")
- du()
- turtle.turnLeft()
- d()
- mu()
- du()
- d()
- du()
- mu()
- d()
- turtle.turnRight()
- turtle.turnRight()
- d()
- md()
- d()
- md()
- d()
- turtle.turnLeft()
- turtle.turnLeft()
- d()
- turtle.turnRight()
- end
- --Empty inventory when done
- mu()
- mu()
- turtle.turnRight()
- turtle.turnRight()
- back()
- md()
- md()
- for i = 1,14 do
- turtle.select(i)
- if turtle.detect(true) then
- turtle.drop()
- end
- end
- turtle.turnRight()
- turtle.turnRight()
- term.clear()
- term.setCursorPos(1,1)
- print("Tunnel Complete " .. distance .. " blocks long")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement