serafim7

quarry карьер для синего бура GraviSuite в режиме 3х3 [OpenComputers]

Jan 10th, 2021 (edited)
896
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 21.28 KB | None | 0 0
  1. --[[ opencomputers карьер by serafim
  2.      pastebin.com/D0PbHYZc   update 13.06.21
  3.  
  4. Только для "синего" бура GraviSuite в режиме 3х3 !!!
  5.  
  6. Копает змейкой квадрат проходя три слоя блоков за один подход,
  7. пока не выкопает весь объём до бэдрока или не упрётся в
  8. не разрушаемый блок, при этом вернётся к старту и сообщит о проблеме,
  9. также предложит продолжить копать с последней позиции.
  10.  
  11. требования:
  12. инвентарь, контроллер инвентаря, генератор, улучшение парение.
  13.  
  14. пример сборки:
  15. https://i.imgur.com/fR7F4fA.png
  16.  
  17. использование:
  18. на старте, сзади робота поставить сундук,
  19. положить в сундук запасной бур и уголь(64 шт)
  20. Робот может работать без сундука и всего прочего, нужен только бур.
  21.  
  22. пример запуска:
  23. quarry 3 9 или quarry
  24. -- 3  размер карьера от 1 до 5 (в данном случае 36/36)
  25. -- 9  опустится в низ на 9 блоков (желательно копать под отрытым небом)
  26.  
  27. получить список предметов:
  28. https://pastebin.com/au9etcfF
  29. ]]--
  30.  
  31. local a = {...}
  32. local preset = tonumber(a[1]) --размер карьера от 1 до 5
  33. local down = tonumber(a[2]) or 2 --опустится в низ
  34.  
  35. --список мусора
  36. local scrap = {
  37.   "cobblestone", --булыжник
  38.   "stone",       --камень
  39.   "dirt",        --земля
  40.   "gravel",      --гравий
  41.   "flint",       --кремень
  42.   "sand",        --песок
  43.   "sandstone"    --песчаник
  44. }
  45.  
  46. --бур GraviSuite v1.7.10, v1.12.2
  47. local toollist = {
  48.   "advDDrill",
  49.   "advanceddrill"
  50. }
  51.  
  52. local event = require("event")
  53. local com = require('component')
  54. local keyboard = require("keyboard")
  55. local computer = require("computer")
  56. local fuelchest,fuelinv,refuel,charger = true,true,true,false
  57. local cheststart,ridht,bedrock = true,true,false
  58. local depth,xPos,zPos,xDir,zDir = 0,0,0,0,1
  59. local unloaded,durability,strip = 0,0,0
  60. local timestart = computer.uptime()
  61. local toolstrength = 0.07
  62. local x,y,z,xd,zd
  63.  
  64. if not com.isAvailable("robot") then
  65.   print("только роботы могут использовать эту программу")
  66.   os.exit()
  67. end
  68. local r = require("robot")
  69.  
  70. local invsize = r.inventorySize()
  71. local tools = invsize
  72. local coal = invsize-1
  73.  
  74. if not com.isAvailable("inventory_controller") then
  75.   print("нет контроллера инвентаря")
  76.   os.exit()
  77. end
  78. local i_c = com.inventory_controller
  79.  
  80. if not com.isAvailable("generator") then
  81.   print("нет генератора")
  82.   os.exit()
  83. end
  84. local gen = com.generator
  85.  
  86. --статус
  87. local function status(msg)
  88.   print("[ "..os.date("%H:%M:%S",computer.uptime()-timestart).." ] "..msg)
  89. end
  90.  
  91. --чанк лоадер
  92. local function chunkload(state)
  93.   if com.isAvailable("chunkloader") then
  94.     if state then
  95.       com.chunkloader.setActive(true)
  96.       print("чанк лоадер активен")
  97.     else
  98.       com.chunkloader.setActive(false)
  99.       print("чанк лоадер деактивирован".."\n")
  100.     end
  101.   end
  102. end
  103.  
  104. --поиск предмета в инвентаре робота
  105. local function slotitem(slot,list)
  106.   local item = i_c.getStackInInternalSlot(slot)
  107.   if item then
  108.     for j, name in pairs(list) do
  109.       if string.find(item.name,name) then
  110.         if item.charge == nil or item.charge/item.maxCharge > toolstrength then
  111.           return true
  112.         end
  113.       end
  114.     end
  115.   end
  116.   for i = 1,invsize do
  117.     if r.count(i) > 0 then
  118.       for j, name in pairs(list) do
  119.         local item = i_c.getStackInInternalSlot(i)
  120.         if item and string.find(item.name,name) then
  121.           if item.charge == nil or item.charge/item.maxCharge > toolstrength then
  122.             r.select(i)
  123.             r.transferTo(slot)
  124.             return true
  125.           end
  126.         end
  127.       end
  128.     end
  129.   end
  130.   return false
  131. end
  132.  
  133. --взять из сундука расходники
  134. local function servise(slotinv,list)
  135.   local inv = i_c.getInventorySize(3)
  136.   if inv then
  137.     if slotitem(slotinv,list) then
  138.       return true
  139.     end
  140.     r.select(slotinv)
  141.     if r.count(slotinv) > 0 and not r.drop() then
  142.       returnHome("в сундуке нет места")
  143.       return false
  144.     end
  145.     for slot = 1,inv do
  146.       for j, name in pairs(list) do
  147.         local item = i_c.getStackInSlot(3,slot)
  148.         if item and string.find(item.name,name) then
  149.           if item.charge == nil or item.charge/item.maxCharge > toolstrength then
  150.             i_c.suckFromSlot(3,slot)
  151.             return true
  152.           end
  153.         end
  154.       end
  155.     end
  156.     return false
  157.   else
  158.     returnHome("нет сундука")
  159.   end
  160. end
  161.  
  162. --заряжаемся от зарядчика
  163. local function charging()
  164.   local chardg = true
  165.   while true do
  166.     local e1 = computer.energy()
  167.     os.sleep(2)
  168.     local e2 = computer.energy()  
  169.     if e2 > e1 + 500 then
  170.       if chardg then
  171.         chardg = false
  172.         status("заряжаюсь...")
  173.       end
  174.       os.sleep(2)
  175.     else
  176.       break
  177.     end
  178.   end
  179. end
  180.  
  181. --сортируем лут
  182. local function sortlut(droplut)
  183.   status("сортирую лут...")
  184.   r.swingDown()
  185.   for i = 1,invsize do      
  186.     if r.count(i) > 0 then
  187.       local item = i_c.getStackInInternalSlot(i)
  188.       if string.find(item.name,"coal") then
  189.         r.select(i)
  190.         r.transferTo(coal)
  191.       else
  192.         for n = 1,#scrap do
  193.           if scrap[n] == item.name:gsub('%g+:','') then
  194.             r.select(i)
  195.             r.dropDown()
  196.             break
  197.           end
  198.         end
  199.       end
  200.     end
  201.   end
  202.   for i = 1,invsize-2 do
  203.     if r.count(i) == 0 then
  204.       for j = invsize-2,1,-1 do
  205.         if r.count(j) > 0 then
  206.           if j < i then
  207.             break
  208.           end
  209.           r.select(j)
  210.           r.transferTo(i)
  211.           break
  212.         end
  213.       end
  214.     end
  215.   end
  216.   local unload = function()
  217.     local inv = i_c.getInventorySize(3)
  218.     if inv then
  219.       cheststart = true
  220.       for i = 1,invsize-2 do
  221.         if r.count(i) > 0 then
  222.           r.select(i)
  223.           unloaded = unloaded + r.count(i)
  224.           if not r.drop() then
  225.             returnHome("в сундуке нет места")
  226.             return
  227.           end
  228.         end
  229.       end
  230.       if not charger then
  231.         servise(tools,toollist)
  232.       end
  233.       r.select(coal)
  234.       gen.insert()
  235.       servise(coal,{"coal"})
  236.       charging()
  237.     elseif not cheststart then
  238.       returnHome("инвентарь заполнен")
  239.     else
  240.       returnHome("нет сундука")
  241.     end
  242.     fuelchest = true
  243.     status("всего добыто руды: "..unloaded)
  244.   end
  245.   if r.count(invsize-6) > 0 then
  246.     status("возвращаюсь к сундуку сложить лут")
  247.     x,y,z,xd,zd = xPos,depth,zPos,xDir,zDir
  248.     goTo( 0,0,0,0,-1 )
  249.     unload()
  250.     goTo( x,y,z,xd,zd )
  251.   end
  252.   if droplut and cheststart then
  253.     unload()
  254.   end
  255.   r.select(1)
  256. end
  257.  
  258. --стоп
  259. local function stop(msg)
  260.   print("\n".."!!! стоп !!!".."\n"..msg.."\n")
  261.   r.setLightColor(0xFF0000)
  262.   r.turnAround()
  263.   chunkload(false)
  264.   computer.beep(1000, 1)
  265.   status("программа завершена")
  266.   os.exit()
  267. end
  268.  
  269. --возврат к старту
  270. function returnHome(msg,save,reason)
  271.   r.setLightColor(0xFF0000)
  272.   if save then
  273.     x,y,z,xd,zd = xPos,depth,zPos,xDir,zDir
  274.   end
  275.   if y ~= nil then
  276.     print("последняя глубина "..y)
  277.   end
  278.   goTo( 0,0,0,0,-1 )
  279.   if save and cheststart and r.count(1) > 0 then
  280.     sortlut(true)
  281.   end
  282.   goTo( 0,0,0,0,1 )
  283.   if reason then
  284.     print("причина возврата: "..reason)
  285.   end
  286.   status("!!! стоп !!!".."\n"..msg.."\n")
  287.   chunkload(false)
  288.   print("продолжить копать ? [Y/n]")
  289.   while true do
  290.     r.setLightColor(0xFFFFFF)
  291.     computer.beep(1000, 1)
  292.     r.setLightColor(0xFF0000)
  293.     local e = ({event.pull(10,"key_down")})[4]
  294.     if e == 49 then
  295.       computer.beep(500, 0.1)
  296.       print("программа завершена")
  297.       os.exit()
  298.     elseif e == 21 or e == 28 then
  299.       computer.beep(500, 0.1)
  300.       r.setLightColor(0xFFFFFF)
  301.       print("продолжаю копать...")
  302.       chunkload(true)
  303.       goTo( x,y,z,xd,zd )
  304.       break
  305.     end
  306.   end
  307. end
  308.  
  309. --дозаправка углём
  310. local function checkfuel()
  311.   if computer.energy() <= 6000 then
  312.     refuel = true
  313.   end
  314.   if gen.count() <= 10 and refuel then
  315.     for i = 1,invsize do
  316.       local item = i_c.getStackInInternalSlot(i)
  317.       if item and string.find(item.name,"coal") then
  318.         r.select(i)
  319.         r.transferTo(coal)
  320.       end
  321.     end
  322.     r.select(coal)
  323.     if gen.insert() then
  324.       fuelinv = true
  325.       status("заправился, угля в генераторе = "..gen.count())
  326.     elseif fuelchest and cheststart then
  327.       x,y,z,xd,zd = xPos,depth,zPos,xDir,zDir
  328.       status("возвращаюсь к сундуку за углем")
  329.       goTo( 0,0,0,0,-1 )
  330.       if servise(coal,{"coal"}) then
  331.         r.select(coal)
  332.         gen.insert()
  333.         status("заправился, угля в генераторе = "..gen.count())
  334.       else
  335.         fuelchest = false
  336.         status("в сундуке нет угля")
  337.       end
  338.       charging()
  339.       goTo( x,y,z,xd,zd )
  340.     else
  341.       refuel = false
  342.       if fuelinv then
  343.         fuelinv = false
  344.         status("нет угля в инвентаре робота !!!")
  345.       end
  346.     end
  347.     r.select(1)
  348.   end
  349.   if computer.energy() <= 5000 then
  350.     x,y,z,xd,zd = xPos,depth,zPos,xDir,zDir
  351.     status("энергии < 5 000 возвращаюсь")
  352.     goTo( 0,0,0,0,1 )
  353.     charging()
  354.     if computer.energy() >= 10000 then
  355.       status("зарядился :)")
  356.       goTo( x,y,z,xd,zd )
  357.       return
  358.     elseif gen.count() >= 10 then
  359.       status("мало энергии, заряжаюсь до 10 000")
  360.       while true do
  361.         os.sleep(10)
  362.         if computer.energy() >= 10000 then
  363.           status("зарядился :)")
  364.           goTo( x,y,z,xd,zd )
  365.           break
  366.         elseif gen.count() == 0 then
  367.           returnHome("закончился уголь")
  368.           break
  369.         end
  370.       end
  371.     else
  372.       returnHome("закончился уголь")
  373.     end
  374.   end
  375. end
  376.  
  377. --проверяем разряженный электроинструмент
  378. local function electric(eq1,eq2)
  379.   if eq1 then
  380.     r.select(tools)
  381.     i_c.equip()
  382.   end
  383.   local item = i_c.getStackInInternalSlot(tools)
  384.   if eq2 then
  385.     i_c.equip()
  386.   end
  387.   if item and item.charge ~= nil then
  388.     if item.charge/item.maxCharge <= toolstrength then
  389.       return true
  390.     end
  391.   end
  392.   return false
  393. end
  394.  
  395. --берем запасной инструмент
  396. local function tool(save)
  397.   local checktool = r.durability()
  398.   if checktool == nil or checktool <= toolstrength then
  399.     if save then
  400.       x,y,z,xd,zd = xPos,depth,zPos,xDir,zDir
  401.     end
  402.     if slotitem(tools,toollist) then
  403.       r.select(tools)
  404.       i_c.equip()
  405.       status("взял инструмент в инвентаре")
  406.       local item = i_c.getStackInInternalSlot(tools)
  407.       if item and item.charge == nil then
  408.         r.dropDown()
  409.       end
  410.       durability = 0
  411.     elseif charger and electric(true,true) then
  412.       local chargetool = function(msg)
  413.         local inv = i_c.getInventorySize(3)
  414.         if inv and inv <= 4 then
  415.           if not r.drop() then
  416.             charger = false
  417.             status("в зарядчике нет места")
  418.           else
  419.             status(msg)
  420.             while true do
  421.               local c1 = i_c.getStackInSlot(3,1)
  422.               os.sleep(2)
  423.               local c2 = i_c.getStackInSlot(3,1)
  424.               if c2.charge < c1.charge + 500 then
  425.                 break
  426.               end
  427.             end
  428.             if not r.suck() then
  429.               charger = false
  430.               status("не могу забрать инструмент")
  431.             elseif electric() then
  432.               charger = false
  433.               status("инструмент не заряжен")
  434.             end
  435.           end
  436.         else
  437.           charger = false
  438.           status("зарядчик не найден")
  439.         end
  440.         if charger == false then
  441.           tool()
  442.         end
  443.       end
  444.       status("возвращаюсь к зарядчику инструмента")
  445.       goTo( 0,0,0,-1,0 )
  446.       electric(true)
  447.       chargetool("заряжаю инструмент...")
  448.       if electric(true) then
  449.         chargetool("заряжаю запасной инструмент...")
  450.       end
  451.       charging()
  452.       durability = 0
  453.       goTo( x,y,z,xd,zd )
  454.     elseif cheststart then
  455.       local savetool = function()
  456.         local item = i_c.getStackInInternalSlot(tools)
  457.         if item and item.charge ~= nil then
  458.           local inv = i_c.getInventorySize(3)
  459.           if inv then
  460.             if not r.drop() then
  461.               returnHome("в сундуке нет места")
  462.               return
  463.             end
  464.           else
  465.             returnHome("нет сундука")
  466.             return
  467.           end
  468.         else
  469.           r.dropDown()
  470.         end
  471.       end
  472.       status("возвращаюсь к сундуку за инструментом")
  473.       goTo( 0,0,0,0,-1 )
  474.       r.select(tools)
  475.       savetool()
  476.       if servise(tools,toollist) then
  477.         i_c.equip()
  478.         savetool()
  479.         servise(tools,toollist)
  480.         status("взял инструмент из сундука")
  481.         charging()
  482.         durability = 0
  483.         goTo( x,y,z,xd,zd )
  484.       else
  485.         returnHome("в сундуке нет инструмента")
  486.       end
  487.     else
  488.       returnHome("нет инструмента")
  489.     end
  490.     r.select(1)
  491.   elseif r.detect() then
  492.     local d1 = string.format("%.3f",r.durability())
  493.     r.swing()
  494.     local d2 = string.format("%.3f",r.durability())
  495.     if d2 < d1 then
  496.       durability = math.floor(d2/(d1-d2))
  497.     end
  498.   end
  499. end
  500.  
  501. --движение в сторону side
  502. local function robotMove(side)
  503.   while true do
  504.     local ok,reason = com.robot.move(side)
  505.     if ok then
  506.       return true
  507.     elseif reason and reason == "already moving" then
  508.       os.sleep(0.1)
  509.     else
  510.       return false,reason
  511.     end
  512.   end
  513. end
  514.  
  515. --движемся в верх
  516. local function tryUp()
  517.   local tru = 0
  518.   while true do
  519.     if robotMove(1) then
  520.       depth = depth - 1
  521.       break
  522.     else
  523.       r.swingUp()
  524.     end
  525.     tru = tru + 1
  526.     if tru >= 7 then
  527.       tru = 0
  528.       returnHome("не могу подняться",true)
  529.     end
  530.   end
  531. end
  532.  
  533. --обнаружение бедрока
  534. local function checkbedrock()
  535.   for i = 1,3 do
  536.     if r.detectDown() and not r.swingDown() then
  537.       if bedrock then
  538.         break
  539.       elseif i == 2 then
  540.         tool(true)
  541.       elseif i == 3 then
  542.         status("низ достигнут !")
  543.         bedrock = true
  544.         if y ~= nil then
  545.           status("глубина "..y)
  546.         end
  547.       end
  548.     else
  549.       break
  550.     end
  551.   end
  552. end
  553.  
  554. --копаем и движемся вперед
  555. local function digForward(count)
  556.   for i = 1,count do
  557.     if durability <= 3 then
  558.       tool(true)
  559.     end
  560.     r.swing()
  561.     durability = durability - 10
  562.     if r.count(invsize-2) > 0 then
  563.       sortlut()
  564.     end
  565.     local tru,reason = 0
  566.     while true do
  567.       if r.detect() then
  568.         _,reason = r.swing()
  569.         durability = durability - 1
  570.       else
  571.         ok,reason = robotMove(3)
  572.         if ok then
  573.           xPos = xPos + xDir
  574.           zPos = zPos + zDir
  575.           break
  576.         end
  577.       end
  578.       tru = tru + 1
  579.       if tru == 3 then
  580.         tool(true)
  581.       elseif tru == 4 or tru == 5 then
  582.         if bedrock then
  583.           tryUp()
  584.         end
  585.       elseif tru >= 20 then
  586.         tru = 0
  587.         returnHome("непреодолимое препятствие",true,reason)
  588.       end
  589.     end
  590.   end
  591.   r.swing()
  592. end
  593.  
  594. --спускаемся в низ
  595. local function go_down()
  596.   for zz = 1,down+2 do
  597.     while true do
  598.       checkbedrock()
  599.       if robotMove(0) then
  600.         depth = depth + 1
  601.         break
  602.       elseif bedrock then
  603.         while true do
  604.           r.swing()
  605.           if r.detect() then
  606.             tryUp()
  607.           else
  608.             return
  609.           end
  610.         end
  611.       end
  612.     end
  613.   end
  614.   tryUp()
  615.   tryUp()
  616. end
  617.  
  618. --поворот в лево
  619. local function turnLeft()
  620.   while not r.turnLeft() do
  621.     os.sleep(0.1)
  622.   end
  623.   xDir, zDir = -zDir, xDir
  624. end
  625.  
  626. --поворот в право
  627. local function turnRight()
  628.   while not r.turnRight() do
  629.     os.sleep(0.1)
  630.   end
  631.   xDir, zDir = zDir, -xDir
  632. end
  633.  
  634. --поворот strip
  635. local function turn()
  636.   if (strip % 2 == 0) then
  637.     turnRight()
  638.   else
  639.     turnLeft()
  640.   end
  641. end
  642.  
  643. --навигация к сундуку
  644. function goTo( x,y,z,xd,zd )
  645.   r.select(1)
  646.   while depth > y do
  647.     if r.up() then
  648.       depth = depth - 1
  649.     else
  650.       r.swingUp()
  651.     end
  652.   end
  653.   if xPos > x then
  654.     while xDir ~= -1 do
  655.       turnRight()
  656.     end
  657.     while xPos > x do
  658.       if r.forward() then
  659.         xPos = xPos - 1
  660.       else
  661.         r.swing()
  662.       end
  663.    end
  664.   elseif xPos < x then
  665.     while xDir ~= 1 do
  666.       turnRight()
  667.     end
  668.    while xPos < x do
  669.       if r.forward() then
  670.         xPos = xPos + 1
  671.       else
  672.         r.swing()
  673.       end
  674.     end
  675.   end
  676.   if zPos > z then
  677.     while zDir ~= -1 do
  678.       turnRight()
  679.     end
  680.     while zPos > z do
  681.       if r.forward() then
  682.         zPos = zPos - 1
  683.       else
  684.         r.swing()
  685.       end
  686.     end
  687.   elseif zPos < z then
  688.     while zDir ~= 1 do
  689.       turnRight()
  690.     end
  691.     while zPos < z do
  692.       if r.forward() then
  693.         zPos = zPos + 1
  694.       else
  695.         r.swing()
  696.       end
  697.     end
  698.   end
  699.   while depth < y do
  700.     if r.down() then
  701.       depth = depth + 1
  702.       r.swingDown()
  703.     end
  704.   end
  705.   while zDir ~= zd or xDir ~= xd do
  706.     turnRight()
  707.   end
  708. end
  709.  
  710. --копаем
  711. local function dig()
  712.   os.execute("cls")
  713.   print("Только для синего бура GraviSuite в режиме 3х3".."\n")
  714.   local presets = {4,8,12,16,20}
  715.   if preset and presets[preset] then
  716.     line = presets[preset]
  717.     length = line*3
  718.   else
  719.     print("выберите размер карьера [от 1 до "..#presets.."]".."\n")
  720.     for i = 1,#presets do
  721.       local length = presets[i]*3
  722.       print("["..i.."] "..length.."/"..length)
  723.     end
  724.     while true do
  725.       local e = tonumber(keyboard.keys[({event.pull("key_down")})[4]])
  726.       if presets[e] then
  727.         computer.beep(500, 0.1)
  728.         line = presets[e]
  729.         length = line*3
  730.         print()
  731.         break
  732.       else
  733.         computer.beep(1000, 1)
  734.         print("неверный ввод")
  735.       end
  736.     end
  737.   end
  738.   print("размер карьера "..(length).."/"..(length).."  линий "..line)
  739.   local line = tonumber(line)
  740.   local length = tonumber(length-3)
  741.   print("угля в генераторе = "..gen.count())
  742.   print("энергии = "..math.floor(100*computer.energy()/computer.maxEnergy()).." %")
  743.   print("подготовка...")
  744.   goTo( 0,0,0,0,-1 )
  745.   for slot = 1,invsize do
  746.     if r.count(slot) == 0 then
  747.       r.select(slot)
  748.       i_c.equip()
  749.       break
  750.     end
  751.     if slot == invsize then
  752.       stop("в инвентаре робота нет пустых слотов")
  753.     end
  754.   end
  755.   local inv = i_c.getInventorySize(3)
  756.   if inv then
  757.     cheststart = true
  758.     print("доступен сундук")
  759.     if servise(tools,toollist) then
  760.       r.select(tools)
  761.       i_c.equip()
  762.       servise(tools,toollist)
  763.     else
  764.       stop("нет инструмента")
  765.     end
  766.     if servise(coal,{"coal"}) then
  767.       r.select(coal)
  768.       if gen.insert() then
  769.         print("заправился, угля в генераторе = "..gen.count())
  770.         servise(coal,{"coal"})
  771.       end
  772.     else
  773.       fuelchest = false
  774.     end
  775.   else
  776.     cheststart = false
  777.     print("сундук сзади робота не найден")
  778.     if slotitem(tools,toollist) then
  779.       r.select(tools)
  780.       i_c.equip()
  781.       slotitem(tools,toollist)
  782.     else
  783.       stop("нет инструмента")
  784.     end
  785.     checkfuel()
  786.   end
  787.   goTo( 0,0,0,-1,0 )
  788.   local inv = i_c.getInventorySize(3)
  789.   if inv and inv <= 4 then
  790.     charger = true
  791.     print("доступен зарядчик")
  792.   end
  793.   goTo( 0,0,0,0,1 )
  794.   charging()
  795.   r.setLightColor(0xFFFFFF)
  796.   chunkload(true)
  797.   print("опускаюсь на "..down.." блока(ов)")
  798.   for height = 1,256 do
  799.     refuel = true
  800.     checkfuel()
  801.     go_down()
  802.     down = 3
  803.     for y = 1,line do
  804.       digForward(length)
  805.       checkfuel()
  806.       if y ~= line then
  807.         turn()
  808.         digForward(3)
  809.         turn()
  810.       end
  811.       strip = strip + 1
  812.     end
  813.     turnRight()
  814.     if bedrock then
  815.       goTo( 0,0,0,0,-1 )
  816.       sortlut(true)
  817.       stop("завершил копать :)")
  818.     end
  819.   end
  820. end
  821.  
  822. dig()
Add Comment
Please, Sign In to add comment