Advertisement
Guest User

quarry

a guest
Jul 21st, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.76 KB | None | 0 0
  1. turtle.select(1)
  2. turtle.refuel(64)
  3. print("radius: ")
  4. radius = tonumber(io.read())
  5. print("depth: ")
  6. depth = tonumber(io.read())
  7.  
  8. progress = 0
  9.  
  10. d = depth
  11. h = radius*2
  12. w = radius
  13.  
  14. maxprogress = depth * h * h - depth * w * 2
  15.  
  16. di = 0
  17. hi = 0
  18. wi = 0
  19.  
  20. writeposx, writeposy = term.getCursorPos()
  21.  
  22. function update()
  23.   term.setCursorPos(writeposx, writeposy)
  24.   term.write(tostring(math.floor(progress/maxprogress*100)) .. "%")
  25. end
  26.  
  27. while(di < d)
  28. do
  29.   if turtle.getItemCount(10) > 0 then
  30.     i = 0
  31.     while(i < di)
  32.     do
  33.       turtle.up()
  34.       i = i + 1
  35.     end
  36.     slot = 2
  37.     while(slot < 16)
  38.     do
  39.       turtle.select(slot)
  40.       turtle.dropUp(64)
  41.       slot = slot + 1
  42.     end
  43.     turtle.select(1)
  44.     i = 0
  45.     while(i < di)
  46.     do
  47.       turtle.down()
  48.       i = i + 1
  49.     end
  50.   end
  51.  
  52.   wi = 0
  53.   while(wi < w)
  54.   do
  55.     hi = 1
  56.     while(hi < h)
  57.     do
  58.       turtle.digDown()
  59.       turtle.forward()
  60.       turtle.digDown()
  61.       progress = progress + 1
  62.       update()
  63.       hi = hi + 1
  64.     end
  65.     turtle.turnLeft()
  66.     turtle.forward()
  67.     turtle.turnLeft()
  68.     hi = 1
  69.     while(hi < h)
  70.     do
  71.       turtle.digDown()
  72.       turtle.forward()
  73.       turtle.digDown()
  74.       progress = progress + 1
  75.       update()
  76.       hi = hi + 1
  77.     end
  78.     wi = wi + 1
  79.     if wi ~= w then
  80.       turtle.turnRight()
  81.       turtle.forward()
  82.       turtle.turnRight()
  83.     end
  84.   end
  85.   turtle.turnLeft()
  86.   i = 1
  87.   while(i < h)
  88.   do
  89.     turtle.forward()
  90.     i = i + 1
  91.   end
  92.   turtle.turnLeft()
  93.   di = di + 1
  94.   if di ~= d then
  95.     turtle.down()
  96.   end
  97. end
  98. i = 1
  99. while(i < depth)
  100. do
  101.   turtle.up(depth)
  102.   i = i + 1
  103. end
  104. slot = 2
  105. while(slot < 16)
  106. do
  107.   turtle.select(slot)
  108.   turtle.dropUp(64)
  109.   slot = slot + 1
  110. end
  111. turtle.select(1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement