Advertisement
Xenogami

enderminer

Mar 17th, 2013
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.19 KB | None | 0 0
  1. local function checkFuel()
  2.     turtle.select(1)
  3.     while turtle.getFuelLevel() < 100 do
  4.         turtle.refuel(1)
  5.     end
  6.  
  7. end
  8.  
  9. local function forwardcheck()
  10.     checkFuel()
  11.     while not turtle.forward() do
  12.         turtle.dig()
  13.     end
  14. end
  15.  
  16. local function startime()
  17.     term.clear()
  18.     print("Welcome to EnderMiner2.0\n\n")
  19.     print("Please place me to the left side of your new tunnel one block up facting the wall.\n\n")
  20.     print("Place fuel in slot 1 and a Enderchest in slot 2.")
  21.     print("Enter the width you want your new tunnel... ")
  22.     wth = tonumber(read())
  23.     print("Enter the lenght you want your new tunel... ")
  24.     lgh = tonumber(read())
  25.     print("Number of offset block to right, enter 0 to end at same square as start... ")
  26.     offSet = tonumber(read())
  27.     print("Number of shafts to dig...")
  28.     shaftNumber = tonumber(read())
  29. end
  30.  
  31. local function mineLeft()
  32.     local x = wth - 1
  33.     turtle.dig()
  34.     forwardcheck()
  35.     turtle.digUp()
  36.     turtle.digDown()
  37.     turtle.turnRight()
  38.     for i=1,x do
  39.         turtle.dig()
  40.         forwardcheck()
  41.         turtle.digUp()
  42.         turtle.digDown()
  43.     end
  44.     turtle.turnLeft()
  45.     wSide = not wSide
  46. end
  47.  
  48. local function mineRight()
  49.     local x = wth - 1
  50.     turtle.dig()
  51.     forwardcheck()
  52.     turtle.digUp()
  53.     turtle.digDown()
  54.     turtle.turnLeft()
  55.     for i=1,x do
  56.         turtle.dig()
  57.         forwardcheck()
  58.         turtle.digUp()
  59.         turtle.digDown()
  60.     end
  61.     turtle.turnRight()
  62.     wSide = not wSide
  63. end
  64.  
  65. local function goHome()
  66.     if wSide then
  67.         turtle.turnRight()
  68.         turtle.turnRight()
  69.         for i=1,lgh do
  70.             forwardcheck()
  71.         end
  72.     else
  73.         turtle.turnLeft()
  74.         for i=1,(wth-1) do
  75.             forwardcheck()
  76.         end
  77.         turtle.turnLeft()
  78.         for i=1,lgh do
  79.             forwardcheck()
  80.         end
  81.     end
  82.     turtle.turnRight()
  83.     turtle.turnRight()
  84. end
  85.  
  86. local function offSetF()
  87.     turtle.turnRight()
  88.     for i=1,offSet do
  89.         forwardcheck()
  90.     end
  91.     turtle.turnLeft()
  92. end
  93.  
  94. local function digTime()
  95.     for i=1,lgh do
  96.         if wSide then
  97.             mineLeft()
  98.         else
  99.             mineRight()
  100.         end
  101.     end
  102. end
  103.  
  104. local function placeItems()
  105.     turtle.digDown()
  106.     turtle.select(2)
  107.     turtle.placeDown()
  108.     for x=3,16 do
  109.             turtle.select(x)
  110.             turtle.dropDown()
  111.     end
  112.     turtle.select(2)
  113.     turtle.digDown()
  114. end
  115.  
  116.  
  117. startime()
  118. for t=1,shaftNumber do
  119.     wSide = true
  120.     digTime()
  121.     goHome()
  122.     placeItems()
  123.     offSetF()
  124. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement