melzneni

Floor2

Feb 24th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. if (turtle.detect()) then
  27. turtle.dig()
  28. end
  29. turtle.forward()
  30. if (turtle.detectUp()) then
  31. turtle.digUp()
  32. end
  33. place()
  34.  
  35. end
  36.  
  37. end
  38.  
  39. if table.getn(args)~=2 then
  40. print("please insert x and y arguments")
  41. else
  42. wx=tonumber(args[1])
  43. wy=tonumber(args[2])
  44.  
  45. turtle.forward()
  46. place()
  47.  
  48. for y=1,wy do
  49.  
  50. placeAndMoveX(wx-1)
  51.  
  52. if y<wy then
  53.  
  54. if y%2==1 then
  55. turtle.turnRight()
  56. turtle.forward()
  57. place()
  58. turtle.turnRight()
  59. else
  60. turtle.turnLeft()
  61. turtle.forward()
  62. place()
  63. turtle.turnLeft()
  64. end
  65.  
  66. end
  67.  
  68. end
  69.  
  70. end
  71.  
  72. --getItemCount(1)
Add Comment
Please, Sign In to add comment