Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- command line args - x, y, levels, updown, left, items
- local x, y, levels, updown, left, items = tonumber(arg[1]), tonumber(arg[2]), tonumber(arg[3]), tonumber(arg[4]), tonumber(arg[5]), tonumber(arg[6])
- function dig()
- while turtle.inspect() do
- turtle.dig()
- end
- turtle.forward()
- if updown then
- while turtle.inspectUp() do
- turtle.digUp()
- end
- turtle.digDown()
- end
- end
- function move(num)
- print(num)
- for i = 1, tonumber(num) do
- turtle.forward()
- end
- end
- for c = 1, levels do
- for a = 1, x do
- for b = 1, y do
- if b < y then
- dig()
- end
- end
- if a < x then
- if left == 1 and a % 2 == 1 then
- turtle.turnLeft()
- dig()
- turtle.turnLeft()
- elseif left == 1 and a % 2 == 0 then
- turtle.turnRight()
- dig()
- turtle.turnRight()
- elseif left == 0 and a % 2 == 0 then
- turtle.turnLeft()
- dig()
- turtle.turnLeft()
- else
- turtle.turnRight()
- dig()
- turtle.turnRight()
- end
- end
- if items == 1 then
- -- add items to ender chest
- turtle.select(1)
- turtle.placeUp()
- for i = 16, 1, -1 do
- turtle.select(i)
- turtle.dropUp()
- end
- turtle.digUp()
- end
- end
- -- returnToStartXY
- -- if x is odd
- if x % 2 == 1 then
- print("x is odd moveY: "..y)
- turtle.turnLeft()
- turtle.turnLeft()
- move(y)
- end
- -- if x is even and not left
- if left == 0 then
- print("not left: "..left)
- turtle.turnRight()
- move(x)
- turtle.turnRight()
- else
- print("left: "..left)
- turtle.turnLeft()
- move(x)
- turtle.turnLeft()
- end
- if c < levels then
- turtle.down()
- turtle.digDown()
- if updown then
- for i = 1, 2 do
- turtle.down()
- turtle.digDown()
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement