Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- term.clear()
- term.setCursorPos(1, 1)
- shell.run("refuel 99999")
- local fuel = turtle.getFuelLevel()
- local item
- -- ########################
- -- OPTIONS SECTION
- term.clear()
- print(" ")
- print(" ")
- print(" [][][] ^ ")
- print(" [][][] | ")
- print(" [][][] | ")
- print(" ")
- print("Length: ")
- length = read()
- length = tonumber(length)
- term.clear()
- print(" ")
- print(" ----> ")
- print(" [][][] ")
- print(" [][][] ")
- print(" [][][] ")
- print(" ")
- print("Width: ")
- width = read()
- width = tonumber(width)
- term.clear()
- totalBlocks = length * width
- lengthDug = 1
- widthDug = 1
- blocksDug = 0
- -- ########################
- -- FUNCTIONS SECTION
- function digL()
- if turtle.detectDown() then
- turtle.digDown()
- tryForward()
- blocksDug = blocksDug + 1
- lengthDug = lengthDug + 1
- else
- tryForward()
- blocksDug = blocksDug + 1
- lengthDug = lengthDug + 1
- end
- term.clear()
- print("Fuel remaining: "..fuel.."")
- print("blocks Dug: "..blocksDug.." / "..totalBlocks.."")
- end
- function digW()
- if turtle.detectDown() then
- turtle.digDown()
- tryForward()
- blocksDug = blocksDug + 1
- widthDug = widthDug + 1
- else
- tryForward()
- blocksDug = blocksDug + 1
- widthDug = widthDug + 1
- end
- term.clear()
- print("Fuel remaining: "..fuel.."")
- print("blocks Dug: "..blocksDug.." / "..totalBlocks.."")
- end
- function tryForward()
- if not turtle.forward() then
- sleep(1)
- if turtle.detect() then
- turtle.dig()
- end
- tryForward()
- end
- print("blocks Dug: "..blocksDug.." / "..totalBlocks.."")
- end
- -- ########################
- -- MAIN CODE
- while (blocksDug < totalBlocks) do
- -- while (lengthDug < length) do
- -- digL()
- -- end
- -- lengthDug = 0
- -- turtle.turnRight()
- -- while (widthDug < width) do
- -- digW()
- -- end
- -- widthDug = 0
- -- turtle.turnRight()
- while (lengthDug < length) do
- digL()
- end
- lengthDug = 1
- length = length - 1
- turtle.turnRight()
- while (widthDug < width) do
- digW()
- end
- widthDug = 1
- width = width - 1
- turtle.turnRight()
- end
- sleep(0.1)
- print("Done.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement