Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Attempting to get position via GPS")
- local x, y, z = gps.locate(5)
- if x == nil then
- print("Unable to determine position using GPS, using 0 for default height")
- y = 0
- else
- y = math.floor(y)
- print("Height is ",y,", adjusting movements for GPS")
- end
- minHeight = y
- for i=1,2 do
- turtle.dig()
- turtle.forward()
- end
- while turtle.detectUp() do
- turtle.dig()
- turtle.digUp()
- if (turtle.up()) then
- y = (y + 1)
- else
- turtle.attackUp()
- end
- end
- turtle.dig()
- turtle.turnRight()
- turtle.dig()
- turtle.forward()
- turtle.turnLeft()
- while (y > minHeight) do
- turtle.dig()
- turtle.digDown()
- if (turtle.down()) then
- y = (y - 1)
- else
- turtle.attackDown()
- end
- end
- x, y, z = gps.locate(5)
- if y == nil then
- y = 0
- end
- y = math.floor(y)
- while (y > minHeight) do
- turtle.attackDown()
- turtle.digDown()
- turtle.attack()
- turtle.dig()
- turtle.down()
- x, y, z = gps.locate(5)
- y = math.floor(y)
- end
- turtle.dig()
- -- Plant new 2x2 tree
- turtle.place()
- turtle.turnRight()
- turtle.back()
- turtle.place()
- turtle.turnLeft()
- turtle.place()
- turtle.back()
- turtle.place()
- turtle.back()
- -- Move items into chest
- for i=1,2 do
- turtle.turnLeft()
- end
- for i=2,16 do
- turtle.select(i)
- turtle.drop()
- end
- turtle.select(1)
- for i=1,2 do
- turtle.turnRight()
- end
- print("Tree chopped!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement