Advertisement
SamuelHurst

CC Auto Strip Miner

Jun 21st, 2021 (edited)
1,296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.96 KB | None | 0 0
  1. -- globals
  2. chunkLoaderInterval = 16
  3. pX = 1
  4. pY = 1
  5. pZ = 1
  6.  
  7. -- function definitions
  8. function checkLavaAndFuel()
  9.     local slot = turtle.getSelectedSlot()
  10.     local fuelLimit = turtle.getFuelLimit()
  11.     if turtle.getFuelLevel() < fuelLimit - 1000 then
  12.         turtle.select(15)
  13.         if turtle.place() then
  14.             if not turtle.refuel() then
  15.                 -- we picked up something other than lava (water, etc.)
  16.                 turtle.place()
  17.             end
  18.         end
  19.     end
  20.     turtle.select(slot)
  21. end
  22.  
  23. function autoRefuel()
  24.     local slot = turtle.getSelectedSlot()
  25.     checkLavaAndFuel()
  26.     while turtle.getFuelLevel() < 80 do
  27.         turtle.select(16)
  28.         if turtle.refuel(0) then
  29.             -- we can refuel using fuel in slot 16
  30.             turtle.refuel(1)
  31.         end
  32.     end
  33.     turtle.select(slot)
  34. end
  35.  
  36. function isInventoryFull()
  37.     if turtle.getItemCount(12) > 0 then
  38.         return true
  39.     else
  40.         return false
  41.     end
  42. end
  43.  
  44. function dumpInventory()
  45.     local slot = turtle.getSelectedSlot()
  46.    
  47.     turtle.turnLeft()
  48.     turtle.turnLeft()
  49.     turtle.select(14)
  50.     turtle.place()
  51.     for i=1, 12 do
  52.         turtle.select(i)
  53.         turtle.drop()
  54.     end
  55.     turtle.select(14)
  56.     turtle.dig()
  57.     turtle.turnLeft()
  58.     turtle.turnLeft()
  59.    
  60.     turtle.select(slot)
  61. end
  62.  
  63. function checkToPlaceChunkLoader()
  64.     if pX % chunkLoaderInterval == 0 then
  65.         local slot = turtle.getSelectedSlot()
  66.        
  67.         turtle.select(13)
  68.         turtle.placeUp()
  69.         turtle.turnLeft()
  70.         turtle.turnLeft()
  71.         for i=1, chunkLoaderInterval do
  72.             turtle.forward()
  73.         end
  74.         turtle.turnLeft()
  75.         turtle.turnLeft()
  76.         turtle.digUp()
  77.         for i=1, chunkLoaderInterval do
  78.             turtle.forward()
  79.         end
  80.        
  81.         turtle.select(slot)
  82.     end
  83. end
  84.  
  85. for x=1, 1000 do
  86.     turtle.forward()
  87.     pX = pX + 1
  88.     checkToPlaceChunkLoader()
  89. end
  90.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement