Advertisement
Guest User

Stripmine

a guest
Feb 28th, 2020
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.45 KB | None | 0 0
  1. local deep
  2. local far
  3.  
  4. print("How deep per tunnel?")
  5. deep = tonumber(io.read())
  6. print("How many do you want?")
  7. far = tonumber(io.read())
  8. print("pls give me Torches into inv.2 and chests in inv.3")
  9. io.read()
  10.  
  11. function Check()
  12.     if(turtle.getItemCount(2)>=far) then
  13.         textutils.slowPrint("You have given me enough torches thx <3")
  14.     else
  15.         textutils.slowPrint("I NEED MORE TORCHES")
  16.         os.shutdown()
  17.     end
  18.     if(turtle.getItemCount(2)>=2) then
  19.         textutils.slowPrint("THX for the chests")
  20.     else
  21.         textutils.slowPrint("I NEED CHESTS inv 3")
  22.     end
  23. end    
  24.  
  25. function Strip(dep)
  26.     if turtle.getFuelLevel() <= 2 then
  27.         write("Fuel low")
  28.         Refuel()        
  29.     end
  30.     turtle.turnLeft()
  31.     for i=1,dep do
  32.         Dig()
  33.         DigUp()
  34.         Forward()
  35.     end
  36.     DigUp()
  37.     turtle.turnLeft()
  38.     turtle.turnLeft()
  39.     for i=2,dep do
  40.         Forward()
  41.     end
  42.     for i=1,dep do
  43.         Dig()
  44.         DigUp()
  45.         Forward()
  46.     end
  47.     DigUp()
  48. end
  49.  
  50. function Refuel()
  51.     turtle.select(1)
  52.     turtle.refuel(20)
  53.     for i=4,16 do
  54.         turtle.select(i)
  55.         turtle.refuel()
  56.     end
  57.     turtle.select(1)
  58. end    
  59.  
  60. function InvFull()
  61.     if(turtle.getItemCount(16)>=1) then
  62.         print("Invetory DUMP")
  63.         turtle.select(3)
  64.         turtle.digDown()
  65.         turtle.placeDown()
  66.         os.sleep(1)
  67.         for inv=4,16 do
  68.             turtle.select(inv)
  69.             turtle.dropDown()
  70.         end
  71.     end
  72.     turtle.select(1)
  73. end
  74.  
  75. function Dig()
  76.     while(turtle.detect()) do
  77.         turtle.dig()
  78.     end
  79. end
  80.  
  81. function DigUp()
  82.     while(turtle.detectUp()) do
  83.         turtle.digUp()
  84.     end
  85. end
  86.  
  87. function Forward()
  88.     if(turtle.detectDown()) then
  89.         turtle.forward()
  90.     else
  91.         turtle.select(4)
  92.         turtle.placeDown(4)
  93.         turtle.select(1)
  94.         turtle.forward()
  95.     end
  96. end
  97.  
  98. function fackel()
  99.     turtle.up()
  100.     turtle.select(2)
  101.     turtle.placeDown()        
  102.     turtle.select(1)
  103.     Dig()
  104.     Forward()
  105.     turtle.digDown()
  106.     turtle.down()
  107. end
  108.  
  109. function Gang()
  110.     Strip(deep)
  111.     turtle.turnLeft()
  112.     turtle.turnLeft()
  113.     for i=2,deep do
  114.         Forward()
  115.     end
  116.     turtle.turnRight()
  117.     fackel()
  118.     InvFull()
  119.     Dig()
  120.     DigUp()
  121.     Forward()
  122.     Dig()
  123.     DigUp()
  124.     Forward()
  125. end
  126.  
  127. Check()
  128.  
  129.  
  130. for i=1,far do
  131.     print("FUEL: "..turtle.getFuelLevel())
  132.     write("Gang: "..i)
  133.     Gang()
  134. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement