Advertisement
Catdisk

building.lua

Mar 8th, 2021 (edited)
1,224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.09 KB | None | 0 0
  1. function selectItemRow(i)
  2.     currentSlot = 1 + ((i-1) * 4)
  3.     turtle.select(currentSlot)
  4.     while turtle.getItemCount(currentSlot) == 0 do
  5.         if currentSlot + 1 == 1 + i * 4 do
  6.             error("no items!")
  7.         end
  8.         currentSlot = currentSlot + 1
  9.         turtle.select(currentSlot)
  10.     end
  11. end
  12.  
  13. function turnDir(row)
  14.     if dir % 2 == 0 then
  15.         turtle.turnRight()
  16.     else
  17.         turtle.turnLeft()
  18.     end
  19. end
  20.  
  21. function nextRow(dir, row)
  22.     turnDir(row)
  23.     if dir == 0 then
  24.         turtle.up()
  25.     elseif dir == 1 then
  26.         turtle.forward()
  27.     elseif dir == 2 then
  28.         turtle.up()
  29.         turtle.forward()
  30.     end
  31.     turnDir(row)
  32.     turtle.forward()
  33. end
  34.  
  35. materials = {1, 2}
  36. offset = {0, 0, 2, 0, 2, 2, 1, 2}
  37.  
  38. for n=0, 9 do
  39.     currentMaterial = 1
  40.     if n == 1 or n == 2 then
  41.         currentMaterial = 2
  42.     end
  43.     for len=0, 20 do
  44.         turtle.selectItemRow(currentMaterial)
  45.         turtle.placeDown()
  46.         turtle.forward()
  47.     end
  48.     nextRow(offset[n], n)
  49. end
  50. while not turttle.detectDown() do
  51.     turtle.down()
  52. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement