Guest User

rabanie2

a guest
Dec 26th, 2015
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.47 KB | None | 0 0
  1. function sygnal()
  2. czyjest, blok=turtle.inspect()
  3.  
  4. if blok["name"]=="minecraft:log" then
  5. znaleziono = "drewno"
  6. elseif blok["name"]=="minecraft:leaves" then
  7. znaleziono = "lisc"
  8. elseif blok["name"]=="minecraft:tallgrass" then
  9. znaleziono = "trawa"
  10. elseif blok["name"]=="minecraft:double_plant" then
  11. znaleziono = "kwiatek"
  12. elseif blok["name"]=="minecraft:yellow_flower" then
  13. znaleziono = "kwiatek"
  14. else
  15. znaleziono = "nic"
  16. end
  17. return znaleziono
  18.  
  19. end
  20.  
  21. function ruchpodstawowy()
  22.  
  23. while turtle.detectDown()==false do
  24. turtle.down()
  25. end
  26.  
  27. while (turtle.detect()==true) and (sygnal()=="nic") do
  28.  
  29. gora1, gora2=turtle.inspectUp()
  30. if gora2["name"]=="minecraft:leaves" then
  31. turtle.digUp()
  32. end
  33. turtle.up()
  34. end
  35.  
  36. if turtle.detect()==false then
  37. turtle.forward()
  38. end
  39.  
  40. end
  41.  
  42. function ruchpelny()
  43.  
  44. if sygnal()=="nic" then
  45. ruchpodstawowy()
  46. end
  47.  
  48. if sygnal()=="lisc" then
  49. turtle.dig()
  50. end
  51.  
  52. if sygnal()=="trawa" then
  53. turtle.dig()
  54. end
  55.  
  56. if sygnal()=="kwiatek" then
  57. turtle.dig()
  58. end
  59.  
  60.  
  61. if sygnal()=="drewno" then
  62. while sygnal()=="drewno" do
  63. turtle.dig()
  64. turtle.digUp()
  65. turtle.up()
  66. end
  67. end
  68.  
  69. end
  70.  
  71. function obrotprawo()
  72. turtle.turnRight()
  73. ruchpelny()
  74. turtle.turnRight()
  75. end
  76.  
  77. function obrotlewo()
  78. turtle.turnLeft()
  79. ruchpelny()
  80. turtle.turnLeft()
  81. end
  82.  
  83. local arg1, arg2 = ...
  84.  
  85. p=1
  86. zwr=0
  87.  
  88. for p=1,arg2 do
  89. u=1
  90.   for u=1,arg1 do
  91.   ruchpelny()
  92.   u=u+1
  93.   end
  94. zwr=zwr+1
  95.   if zwr==1 then
  96.     obrotprawo()
  97.   else
  98.     obrotlewo()
  99.     zwr=0
  100.   end
  101. end
Advertisement
Add Comment
Please, Sign In to add comment