Advertisement
lemarwin

wall builder

Jun 6th, 2023 (edited)
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.73 KB | Gaming | 0 0
  1. m = peripheral.wrap("right")
  2. m.link(2)
  3.  
  4. local tArgs= { ... }
  5. local l=tonumber(tArgs[1])
  6. local w=tonumber(tArgs[2])
  7. local h=tonumber(tArgs[3])
  8. local function refuel()
  9.     turtle.select(1)
  10.     turtle.refuel(5)
  11.     m.resupply(1)
  12.     turtle.select(2)
  13. end
  14.  
  15. local function buildForward(n)
  16.     x = 0
  17.     while x<n do
  18.         if turtle.getFuelLevel()<50 then refuel() end
  19.         m.resupply(2)
  20.         turtle.placeDown()
  21.         x = x + 1
  22.         if x < n then turtle.forward() end
  23.     end
  24. end
  25.  
  26. z = 0
  27. turtle.select(2)
  28. while z < h do
  29.     buildForward(l)
  30.     turtle.turnLeft()
  31.     buildForward(w)
  32.     turtle.turnLeft()
  33.     buildForward(l)
  34.     turtle.turnLeft()
  35.     buildForward(w)
  36.     turtle.turnLeft()
  37.     z = z + 1
  38.     if z < h then turtle.up() end
  39. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement