SHARE
TWEET

mine9

a guest Aug 24th, 2019 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ---Strip Mine---
  2.  
  3. --fuel in 1, Chests in 2
  4.  
  5. -- Create the function for refueling
  6. function checkFuel()
  7.   if turtle.getFuelLevel() <= 10 then
  8.     turtle.select(1)
  9.     turtle.refuel(1)
  10.     turtle.select(1)
  11.   end --if
  12. end --checkFuel()
  13.  
  14. -- Create the function for unloading
  15. function unload()
  16.   for slot = 3, 16 do
  17.     turtle.select(slot)
  18.     turtle.dropDown()
  19.   end --for
  20. end --unload()
  21.  
  22. -- Create the function for checkingInventory
  23. function checkInv(steps)
  24.   goBack = false
  25.   turtle.select(3)
  26.     if turtle.getItemCount() > 0 then
  27.       goBack = true
  28.     end --if
  29.   if goBack == true then
  30.     turtle.turnLeft()
  31.     turtle.turnLeft()
  32.     for i = 1, steps do
  33.       checkFuel()
  34.       turtle.forward()
  35.     end --for
  36.   end --if
  37.   unload()
  38. end --checkInv()
  39.  
  40. -- Create the function for mining one
  41. function digOne(steps)
  42.   checkInv(steps)
  43.   turtle.dig()
  44.   checkFuel()
  45.   turtle.forward()
  46.   turtle.digUp()
  47. end --digOne()
  48.  
  49. function run(number_tunnel, length_tunnel)
  50. for tunnel = 1,number_tunnel do
  51.   turtle.digDown()
  52.   turtle.select(2)
  53.   turtle.placeDown()
  54.   vorwaerts = 0
  55.   for steps = 1, length_tunnel do
  56.     digOne(vorwaerts)
  57.     vorwaerts = vorwaerts + 1
  58.   end --for
  59.   turtle.turnLeft()
  60.   turtle.turnLeft()
  61.   for k = 1, vorwaerts do
  62.     checkFuel()
  63.     turtle.forward()
  64.   end --for
  65.   unload()
  66.   turtle.turnRight()
  67.   digOne(vorwaerts)
  68.   digOne(vorwaerts)
  69.   digOne(vorwaerts)
  70.   turtle.turnRight()
  71. end --for
  72. end --function
  73.  
  74. -- Main script
  75. print("Input tunnel length:")
  76. local length = read()
  77. print("Tunnel quantity")
  78. local quantity = read()
  79. print("starting excavation...")
  80. run(quantity, length)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top