Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tArgs = {...}
- local direction = 1 -- 0 = forward, 1 = back
- --[[
- Add saving functionality
- ]]
- if #tArgs < 1 then
- printError("Needs Arguments")
- printError("quarry [x][y][z]")
- return
- end
- function fuel()
- if turtle.getFuelLevel() < 10 then
- turtle.select(16)
- turtle.refuel(1)
- turtle.select(1)
- end
- if turtle.getItemCount(16) < 1 then
- print("turtle requires fuel and will resume after")
- repeat
- until turtle.getItemCount(16) > 10
- fuel()
- end
- end
- function tr()
- turtle.turnRight()
- end
- function tl()
- turtle.turnLeft()
- end
- function fwd()
- fuel()
- while not turtle.forward() do turtle.dig() end
- end
- function toggleDir()
- if tonumber(direction) == 0 then
- direction = 1
- print("facing backward")
- elseif tonumber(direction) == 1 then
- direction = 0
- print("facing forward")
- end
- end
- function getDirection()
- if direction == 0 then
- return "forward"
- elseif direction == 1 then
- return "back"
- end
- end
- local length = tonumber(tArgs[3]) -- z axis from turtle facing forward
- local height = tonumber(tArgs[2]) -- starts from the top
- local width = tonumber(tArgs[1]) -- starts from the left
- -- implement saving and loading function here
- -- starts on the top left of placement of turtle in the forward direction
- for x = 1, width do
- for y = 1, height do
- for z = 1, length - 1 do
- fwd()
- end
- -- end of z access run
- if y < height then
- turtle.digDown()
- tl()
- tl()
- turtle.down()
- end
- if y % 2 == 0 then
- direction = 1
- else
- direction = 0
- end
- end
- for y = 1, height do
- turtle.up()
- fuel()
- end
- -- if ends in forward direction
- if direction == 0 then
- for i = 1, length - 1 do
- fuel()
- turtle.back()
- end
- tr()
- fwd()
- tl()
- end
- if direction == 1 then
- return
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement