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()
- while turtle.getItemCount(1) == 0 do
- print("Place fuel in slot 1.")
- read()
- end
- while turtle.getItemCount(2) == 0 do
- print("Place torches in slot 2.")
- read()
- end
- 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
- leftDown()
- print("LoopWidthL: ", LoopWidth)
- end
- if LoopHeight == height - 1 then
- endHeightCheck(LoopWidth)
- end
- turtle.turnRight()
- else
- turtle.turnRight()
- for LoopWidth = 0, width -1 do
- rightDown()
- print("LoopWidthR: ", LoopWidth)
- end
- if LoopHeight == height - 1 then
- endHeightCheck(LoopWidth)
- end
- turtle.turnLeft()
- end
- if LoopHeight ~= height - 1 then
- checkEmptyDown()
- 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 leftDown()
- checkEmptySpace()
- turtle.forward()
- end
- function rightDown()
- checkEmptySpace()
- turtle.forward()
- end
- function checkEmptyDown()
- if turtle.detectDown() == true then
- turtle.digDown()
- end
- turtle.down()
- end
- function endHeightCheck(LoopWidth)
- if LoopWidth % 2 == 1 then
- print("R")
- turtle.turnRight()
- checkEmptySpace()
- turtle.forward()
- print("0: ")
- read()
- else
- print("L")
- turtle.turnLeft()
- checkEmptySpace()
- turtle.forward()
- print("1: ")
- read()
- end
- end
- mine()
Advertisement
Add Comment
Please, Sign In to add comment