Advertisement
Axow01

Code

Nov 23rd, 2020 (edited)
1,691
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.08 KB | None | 0 0
  1.  
  2. function stop (message)
  3.    print(message)
  4.    exit()
  5. end
  6.  
  7. function inventory (a)
  8.     local abc = 1
  9.     while abc <= 16 do
  10.         turtle.select(abc)
  11.         local item = turtle.getItemDetail()
  12.         if item then
  13.             if item.name == "minecraft:cobblestone" then
  14.                 turtle.drop()
  15.             end
  16.             if item.name == "minecraft:dirt" then
  17.                 turtle.drop()
  18.             end
  19.             if item.name == "minecraft:diorite" then
  20.                 turtle.drop()
  21.             end
  22.         end
  23.         abc = abc + 1
  24.     end
  25. end
  26.  
  27. function reset (h,l)
  28.     inventory()
  29.     local i = 0
  30.     turtle.turnLeft()
  31.     local blockLeft = turtle.detect()
  32.     turtle.turnRight()
  33.     if blockLeft == true then
  34.         turtle.turnRight()
  35.         turtle.turnRight()
  36.     end
  37.     if blockLeft == false then
  38.         turtle.dig()
  39.         turtle.forward()
  40.         turtle.turnLeft()
  41.         local abc = 0
  42.         while abc < l do
  43.             abc = abc + 1
  44.             turtle.dig()
  45.             turtle.forward()
  46.         end
  47.         turtle.turnLeft()
  48.         turtle.digDown()
  49.         turtle.down()
  50.         mine(h,l)
  51.     end
  52.     while i <= l - 1 do
  53.         turtle.dig()
  54.         turtle.forward()
  55.         i = i + 1
  56.     end
  57.     i = 0
  58.     turtle.turnLeft()
  59.     while i <= l - 1 do
  60.         turtle.dig()
  61.         turtle.forward()
  62.         i = i + 1
  63.     end
  64.     i = 0
  65.     turtle.turnLeft()
  66.     turtle.digDown()
  67.     turtle.down()
  68.     mine(h,l)
  69. end
  70.  
  71. function mine (h,l)
  72.     turtle.select(1)
  73.     turtle.refuel()
  74.     print("Commence a miné !")
  75.     local progression = 0
  76.     local ll = l + 1
  77.     local slice = 0
  78.    
  79.     while progression < ll do
  80.         turtle.dig()
  81.         turtle.forward()
  82.         progression = progression + 1
  83.         if progression >= l then
  84.             if slice >= l then
  85.                 reset(h,l)
  86.             end
  87.             local bba = 0
  88.             turtle.turnLeft()
  89.             local blockLeft = turtle.detect()
  90.             turtle.turnRight()
  91.             if blockLeft == false then
  92.                 turtle.turnRight()
  93.                 turtle.dig()
  94.                 turtle.forward()
  95.                 turtle.turnRight()
  96.             end
  97.             if blockLeft == true then
  98.                 turtle.turnLeft()
  99.                 turtle.dig()
  100.                 turtle.forward()
  101.                 turtle.turnLeft()
  102.             end
  103.             --stop("Testing Complete !")
  104.             progression = 1
  105.             slice = slice + 1
  106.         end
  107.     end
  108. end
  109.  
  110. function mineCalculs (a)
  111.     io.write("Taper la largeur de la mine en block!\n")
  112.     local largeur = tonumber(io.read())
  113.     io.write("Taper la hauteur de la mine en block!\n")
  114.     local hauteur = tonumber(io.read())
  115.     mine(hauteur,largeur)
  116. end
  117.  
  118. function moveToCord(xx, yy, zz)
  119.     local x, y, z = gps.locate(4)
  120.     print('POS: ' .. x .. ' ' .. y .. ' ' .. z)
  121.     local difX = 70 - x
  122.     local i = 0
  123.     if x < 70 then
  124.         while i < difX do
  125.             turtle.up()
  126.             i = i + 1
  127.         end
  128.     end
  129.     stop('Y Cord Complete !')
  130. end
  131.  
  132. moveToCord(5, 10, 35)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement