Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local YPos = 0
- function refuel()
- print( "Refueling..." )
- turnAround()
- turtle.select(1)
- turtle.suck(64)
- turtle.refuel(64)
- turnAround()
- end
- function getSapplings()
- print( "Getting sapplings..." )
- turtle.select(2)
- turtle.suckDown(4)
- end
- function turnAround()
- turn( "r" )
- turn( "r" )
- end
- function turn( direction )
- if direction == "r" then
- turtle.turnRight()
- return true
- elseif direction == "l" then
- turtle.turnLeft()
- return true
- else
- return false
- end
- end
- function dump()
- turn("r")
- for n=3,16 do
- local itemCount = turtle.getItemCount(n)
- if itemCount > 0 then
- turtle.select(n)
- turtle.drop(64)
- end
- end
- turn("l")
- end
- function plantSapplings()
- turtle.select(2)
- turtle.forward()
- turtle.forward()
- turn("l")
- turtle.place()
- turn("r")
- turtle.back()
- turtle.place()
- turn("l")
- turtle.place()
- turn("r")
- turtle.back()
- turtle.place()
- end
- function compareLoop()
- local tree = false
- while tree == false do
- if not turtle.compare() then
- tree = true
- end
- sleep(5)
- end
- end
- function mainLoop()
- while true do
- compareLoop()
- local topFound = false
- if turtle.getFuelLevel() < 1000 then
- refuel()
- end
- getSapplings()
- turtle.dig()
- turtle.forward()
- while topFound == false do
- if YPos > 200 then
- turtle.dig()
- turtle.up()
- turtle.dig()
- YPos = YPos + 1
- topFound = true
- print("Reached max height...")
- elseif turtle.up() then
- turtle.dig()
- YPos = YPos + 1
- topFound = true
- print("Top found...")
- else
- turtle.dig()
- turtle.digUp()
- turtle.up()
- turtle.dig()
- YPos = YPos + 1
- print("Going up... YPos: "..YPos)
- end
- end
- turn("l")
- turtle.dig()
- turtle.forward()
- turn("r")
- while YPos > 0 do
- turtle.dig()
- turtle.digDown()
- turtle.down()
- YPos = YPos - 1
- end
- turtle.dig()
- turn("r")
- turtle.forward()
- turn("l")
- turtle.back()
- dump()
- plantSapplings()
- end
- end
- mainLoop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement