Advertisement
Guest User

quarry

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