Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- term.clear()
- term.setCursorPos(1,1)
- repeat
- print("Enter tunnel Length (even number): ")
- length = read()
- print("Enter height (even number): ")
- height = read()
- print("Enter Width (even number): ")
- width = read()
- until length % 2 == 0
- term.clear()
- repeat
- print("Place fuel in slot 1.")
- until turtle.getItemCount(1) >= 0
- repeat
- print("Place torches in slot 2.")
- until turtle.getItemCount(2) ~= 0
- print("Place chest behind turtle.\n")
- term.clear()
- print("Here we go!")
- torchpos = 0
- function fuel()
- if turtle.getFuelLevel() < 0.26 then
- turtle.select(1)
- turtle.refuel(1)
- end
- end
- function mine()
- local LoopHeight = 0
- local LoopWidth = 0
- local LoopLength = 0
- fuel()
- --odd numbers left even numbers right
- for LoopLength = 0, length -1 do
- for LoopHeight = 0, height - 1 do
- if LoopHeight % 2 == 0 then
- turtle.turnLeft()
- for LoopWidth = 0, width -1 do
- leftUp()
- end
- turtle.turnRight()
- else
- turtle.turnRight()
- for LoopWidth = 0, width -1 do
- rightUp()
- end
- turtle.turnLeft()
- end
- if LoopWidth == width -1 then
- if LoopWidth % 2 == 0 then
- turtle.turnRight()
- else
- turtle.turnLeft()
- end
- print("move forward")
- checkEmptySpace()
- turtle.forward()
- else
- print("Down")
- if turtle.detectDown() == true then
- turtle.digDown()
- end
- turtle.down()
- end
- end
- if LoopLength % 2 == 0 then
- turtle.turnRight()
- else
- turtle.turnLeft()
- end
- end
- end
- function checkEmptySpace()
- while turtle.detect() == true do
- turtle.dig()
- end
- end
- function leftUp()
- checkEmptySpace()
- turtle.forward()
- end
- function rightUp()
- checkEmptySpace()
- turtle.forward()
- end
- mine()
Advertisement
Add Comment
Please, Sign In to add comment