Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Starting Position
- -- Saplings goes in bottom half
- -- Goes up 7 maximum
- function CheckSapling()
- if turtle.getItemCount(16) < 1 then
- FillSapling()
- end
- -- Check after fill
- if turtle.getItemCount(16) < 1 then
- return false
- end
- return true
- end
- function FillSapling()
- for n=5,15 do
- if turtle.getItemCount(n) > 1 then
- turtle.select(n)
- turtle.transferTo(16)
- end
- end
- end
- function CheckGrown()
- turtle.digUp()
- turtle.up()
- for n=1,4 do
- turtle.select(16)
- if not turtle.compare() then
- FellTreeAndReturn()
- turtle.select(1)
- turtle.dropDown()
- turtle.select(16)
- turtle.place()
- end
- turtle.turnRight()
- end
- turtle.down()
- end
- function FellTreeAndReturn()
- turtle.dig()
- turtle.forward()
- for n=1,5 do
- turtle.digUp()
- turtle.up()
- end
- for n=1,5 do
- turtle.down()
- end
- turtle.turnRight()
- turtle.turnRight()
- turtle.forward()
- turtle.turnRight()
- turtle.turnRight()
- end
- -- Start of the program
- while true do
- term.clear()
- term.setCursorPos(1,1)
- term.write( "Fuel: "..turtle.getFuelLevel())
- CheckGrown()
- -- Do the checks & sleep
- if turtle.getFuelLevel() < 50 or not CheckSapling() then
- os.reboot()
- end
- os.sleep(60)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement