AdditionalPylons

build_wall.lua

Jun 5th, 2026 (edited)
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local l,w,h = ...
  2. local function slot_plus() turtle.select(turtle.getSelectedSlot()%16+1) end
  3. local function build_line(n)
  4.     for i=1,n do
  5.         if not turtle.placeDown() then
  6.             slot_plus()
  7.             turtle.placeDown()
  8.         end
  9.         while not turtle.getItemCount() do slot_plus() end
  10.         turtle.forward()
  11.     end
  12. end
  13. local function build_layer(l,w)
  14.     build_line(l-1)
  15.     turtle.turnLeft()
  16.     build_line(w-1)
  17.     turtle.turnLeft()
  18.     build_line(l-1)
  19.     turtle.turnLeft()
  20.     build_line(w-1)
  21.     turtle.turnLeft()
  22. end
  23. local function build_wall(l,w,h)
  24.     for i=1,h do
  25.         turtle.up()
  26.         build_layer(l,w)
  27.     end
  28. end
  29.  
  30. if not l then
  31.     error("Must have three arguments: length, width and height.")
  32. end
  33. if tonumber(l) and tonumber(w) and tonumber(h) then
  34.     build_wall(l,w,h)
  35. end
  36. return {build=build_wall}
  37.  
Advertisement
Add Comment
Please, Sign In to add comment