Spatzenhirn123

Treefarm (Length-High)

Oct 1st, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --local args = {...}
  2. --length = args[1]
  3. --high = args[2]
  4. treeintervall = 3
  5. length = 10
  6. high = 10
  7. --------------------------------------------------
  8. function forward()
  9. while turtle.forward()==false do
  10. os.sleep(0.1)
  11. turtle.dig()
  12. end
  13. end
  14.  
  15. function up()
  16. while turtle.up()==false do
  17. os.sleep(0.1)
  18. turtle.digUp()
  19. end
  20. end
  21.  
  22. function down()
  23. while turtle.down()==false do
  24. os.sleep(0.1)
  25. turtle.digDown()
  26. end
  27. end
  28.  
  29. function tree()
  30. i=0
  31. j=0
  32. while turtle.digUp()==true do
  33. up()
  34. i=i+1
  35. end
  36. for x=1,i,1 do
  37. down()
  38. end
  39. if i>j then
  40. turtle.digDown()
  41. end
  42. turtle.select(slot)
  43. turtle.placeDown()
  44. end
  45.  
  46. function next()
  47. for x=1,treeintervall,1 do
  48. forward()
  49. end
  50. end
  51.  
  52. function line()
  53. for a=1,length-1,1 do
  54. tree()
  55. next()
  56. end
  57. tree()
  58. end
  59.  
  60. function turnNextRight()
  61. turtle.turnRight()
  62. for x=1,treeintervall,1 do
  63. forward()
  64. end
  65. turtle.turnRight()
  66. end
  67.  
  68. function turnNextLeft()
  69. turtle.turnLeft()
  70. for x=1,treeintervall,1 do
  71. forward()
  72. end
  73. turtle.turnLeft()
  74. end
  75.  
  76. function back()
  77. turtle.turnRight()
  78. for d=1,u,1 do
  79. next()
  80. end
  81. turtle.turnLeft()
  82. down()
  83. end
  84.  
  85.  
  86. -------------------------
  87. up()
  88. u=0
  89. slot=1
  90. run=0
  91. for s=0.5,high/2,1 do
  92.  
  93. run=run+1
  94. if run>3 then
  95. slot=slot+1
  96. run=0
  97. end
  98. turnNextLeft()
  99. line()
  100. turnNextRight()
  101. line()
  102. u=u+2
  103. end
  104. back()
Add Comment
Please, Sign In to add comment