Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local offset = 0
- local function fellTree()
- turtle.dig()
- turtle.forward()
- local height = 0
- while ( turtle.detectUp() ) do
- turtle.dig()
- turtle.digUp()
- turtle.up()
- height = height + 1
- end
- turtle.turnRight()
- turtle.dig()
- turtle.forward()
- turtle.turnLeft()
- for i=1,height do
- turtle.dig()
- turtle.digDown()
- turtle.down()
- end
- turtle.dig()
- end
- local function plant()
- turtle.up()
- turtle.select(2)
- for i=1,4 do
- turtle.suckDown()
- turtle.placeDown()
- turtle.forward()
- turtle.turnLeft()
- end
- end
- local function moveToSuck()
- turtle.turnLeft()
- turtle.forward()
- turtle.turnLeft()
- turtle.forward()
- turtle.forward()
- turtle.turnLeft()
- turtle.down()
- end
- local function moveFromSuck()
- turtle.turnLeft()
- turtle.forward()
- end
- local function suckWalk(dist)
- for i=1,dist do
- turtle.suck()
- turtle.turnRight()
- turtle.suck()
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.suck()
- turtle.turnRight()
- turtle.forward()
- end
- end
- local function suckRound()
- for i=1,4 do
- suckWalk(3)
- turtle.turnLeft()
- suckWalk(2)
- end
- end
- local function findNextTree()
- turtle.up()
- turtle.select(1)
- turtle.turnRight()
- for i=1,10 do
- turtle.forward()
- offset = offset + 1
- turtle.turnLeft()
- if turtle.detect() then
- turtle.down()
- return true
- else
- turtle.turnRight()
- end
- end
- turtle.down()
- return false
- end
- local function returnToStart()
- turtle.turnLeft()
- turtle.turnLeft()
- while (offset > 0) do
- turtle.forward()
- offset = offset - 1
- end
- turtle.turnRight()
- end
- while (findNextTree()) do
- fellTree()
- plant()
- moveToSuck()
- suckRound()
- moveFromSuck()
- end
- returnToStart()
Advertisement
Add Comment
Please, Sign In to add comment