Advertisement
melzneni

Ground

Feb 3rd, 2019
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. args={...}
  2. inNum=1
  3. turtle.select(inNum)
  4.  
  5. function place()
  6.  
  7. turtle.select(inNum)
  8.  
  9. if turtle.getItemCount(inNum)==0 then
  10.  
  11. inNum=inNum+1
  12.  
  13. turtle.select(inNum)
  14.  
  15. end
  16.  
  17. if not turtle.detect() then
  18. turtle.placeDown()
  19. end
  20.  
  21. end
  22.  
  23. function placeAndMoveX(wx)
  24.  
  25. for x=1,wx do
  26.  
  27. turtle.forward()
  28. place()
  29.  
  30. end
  31.  
  32. end
  33.  
  34. if table.getn(args)~=2 then
  35. print("please insert x and y arguments")
  36. else
  37. wx=tonumber(args[1])
  38. wy=tonumber(args[2])
  39.  
  40. turtle.forward()
  41. place()
  42.  
  43. for y=1,wy do
  44.  
  45. placeAndMoveX(wx-1)
  46.  
  47. if y<wy then
  48.  
  49. if y%2==1 then
  50. turtle.turnRight()
  51. turtle.forward()
  52. place()
  53. turtle.turnRight()
  54. else
  55. turtle.turnLeft()
  56. turtle.forward()
  57. place()
  58. turtle.turnLeft()
  59. end
  60.  
  61. end
  62.  
  63. end
  64.  
  65. end
  66.  
  67. --getItemCount(1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement