Advertisement
kEOKIX

MiningTool

Sep 9th, 2022 (edited)
1,036
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. function Excavate(length, width)
  3.     turnRight = false
  4.     while(GetBlockUnderneath)
  5.         turtle.digDown()
  6.         turtle.down()
  7.         turtle.digDown()
  8.         turtle.down()
  9.         for j=1,width do
  10.             for i=1,length do
  11.                 turtle.digDown()
  12.                 turtle.digUp()
  13.                 turtle.dig()
  14.                 turtle.forward()
  15.             end
  16.             if(turnRight) then
  17.                 turtle.digDown()
  18.                 turtle.digUp()
  19.                 turtle.turnRight()
  20.                 turtle.dig()
  21.                 turtle.forward()
  22.                 turtle.turnRight()
  23.                 turnRight = false
  24.             else
  25.                 turtle.digDown()
  26.                 turtle.digUp()
  27.                 turtle.turnLeft()
  28.                 turtle.dig()
  29.                 turtle.forward()
  30.                 turtle.turnLeft()
  31.                 turnRight = true
  32.             end
  33.         end
  34.     end
  35. end
  36.  
  37. function GetBlockUnderneath()
  38.     if(turtle.inspectDown() == 7) then
  39.         return false
  40.     else
  41.         return true
  42.     end
  43. end
  44.  
  45. function Tunnel()
  46.     while(true) do
  47.         TunnelLeftToRight()
  48.         TunnelRightToLeft()
  49.     end
  50. end
  51.  
  52. function TunnelRightToLeft()
  53.     turtle.dig()
  54.     turtle.forward()
  55.     turtle.digUp()
  56.     turtle.digDown()
  57.     turtle.turnLeft()
  58.     turtle.dig()
  59.     turtle.forward()
  60.     turtle.digUp()
  61.     turtle.digDown()
  62.     turtle.dig()
  63.     turtle.forward()
  64.     turtle.digUp()
  65.     turtle.digDown()
  66.     turtle.turnRight()
  67. end
  68.  
  69. function TunnelLeftToRight()
  70.     turtle.dig()
  71.     turtle.forward()
  72.     turtle.digUp()
  73.     turtle.digDown()
  74.     turtle.turnRight()
  75.     turtle.dig()
  76.     turtle.forward()
  77.     turtle.digUp()
  78.     turtle.digDown()
  79.     turtle.dig()
  80.     turtle.forward()
  81.     turtle.digUp()
  82.     turtle.digDown()
  83.     turtle.turnLeft()
  84. end
  85.  
  86.  
  87. function Refuel()
  88.     for i = 1, 16 do
  89.         turtle.select(i)  
  90.             turtle.refuel()
  91.     end
  92. end
  93.  
  94.  
  95. function Menu()
  96.     Refuel()
  97.     print("Mining by Keokix_")
  98.     print("Select mode:")
  99.     print("1: Strip mining, 3x1 and every 3rd block, 3 in each side")
  100.     print("2: Excavate - Are is adjustable when selecting this")
  101.     print("3: Tunnel - 3x3 Tunnel")
  102.  
  103.     print("Please select a mode:")
  104.  
  105.     input = io.read()
  106.  
  107.     if(input == "1") then
  108.         StripMining()
  109.     elseif(input == "2") then
  110.         print("Please define the length in front direction: ")
  111.         length = io.read()
  112.         print("Please define the width (going in right direction):")
  113.         width = io.read()
  114.         Excavate(length, width)
  115.     elseif(input == "3") then
  116.         Tunnel()
  117.     else
  118.         print("Invalid input, Try again!")
  119.         Menu()
  120.     end
  121. end
  122.  
  123. Menu()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement