BillBodkin

circlePlat

Sep 19th, 2021 (edited)
337
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local dia = 62
  2.  
  3. local x = 0
  4. local z = 0
  5. local dirf = 0
  6.  
  7. function SelectBlock()
  8.     while true do
  9.         for i = 1, 16 do
  10.             if turtle.getItemCount(i) > 0 then
  11.                 turtle.select(i)
  12.                 return
  13.             end
  14.         end
  15.         print("Out of blocks, press enter to continue")
  16.         read()
  17.     end
  18. end
  19.  
  20. local l = 0
  21. local c = 0
  22. while l <= (dia * 2 + 2) do
  23.     for n = 1, l do
  24.         turtle.forward()
  25.         if dirf % 4 == 0 then
  26.             x = x + 1
  27.         elseif dirf % 4 == 1 then
  28.             z = z + 1
  29.         elseif dirf % 4 == 2 then
  30.             x = x - 1
  31.         elseif dirf % 4 == 3 then
  32.             z = z - 1
  33.         end
  34.         if math.sqrt((x*x)+(z*z)) <= dia then
  35.             SelectBlock()
  36.             turtle.placeDown()
  37.         end
  38.     end
  39.     turtle.turnRight()
  40.     dirf = dirf + 1
  41.     c = c + 1
  42.     if c % 4 == 0 or c % 4 == 2 then
  43.         l = l + 1
  44.     end
  45. end
Add Comment
Please, Sign In to add comment