Guest User

makewalls.lua

a guest
Jun 30th, 2023
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.30 KB | None | 0 0
  1. args = {...}
  2. local start = tonumber(args[1])
  3. local steps = tonumber(args[2])
  4. local depth = tonumber(args[3])
  5. local width = tonumber(args[4])
  6.  
  7. local consume = steps * depth * width
  8. if turtle.getFuelLevel() <= consume then
  9.   turtle.select(1)
  10.   turtle.refuel(math.floor(consume/80)+1)
  11. end
  12. local fuel = turtle.getFuelLevel()
  13. print("fuel:"..tostring(fuel))
  14.  
  15. local function GetBlocks(z)
  16.   for i=1,z do
  17.     turtle.down()
  18.   end
  19.   turtle.turnLeft()
  20.   for i=1,3 do
  21.     turtle.forward()
  22.   end
  23.   turtle.turnRight()
  24.   turtle.suck()
  25.   turtle.turnLeft()
  26.   for i=1,3 do
  27.     turtle.back()
  28.   end
  29.   turtle.turnRight()
  30.   for i=1,z do
  31.     turtle.up()
  32.   end
  33. end
  34.  
  35. local function PutLine(wl)
  36.   for i=1, tonumber(wl) do
  37.     if not turtle.detectDown() then
  38.       print("place")
  39.       turtle.placeDown()
  40.     else
  41.       print("skip")
  42.     end
  43.     turtle.forward()
  44.   end
  45. end
  46.  
  47. local function MakeWall(d, w)
  48.   PutLine(d)
  49.   turtle.turnRight()
  50.   PutLine(w)
  51.   turtle.turnRight()
  52.   PutLine(d)
  53.   turtle.turnRight()
  54.   PutLine(w)
  55.   turtle.turnRight()
  56. end
  57.  
  58. local cz = 0
  59. turtle.select(2)
  60. for i=1,start do
  61.   turtle.up()
  62.   cz = cz + 1
  63. end
  64. for i=1,steps do
  65.   cz = cz + 1
  66.   turtle.forward()
  67.   MakeWall(depth, width)
  68.   turtle.back()
  69.   GetBlocks(cz)
  70. end
  71. for i=1,start do
  72.   turtle.down()
  73.   cz = cz - 1
  74. end
  75.  
Advertisement
Add Comment
Please, Sign In to add comment