Advertisement
Guest User

StripMine

a guest
Nov 18th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.47 KB | None | 0 0
  1. function checkFuel()
  2. end --checkFuel()
  3.  
  4. function turnAround()
  5.   turtle.turnRight()
  6.   turtle.turnRight()
  7. end --turnARound()
  8.  
  9. function digNext(torchCounter)
  10.   turtle.turnRight()
  11.   turtle.dig()
  12.   turtle.forward()
  13.   turtle.digUp()
  14.   turtle.dig()
  15.   turtle.forward()
  16.   turtle.digUp()
  17.   if torchCounter == 2 then
  18.     turnAround()
  19.     turtle.select(15)
  20.     turtle.place()
  21.     turnAround()
  22.     print("Placing mainshaft torch")
  23.   end --if
  24.   turtle.turnLeft()
  25.   print("turn Right")
  26.   print("next Tunnel")
  27. end --digNext
  28.  
  29. function tunnel(givenLength)
  30.   local distance = 0
  31.   for index = 1, givenLength do
  32.   turtle.dig()
  33.   if turtle.forward() then
  34.     distance = distance + 1
  35.   end --if
  36.   turtle.digUp()
  37.   turtle.select(1)
  38.   turtle.placeDown()
  39.  
  40.   if distance == 10 then
  41.     turtle.select(16)
  42.     print("Placing tunnel torch..")
  43.     turnAround()
  44.     turtle.place()
  45.     turnAround()
  46.     distance = 0
  47.     checkFuel()
  48.   end --if
  49.   end --for
  50.  
  51.   turtle.up()
  52.   for index = 1, givenLength do
  53.   turtle.back()
  54.   end --for
  55.   turtle.down()
  56. end --tunnel()
  57.  
  58. print("Input tunnel length:")
  59. local length = tonumber(read())
  60. print("Tunnel quantity")
  61. local quantity = tonumber(read())
  62. local torchNext = 0
  63. print("starting excavation...")
  64. checkFuel()
  65.  
  66. for index = 1, quantity do
  67.   if torchNext == 3 then
  68.     torchNext = 0
  69.   end --if
  70.   tunnel(length)
  71.   checkFuel()
  72.   digNext(torchNext)
  73.   torchNext = torchNext + 1
  74.  end --for
  75. print("The tunnels has been excavated!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement