vanul

Porniii

Nov 29th, 2023 (edited)
437
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.61 KB | None | 0 0
  1. function printStatment()
  2.     print("Loop number:", checkVar)
  3.  
  4.     percentFuelLevel = (turtle.getFuelLevel() / turtle.getFuelLimit()) * 100
  5.     print("Fuel level: ", math.ceil(percentFuelLevel), "%")
  6. end
  7.  
  8. function dig3x3Func()
  9.     --firstTime
  10.  
  11.     while turtle.detect() or turtle.detectUp() or turtle.detectDown() do
  12.         turtle.dig()
  13.         turtle.digUp()
  14.         turtle.digDown()
  15.     end
  16.  
  17.     turtle.forward()
  18.  
  19.     --secondTime
  20.     while turtle.detect() or turtle.detectUp() or turtle.detectDown() do
  21.         turtle.dig()
  22.         turtle.digUp()
  23.         turtle.digDown()
  24.     end
  25.  
  26.     turtle.forward()
  27.  
  28.     --thirdTime
  29.     while turtle.detectUp() or turtle.detectDown() do
  30.         turtle.digUp()
  31.         turtle.digDown()
  32.     end
  33.  
  34.     --rotateForReverse
  35.     turtle.turnLeft()
  36.  
  37.     while turtle.detect() do
  38.         turtle.dig()
  39.     end
  40.  
  41.     turtle.forward()
  42.     turtle.turnLeft()
  43.  
  44.     --firstTime
  45.     while turtle.detect() or turtle.detectUp() or turtle.detectDown() do
  46.         turtle.dig()
  47.         turtle.digUp()
  48.         turtle.digDown()
  49.     end
  50.  
  51.     turtle.forward()
  52.  
  53.     --secondTime
  54.     while turtle.detect() or turtle.detectUp() or turtle.detectDown() do
  55.         turtle.dig()
  56.         turtle.digUp()
  57.         turtle.digDown()
  58.     end
  59.  
  60.     turtle.forward()
  61.  
  62.     --thirdTime
  63.     while turtle.detectUp() or turtle.detectDown() do
  64.         turtle.digUp()
  65.         turtle.digDown()
  66.     end
  67.  
  68.     --rotateForDefault
  69.     turtle.turnRight()
  70.     while turtle.detect() do
  71.         turtle.dig()
  72.     end
  73.     turtle.forward()
  74.     while turtle.detectUp() or turtle.detectDown() do
  75.         turtle.digUp()
  76.         turtle.digDown()
  77.     end
  78.     turtle.turnRight()
  79. end
  80.  
  81. function rotateRightForReverse()
  82.     --firstTime
  83.  
  84.     while turtle.detect() or turtle.detectUp() or turtle.detectDown() do
  85.         turtle.dig()
  86.         turtle.digUp()
  87.         turtle.digDown()
  88.     end
  89.  
  90.     turtle.forward()
  91.  
  92.     --secondTime
  93.     while turtle.detect() or turtle.detectUp() or turtle.detectDown() do
  94.         turtle.dig()
  95.         turtle.digUp()
  96.         turtle.digDown()
  97.     end
  98.  
  99.     turtle.forward()
  100.  
  101.     --thirdTime
  102.     while turtle.detect() or turtle.detectUp() or turtle.detectDown() do
  103.         turtle.dig()
  104.         turtle.digUp()
  105.         turtle.digDown()
  106.     end
  107.  
  108.     turtle.forward()
  109.  
  110.     --fourTime
  111.     while turtle.detect() or turtle.detectUp() or turtle.detectDown() do
  112.         turtle.dig()
  113.         turtle.digUp()
  114.         turtle.digDown()
  115.     end
  116.  
  117.     turtle.forward()
  118.  
  119.     --fiveTime
  120.     while turtle.detect() or turtle.detectUp() or turtle.detectDown() do
  121.         turtle.dig()
  122.         turtle.digUp()
  123.         turtle.digDown()
  124.     end
  125.  
  126.     turtle.forward()
  127.     --sixTime
  128.     while turtle.detectUp() or turtle.detectDown() do
  129.         turtle.digUp()
  130.         turtle.digDown()
  131.     end
  132.     turtle.turnRight()
  133.     turtle.turnRight()
  134. end
  135.  
  136. function rotateLeftForReverse()
  137.     turtle.turnLeft()
  138.     turtle.turnLeft()
  139.  
  140.     while turtle.detect() or turtle.detectUp() or turtle.detectDown() do
  141.         turtle.dig()
  142.         turtle.digUp()
  143.         turtle.digDown()
  144.     end
  145.  
  146.     turtle.forward()
  147. end
  148.  
  149. function fuelFunc(inventoryFuel)
  150.     if turtle.getFuelLevel() < 100 then
  151.         print("need refuel!")
  152.         turtle.select(inventoryFuel)
  153.         turtle.refuel(16)
  154.         print("refuel complete")
  155.  
  156.         turtle.select(1) --return default
  157.     end
  158. end
  159.  
  160. function chestAndTorchFunc(torch, chest, invCount)
  161.     turtle.digUp()
  162.     turtle.digDown()
  163.  
  164.     turtle.turnRight()
  165.     turtle.forward()
  166.     turtle.select(chest)
  167.     turtle.placeDown()
  168.  
  169.     for i = 1, invCount, 1 do -- transferToChest
  170.         turtle.select(i)
  171.         if i == 1 or i == 2 or i == 3 or i == 4 then
  172.             turtle.dropDown(turtle.getItemCount(i) - 1)
  173.         else
  174.             turtle.dropDown(64)
  175.         end
  176.     end
  177.  
  178.     turtle.back()
  179.     turtle.select(torch)
  180.     turtle.place()
  181.     turtle.turnLeft()
  182.  
  183.     turtle.select(1) --return default
  184. end
  185.  
  186. function checkInventory(invCount) -- количество слотов под ресурсы
  187.     inventoryFull = invCount * 64
  188.     inventoryCurrent = 0
  189.  
  190.     for i = 1, invCount, 1 do
  191.         inventoryCurrent = inventoryCurrent + turtle.getItemCount(i)
  192.     end
  193.  
  194.     invResult = (inventoryCurrent / inventoryFull) * 100
  195.  
  196.     percentInventoryLevel = (inventoryCurrent / inventoryFull) * 100
  197.     print("inventoryLevel: ", math.ceil(percentInventoryLevel), "%")
  198. end
  199.  
  200. function whiteList(invCount) -- количество слотов под ресурсы
  201.     for i = 1, 13, 1 do
  202.         turtle.select(i)
  203.         if turtle.compareTo(1) == false and turtle.compareTo(2) == false and turtle.compareTo(3) == false and turtle.compareTo(4) == false then
  204.             turtle.drop()
  205.         end
  206.     end
  207.     turtle.select(1) --return default
  208. end
  209.  
  210. --Main #######################################################################################################################################
  211.  
  212. --count of main loop
  213. countLoops = 5000
  214.  
  215. checkVar = 0
  216.  
  217.  
  218. for i = 1, countLoops, 1 do
  219.     checkVar = checkVar + 1
  220.  
  221.     printStatment()
  222.     checkInventory(13)
  223.     fuelFunc(14)
  224.     dig3x3Func()
  225.  
  226.     if (checkVar % 50) == 0 and (checkVar % 100) ~= 0 then
  227.         rotateRightForReverse()
  228.         print("RIGHT")
  229.     end
  230.  
  231.     if (checkVar % 50) == 0 and (checkVar % 100) == 0 then
  232.         rotateLeftForReverse()
  233.         print("LEFT")
  234.     end
  235.  
  236.     if checkVar % 5 == 0 then
  237.         whiteList(13)
  238.     end
  239.  
  240.  
  241.  
  242.     if invResult > 85 then
  243.         chestAndTorchFunc(15, 16, 13)
  244.     end
  245.  
  246.  
  247.     print(" ")
  248. end
  249. print("Loop end")
  250. -- pastebin get 99PrJLVv Porniii
  251.  
Advertisement
Add Comment
Please, Sign In to add comment