Advertisement
tahg

Dome

Dec 7th, 2012
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. local function distSq(x, y, z)
  2. return x * x + y * y + z * z
  3. end
  4.  
  5. local function build()
  6. while turtle.getItemCount(1) <= 1 do
  7. if not supply.resupply(1) then
  8. os.sleep(10)
  9. end
  10. end
  11. turtle.placeDown()
  12. end
  13.  
  14. local quarters = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}, {1, 0}}
  15. os.loadAPI("utils")
  16. supply = peripheral.wrap("right")
  17. args = {...}
  18. if #args < 1 then os.exit() end
  19. radius = args[1] + 0
  20. rmax = (radius + .5) * (radius + .5)
  21. rmin = (radius - .5) * (radius - .5)
  22. for height = turtle.y, radius do
  23. utils.goto(turtle.x, height, turtle.z)
  24. for i = 1, 4 do
  25. local max = radius
  26. for over = 0, radius do
  27. out = max
  28. while (out > 0) and distSq(out, height, over) >= rmax do
  29. out = out - 1
  30. end
  31. max = out
  32. while (out > 0) and distSq(out, height, over) > rmin do
  33. utils.goto(quarters[i][1] * out +
  34. quarters[i+1][1] * over,
  35. height,
  36. quarters[i][2] * out +
  37. quarters[i+1][2] * over)
  38. build()
  39. out = out - 1
  40. end
  41. end
  42. end
  43. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement