Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Area Miner
- args = {...}
- x = args[1]
- y = args[2]
- z = args[3]
- function forward()
- while turtle.detect() do
- turtle.dig()
- os.sleep(0.1)
- end
- while turtle.forward() == false do
- os.sleep(0.1)
- end
- end
- function down()
- while turtle.detectDown() do
- turtle.digDown()
- os.sleep(0.1)
- end
- while turtle.down() == false do
- os.sleep(0.1)
- end
- end
- function area(len,wid,dep)
- for current_depth=1,dep do
- for current_row=1,wid do
- for current_line=1,len-1 do
- forward()
- end
- if (((current_row % 2) + current_depth % 2) + (((1 + current_depth) % 2) * (wid%2))) %2 == 0 then
- if (current_row < wid) then
- turtle.turnLeft()
- forward()
- turtle.turnLeft()
- end
- else
- if (current_row < wid) then
- turtle.turnRight()
- forward()
- turtle.turnRight()
- end
- end
- end
- if (current_depth < dep) then
- turtle.digDown()
- turtle.down()
- turtle.turnRight()
- turtle.turnRight()
- end
- end
- end
- area(tonumber(x),tonumber(y),tonumber(z))
Advertisement
Add Comment
Please, Sign In to add comment