Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- saplings = 1 -- the slot where the saplings are
- charbon = 2
- bois=3
- coffre=4
- function reEnergy()
- turtle.suckDown()
- turtle.select(charbon)
- if turtle.getFuelLevel() < 800 then
- turtle.refuel()
- end
- if turtle.getFuelLevel() < 100 then
- print('No much fuel !')
- os.shutdown()
- end
- turtle.select(saplings)
- end
- function pose()
- turtle.select(bois)
- turtle.drop(turtle.getItemCount(bois)-1)
- turtle.select(saplings)
- end
- turtle.select(saplings) -- select the saplings
- while turtle.getItemCount(saplings) > 0 do -- while more saplings in inventory
- turtle.select(coffre)
- turtle.turnLeft()
- if turtle.compare() then
- reEnergy()
- pose()
- end
- turtle.turnRight()
- turtle.select(saplings)
- for i = 1, 5 do -- plant 5 saplings in a row
- turtle.turnRight()
- if not turtle.compare() then -- if not a sapling, then a tree grew
- turtle.dig()
- turtle.forward()
- turtle.select(bois)
- while turtle.compareUp() do -- dig tree out
- turtle.digUp()
- turtle.up()
- end
- turtle.select(saplings)
- while not turtle.detectDown() do -- back down to ground
- turtle.down()
- end
- turtle.back()
- turtle.place() -- put down new sapling
- end
- turtle.turnLeft()
- turtle.forward()
- end
- -- turn around and line up for next pass
- turtle.turnRight()
- turtle.forward()
- turtle.forward()
- turtle.turnRight()
- turtle.forward()
- os.sleep(180) -- sleep for 60 seconds to allow trees to grow
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement