Advertisement
fatboychummy

3x3place

Aug 20th, 2019
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.31 KB | None | 0 0
  1. local height = tonumber(({...})[1])
  2.  
  3. local oldD = turtle.placeDown
  4. local oldU = turtle.placeUp
  5. local old = turtle.place
  6.  
  7. local function sel()
  8.   for i = 1, 16 do
  9.     if turtle.getItemCount(i) > 0 then
  10.       turtle.select(i)
  11.       return
  12.     end
  13.   end
  14. end
  15.  
  16. function turtle.placeDown()
  17.   sel()
  18.   return oldD()
  19. end
  20.  
  21. function turtle.placeUp()
  22.   sel()
  23.   return oldU()
  24. end
  25.  
  26. function turtle.place()
  27.   sel()
  28.   return old()
  29. end
  30.  
  31.  
  32. local function up()
  33.   local plcmnt = height - 1
  34.  
  35.   for i = 1, plcmnt do
  36.     turtle.up()
  37.     turtle.placeDown()
  38.   end
  39. end
  40.  
  41. local function down(no)
  42.   local plcmnt = no and height or height - 1
  43.  
  44.   for i = 1, plcmnt do
  45.     turtle.down()
  46.     if not no then
  47.       turtle.placeUp()
  48.     end
  49.   end
  50. end
  51.  
  52. local last = down
  53. local function ue(index)
  54.   if last == down then
  55.     up(index)
  56.     last = up
  57.   else
  58.     down(index)
  59.     last = down
  60.   end
  61. end
  62.  
  63. local function ua(o)
  64.   if o ~= 3 then
  65.     turtle.back()
  66.     turtle.place()
  67.   end
  68. end
  69.  
  70.  
  71. for o = 1, 3 do
  72.   ue()
  73.   ua(o)
  74. end
  75. turtle.turnRight()
  76. turtle.back()
  77. turtle.place()
  78. turtle.turnRight()
  79.  
  80. for o = 1, 3 do
  81.   ue()
  82.   ua(o)
  83. end
  84. turtle.turnLeft()
  85. turtle.back()
  86. turtle.place()
  87. turtle.turnLeft()
  88.  
  89. for o = 1, 3 do
  90.   ue()
  91.   ua(o)
  92. end
  93. turtle.up()
  94. turtle.placeDown()
  95.  
  96. turtle.back()
  97. down(true)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement