uepyon

makewalls.lua

Jun 30th, 2023 (edited)
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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) * 2
  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-1 do
  61.   turtle.up()
  62.   cz = cz + 1
  63. end
  64. for i=1,steps do
  65.   if turtle.getItemCount() < (depth + width) * 2 then
  66.     GetBlocks(cz)
  67.   end
  68.   turtle.up()
  69.   cz = cz + 1
  70.   turtle.forward()
  71.   MakeWall(depth, width)
  72.   turtle.back()
  73. end
  74. for i=1,cz do
  75.   turtle.down()
  76. end
Tags: ccTweaked
Advertisement
Add Comment
Please, Sign In to add comment