Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local length, depth = ...
- local modem = peripheral.wrap("right")
- modem.open(5)
- modem.open(4)
- local selected = nil
- local depthCounter = 1
- function spin()
- turtle.turnLeft()
- turtle.turnLeft()
- end
- function drop()
- spin()
- while turtle.detect() do
- turtle.dig()
- end
- selected = turtle.getSelectedSlot()
- turtle.select(16)
- turtle.place()
- for i = 1, 15 do
- turtle.select(i)
- turtle.drop()
- end
- turtle.select(16)
- turtle.dig()
- spin()
- turtle.select(selected)
- end
- function checkInv()
- if turtle.getItemCount(15) > 0 then
- drop()
- end
- end
- function strip()
- for i = 1, length-1 do
- if depth - depthCounter >= 3 then
- while turtle.detectDown() do
- checkInv()
- turtle.digDown()
- end
- while turtle.detectUp() do
- checkInv()
- turtle.digUp()
- end
- while turtle.detect() do
- checkInv()
- turtle.dig()
- end
- turtle.forward()
- elseif depth - depthCounter == 2 then
- while turtle.detectUp() do
- checkInv()
- turtle.digUp()
- end
- while turtle.detect() do
- checkInv()
- turtle.dig()
- end
- turtle.forward()
- elseif depth - depthCounter == 1 or depth - depthCounter <= 0 then
- while turtle.detect() do
- checkInv()
- turtle.dig()
- end
- turtle.forward()
- end
- end
- end
- function turn()
- local count
- if (depth-1) - depthCounter >= 3 then
- count = 3
- elseif (depth-1) - depthCounter == 2 then
- count = 2
- elseif (depth-1) - depthCounter == 1 then
- count = 1
- elseif (depth-1) - depthCounter <= 0 then
- count = 0
- end
- while turtle.detectUp() do
- checkInv()
- turtle.digUp()
- end
- for i = 1, count do
- while turtle.detectDown() do
- checkInv()
- turtle.digDown()
- end
- turtle.down()
- depthCounter = depthCounter + 1
- end
- spin()
- end
- function up()
- print(depthCounter)
- print(depth - depthCounter)
- for i = 1, depth do
- while turtle.detectUp() do
- checkInv()
- turtle.digUp()
- end
- turtle.up()
- end
- end
- function start()
- while turtle.detectDown() do
- checkInv()
- turtle.digDown()
- end
- turtle.down()
- end
- start()
- start()
- for i = 1, depth, 3 do
- strip()
- turn()
- end
- up()
- drop()
Add Comment
Please, Sign In to add comment