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()
- turtle.turnLeft()
- turtle.forward()
- turtle.turnLeft()
- turtle.forward()
- turtle.turnLeft()
- turtle.turnLeft()
- end
- local function plant()
- turtle.up()
- turtle.forward()
- turtle.turnRight()
- turtle.select(2)
- for i=1,4 do
- turtle.suckDown()
- turtle.placeDown()
- turtle.forward()
- turtle.turnLeft()
- end
- turtle.turnRight()
- turtle.forward()
- turtle.turnRight()
- turtle.turnRight()
- turtle.down()
- 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
- if (turtle.forward()) then
- offset = offset + 1
- else
- turtle.down()
- return false
- end
- 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
- turtle.suckDown()
- end
- turtle.turnRight()
- end
- local function unload()
- for i=3,16 do
- turtle.select(i)
- turtle.dropDown()
- end
- end
- local function refuel()
- turtle.select(1)
- while ((turtle.getFuelLevel() < 200) and (turtle.getItemCount(1) > 1)) do
- turtle.refuel(1)
- end
- end
- local function fellRow()
- refuel()
- while (findNextTree()) do
- fellTree()
- plant()
- end
- returnToStart()
- unload()
- end
- while (true) do
- fellRow()
- sleep(60)
- end
Advertisement
Add Comment
Please, Sign In to add comment