Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --This code digs a rectangular area
- function storecontents(height)
- for y = 1, height, 1 do
- turtle.up()
- end
- for slot = 1, 16, 1 do
- turtle.select(slot)
- turtle.drop()
- end
- for y = 1, height, 1 do
- turtle.down()
- end
- end
- local tArgs = {...}
- xPos = tArgs[1]
- yPos = tArgs[2]
- zPos = tArgs[3]
- if xPos == nil or yPos == nil or zPos == nil then
- print("Usage: digArea <x> <y> <z>")
- return -1
- end
- xPos = tonumber(xPos)
- yPos = tonumber(yPos)
- zPos = tonumber(zPos)
- print("Moving...")
- x = 0
- y = 0
- z = 0
- flip = false
- while true do
- x = x + 1
- turtle.dig()
- turtle.forward()
- if x >= xPos-1 then
- x = 0
- z = z + 1
- if (z >= zPos) then
- z = 0
- y = y + 1
- if y >= yPos then
- storecontents(y-1)
- break
- else
- if y % 2 == 0 then
- storecontents(y-1)
- end
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.digDown()
- turtle.down()
- flip = not flip
- end
- else
- if flip then
- turtle.turnLeft()
- turtle.dig()
- turtle.forward()
- turtle.turnLeft()
- else
- turtle.turnRight()
- turtle.dig()
- turtle.forward()
- turtle.turnRight()
- end
- end
- flip = not flip
- end
- end
- yPos = yPos - 1
- while yPos > 0 do
- yPos = yPos - 1
- turtle.up()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement