AlertK

Untitled

Dec 26th, 2015
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. turtle.up()
  29. end
  30.  
  31. if turtle.detect()==false then
  32. turtle.forward()
  33. end
  34.  
  35. end
  36.  
  37. function ruchpelny()
  38.  
  39. if sygnal()=="nic" then
  40. ruchpodstawowy()
  41. end
  42.  
  43. if sygnal()=="lisc" then
  44. turtle.dig()
  45. end
  46.  
  47. if sygnal()=="trawa" then
  48. turtle.dig()
  49. end
  50.  
  51. if sygnal()=="kwiatek" then
  52. turtle.dig()
  53. end
  54.  
  55.  
  56. if sygnal()=="drewno" then
  57. while sygnal()=="drewno" do
  58. turtle.dig()
  59. turtle.digUp()
  60. turtle.up()
  61. end
  62. end
  63.  
  64. end
  65.  
  66. function obrotprawo()
  67. turtle.turnRight()
  68. ruchpelny()
  69. turtle.turnRight()
  70. end
  71.  
  72. function obrotlewo()
  73. turtle.turnLeft()
  74. ruchpelny()
  75. turtle.turnLeft()
  76. end
  77.  
  78. local arg1, arg2 = ...
  79.  
  80. p=1
  81. zwr=0
  82.  
  83. for p=1,arg2 do
  84. u=1
  85.   for u=1,arg1 do
  86.   ruchpelny()
  87.   u=u+1
  88.   end
  89. zwr=zwr+1
  90.   if zwr==1 then
  91.     obrotprawo()
  92.   else
  93.     obrotlewo()
  94.     zwr=0
  95.   end
  96. end
Add Comment
Please, Sign In to add comment