Advertisement
Logos01

Untitled

May 16th, 2013
310
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.46 KB | None | 0 0
  1. function CutLogs(x)
  2. addToH = 0
  3. if h == 0 then
  4. addToH = 1
  5. end
  6. if addToH == 1 then
  7. while turtle.detectUp() do
  8. turtle.digUp()
  9. turtle.up()
  10. h = h +1
  11. end
  12. end
  13. if addToH == 0 then
  14. for i=1,h,1 do
  15. if x == 1 then
  16. turtle.digUp()
  17. turtle.up()
  18. end
  19. if x == 0 then
  20. turtle.digDown()
  21. turtle.down()
  22. end
  23. end
  24. end
  25. end --CutLogs
  26.  
  27. function CutTree()
  28. h = 0
  29. turtle.dig()
  30. turtle.forward()
  31. CutLogs(1)
  32. if h == 0 then
  33. h = 1
  34. end
  35. turtle.dig()
  36. turtle.forward()
  37. CutLogs(0)
  38. turtle.turnRight()
  39. turtle.dig()
  40. turtle.forward()
  41. CutLogs(1)
  42. turtle.turnRight()
  43. turtle.dig()
  44. turtle.forward()
  45. CutLogs(0)
  46. turtle.turnRight()
  47. turtle.dig()
  48. turtle.forward()
  49. turtle.turnRight()
  50. turtle.back()
  51. h = 0
  52. end --CutTree
  53.  
  54. function DumpInventory()
  55. turtle.turnRight()
  56. turtle.forward()
  57. turtle.forward()
  58. for i=1,16,1 do
  59. turtle.select(i)
  60. turtle.drop()
  61. end
  62. turtle.back()
  63. turtle.back()
  64. turtle.turnLeft()
  65. turtle.select(1)
  66. end --DumpInventory
  67.  
  68. function Main()
  69. lat, long, height = gps.locate(2)
  70. n = turtle.getFuelLevel()
  71. while true do
  72. if n > 320 then
  73. if height == 6 then
  74. turtle.up()
  75. if turtle.detect() then
  76. turtle.down()
  77. CutTree()
  78. DumpInventory()
  79. end
  80. if not turtle.detect() then
  81. turtle.down()
  82. end
  83. end
  84. if height > 6 then
  85. turtle.down()
  86. end
  87. if height < 6 then
  88. turtle.up()
  89. end
  90. if latitude > 135 then
  91. turtle.back()
  92. end
  93. if latitude < 135 then
  94. turtle.forward()
  95. end
  96. if longitude > 1 then
  97. turtle.turnLeft()
  98. turtle.forward()
  99. turtle.turnRight()
  100. end
  101. if longitude < 1 then
  102. turtle.turnRight()
  103. turtle.forward()
  104. turtle.turnLeft()
  105. end
  106. end
  107. sleep(15)
  108. print(n)
  109. end
  110. end --Main
  111.  
  112. Main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement