Advertisement
BruceWplays

Mine

Oct 11th, 2022 (edited)
1,035
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.83 KB | None | 0 0
  1. hi = 2
  2. dep = 35
  3. wid = 35
  4.  
  5. whi = hi
  6. wdep = dep
  7. wwid = wid
  8.  
  9. if turtle.dig() then
  10. end
  11. turtle.forward()
  12. turtle.turnLeft()
  13.  
  14. secnd = 0
  15. stopdig = 0
  16. secndlk = 0
  17.  
  18. if hi / 2 == math.floor(hi / 2) then
  19.     turdigleft = 1
  20. elseif hi / 2 ~= math.floor(hi / 2) then
  21.     turdigleft = 0
  22. end
  23.  
  24. blli = {
  25.     "minecraft:cobblestone",
  26.     "nifty:limestone",
  27.     "nifty:basalt",
  28.     "nifty:marble"
  29. }
  30.  
  31.  
  32. function invman()
  33.     for i=1,#blli do
  34.         bidis = i
  35.         for i2=1,16 do
  36.             --turtle.select(i2)
  37.             itemcheckm = turtle.getItemDetail(i2)
  38.             if turtle.getItemDetail(i2) ~= nil then
  39.                 if turtle.getItemDetail(i2).name == blli[bidis] then
  40.                     turtle.select(i2)
  41.                     turtle.dropDown(i2)
  42.                 end
  43.             end
  44.         end
  45.     end
  46.     --turtle.select(16)
  47.     if turtle.getItemCount(16) > 0 then
  48.         exitmine = 1
  49.         os.exit()
  50.     end
  51.     turtle.select(1)
  52.  
  53. end
  54.  
  55.  
  56.  
  57.  
  58. local function mantudir()
  59.     secndlk = 0
  60.     if secnd == 1 then
  61.         if hi / 2 ~= math.floor(hi / 2) then
  62.             if turdigleft == 1 then
  63.                 turdigleft = 0
  64.             else
  65.                 turdigleft = 1
  66.             end
  67.         end
  68.         secnd = 0
  69.         secndlk = 1
  70.     end
  71.     if secndlk == 0 then
  72.         secnd = 1
  73.     end
  74. end
  75. local hidone = 0
  76.  
  77. local function redrawdig()
  78.     term.clear()
  79.     term.setCursorBlink(false)
  80.     term.setCursorPos(1,1)
  81.     print("Depth: "..wdep)
  82.     term.setCursorPos(1,2)
  83.     print("Hight: "..whi)
  84.     term.setCursorPos(1,3)
  85.     print("Width: "..wwid)
  86. end
  87. redrawdig()
  88. local function turncurdig()
  89.     if turdigleft == 0 then
  90.         turtle.turnRight()
  91.         mantudir()
  92.     else
  93.         turtle.turnLeft()
  94.         mantudir()
  95.     end
  96. end
  97. tddown = 1
  98. local function turndig()
  99.     local i = hi
  100.     while i > 1 do
  101.         if turtle.detectDown() then
  102.             turtle.digDown()
  103.         end
  104.         if turtle.down() then
  105.             i = i - 1
  106.             if i < 2 then
  107.                 tddown = 1
  108.             end
  109.         end
  110.     end
  111.     turncurdig()
  112.     while turtle.detect() do
  113.         turtle.dig()
  114.         invman()
  115.     end
  116.     turtle.forward()
  117.     turncurdig()
  118. end
  119. if exitmine ~= 1 then
  120. while wdep > 0 do
  121.     if stopdig == 0 then
  122.     while whi > 0 do
  123.         while wwid > 1 do
  124.             while turtle.detect() do
  125.                 turtle.dig()
  126.                 if exitmine == 1 then
  127.                     break
  128.                 end
  129.                 invman()
  130.             end
  131.             if exitmine == 1 then
  132.                 break
  133.             end
  134.             if turtle.forward() then
  135.                 wwid = wwid - 1
  136.             end
  137.             redrawdig()
  138.         end
  139.         if exitmine == 1 then
  140.             break
  141.         end
  142.         if whi > 1 then
  143.             while turtle.detectUp() do
  144.                 turtle.digUp()
  145.             end
  146.             if turtle.up() then
  147.                 hidone = hidone + 1
  148.             end
  149.             if turtle.turnLeft() then
  150.                 hidone = hidone + 1
  151.             end
  152.             if turtle.turnLeft() then
  153.                 hidone = hidone + 1
  154.             end
  155.         end
  156.         if exitmine == 1 then
  157.             break
  158.         end
  159.         wwid = wid
  160.         if hidone > 2 or whi < 2 then
  161.             whi = whi - 1
  162.         else
  163.             term.clear()
  164.             term.setCursorPos(1,1)
  165.             print("Error")
  166.             shell.exit()
  167.         end
  168.         hidone = 0
  169.         redrawdig()
  170.        
  171.     end
  172.     end
  173.     if exitmine == 1 then
  174.         break
  175.     end
  176.     if wdep > 1 then
  177.         turndig()
  178.     end
  179.     if tddown > 0 or wdep < 2 then
  180.         wdep = wdep - 1
  181.         tddown = 0
  182.     end
  183.     if wdep < 1 then
  184.         stopdig = 1
  185.         break
  186.     end
  187.     whi = hi
  188.     redrawdig()
  189. end
  190. end
  191. print("Done")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement