Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --TreeChooper
- --fuel
- if turtle.getFuelLevel()==0 then
- turtle.select(3)
- turtle.refuel(10)
- end
- --fuel test
- function fuelChecker()
- if turtle.getFuelLevel() < 10 then
- turtle.select(3)
- turtle.refuel(10)
- end
- end
- --leafs checker
- function leafs()
- --leafs checker
- turtle.select(6)
- if turtle.compare() then
- turtle.dig()
- end
- end
- --detect saplings
- function sapDec()
- turtle.select(1)
- if turtle.compare() then
- --repostion
- turtle.up()
- turtle.forward()
- turtle.forward()
- turtle.down()
- end
- end
- --detectUp
- function seeUp()
- if turtle.detectUp() then
- turtle.digUp()
- turtle.down()
- end
- end
- --choop function
- function choop()
- --fuel test
- fuelChecker()
- --for loop
- for i = 0,6 do
- print(i)
- --position
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- --chop tree
- turtle.select(2)
- --if the tree has grown
- if turtle.compare() then
- turtle.dig()
- turtle.forward()
- --harvest the tree
- while turtle.detectUp() do
- turtle.digUp()
- turtle.up()
- end
- --return to the ground
- while not turtle.detectDown() do
- turtle.down()
- end
- --plant a new sapling
- turtle.back()
- turtle.select(1)
- turtle.place()
- --repostion
- turtle.up()
- turtle.forward()
- turtle.forward()
- turtle.down()
- end
- end
- end
- --postitioning
- function initPosition()
- turtle.turnLeft()
- turtle.forward()
- turtle.turnLeft()
- end
- --Back to Base
- function BackBase()
- turtle.turnRight()
- for i=0,2 do
- turtle.forward()
- end
- end
- --run the empty way without chooping
- function run()
- --fuel test
- fuelChecker()
- for i=0,6 do
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- end
- end
- --turn function
- function turn()
- --Check for Walls
- turtle.select(4)
- if turtle.compare() then
- turtle.turnRight()
- turtle.forward()
- turtle.forward()
- turtle.turnRight()
- end
- end
- for i=0,1 do
- choop()
- turn()
- run()
- --initPosition()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement