Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Variables --
- fuel = 64
- length = 4
- rows = 4
- sapling = 1
- -- End Variables --
- -- Functions --
- function fuel() -- Let's the turtle refuel itself.
- if turtle.getFuelLevel() < 30 then
- turtle.select(16)
- turtle.refuel(fuel)
- turtle.select(sapling)
- else
- os.sleep(0.1)
- end
- end
- function move() -- Handles the turtle's movement function.
- for i=1, length do
- turtle.forward()
- checktree()
- end
- end
- function navL() -- Navigates left.
- turtle.turnLeft()
- turtle.forward()
- turtle.forward()
- turtle.turnLeft()
- turtle.placeDown()
- end
- function navR() -- Navigates right.
- turtle.turnRight()
- turtle.forward()
- turtle.forward()
- turtle.turnRight()
- turtle.placeDown()
- end
- function log() -- Initiates the loggingturtle.
- for i=1, rows do
- move()
- navL()
- move()
- navR()
- end
- end
- function scanlog() -- Scans for logs above turtle
- if turtle.detectUp() == true then
- while turtle.detectUp() == true do
- turtle.digUp()
- turtle.up()
- end
- else turtle.forward()
- end
- end
- function descend() -- Let's the turtle descend properly
- while turtle.detectDown() ~= true do
- turtle.down()
- turtle.select(sapling)
- turtle.placeDown()
- end
- end
- function checktree() -- Scans block in front, if it detects anything it breaks the block, otherwise move forward and try to place sapling
- if turtle.detect() == true then
- turtle.dig()
- turtle.forward()
- turtle.digDown()
- scanlog()
- descend()
- else
- turtle.forward()
- turtle.select(sapling)
- turtle.placeDown()
- end
- end
- -- End Functions --
- -- Execute code below this line --
- log()
Advertisement
Add Comment
Please, Sign In to add comment