Kaerius

mine

Feb 2nd, 2013
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.54 KB | None | 0 0
  1. local tArgs={...}
  2. local count=0
  3. local Version="V1.1"
  4. local torch=5
  5. local t=turtle
  6.  
  7. function fuelCheck()
  8.  if t.getFuelLevel() ~= "unlimited" then
  9.   t.select(16)
  10.   while t.getFuelLevel() < 50 do
  11.    t.refuel(1)
  12.   end
  13.   t.select(1)
  14.  end
  15. end
  16.  
  17. function Dig()
  18.  while t.dig() do
  19.   t.dig()
  20.   sleep(0.6)
  21.  end
  22. end
  23.  
  24. function Up()
  25.  while not t.up() do
  26.   t.digUp()
  27.   sleep(0.6)
  28.  end
  29. end
  30.  
  31. function Down()
  32.  while not t.down() do
  33.   t.digDown()
  34.   sleep(0.6)
  35.  end
  36. end
  37.  
  38. function Forward()
  39.  while not t.forward() do
  40.   t.dig()
  41.   sleep(0.6)
  42.  end
  43. end
  44.  
  45. function placeTorch()
  46.  count = count + 1
  47. if count == torch then
  48.   t.select(15)
  49.   t.turnRight()
  50.   t.place()
  51.   t.turnLeft()
  52.   t.select(1)
  53.   count=0
  54.  end
  55. end
  56.  
  57. function checkInv()
  58.  if t.getItemCount(13)~=0 then
  59.   emptyInv()
  60.  end
  61. end
  62.  
  63. function emptyInv()
  64.  t.select(14)
  65.  t.turnLeft()
  66.  t.place()
  67.  t.attack()
  68.  for i=1,13 do
  69.   t.select(i)
  70.   t.drop()
  71.  end
  72.  t.select(1)
  73.  t.turnRight()
  74. end
  75.  
  76. if #tArgs ~=1 then
  77.  print("Useage MINE <dist>")
  78.  return
  79. end
  80.  
  81. print("Version:  "..Version.."\nPlease make sure to have a Chest in slot 14 Torches in slot 15 and Fuel in slot 16")                      
  82. print("You have chosen to go  "..tArgs[1].." blocks ahead. MADE BY DEMON_GOXA)")
  83.  
  84. for i=1, tArgs[1] do
  85.  fuelCheck()
  86.  checkInv()
  87.  Forward()
  88.  t.turnLeft()
  89.  Dig()
  90.  t.digUp()
  91.  Up()
  92.  Dig()
  93.  t.digUp()
  94.  Up()
  95.  Dig()
  96.  t.turnRight()
  97.  t.turnRight()
  98.  Dig()
  99.  Down()
  100.  Dig()
  101.  Down()
  102.  Dig()
  103.  t.turnLeft()
  104.  placeTorch()
  105. end
  106. t.back()
  107. t.back()
  108. term.clear()
  109. term.setCursorPos(1,1)
Advertisement
Add Comment
Please, Sign In to add comment