RandomShovel

[CC] Branch Mining Program [Remade]

Jan 14th, 2013
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.13 KB | None | 0 0
  1. term.clear()
  2. term.setCursorPos(1, 1)
  3. print("This digs a 1x2 tunnel, and places torches!")
  4. term.clear()
  5. term.setCursorPos(1, 1)
  6.  
  7. local tArgs = { ... }
  8.  
  9. local a = 0
  10.  
  11. function drop()
  12.   for i=1, 16 do
  13.     turtle.select(i)
  14.     turtle.drop()
  15.   end
  16. end
  17.  
  18. function amount()
  19.  turtle.select(2)
  20.   if turtle.getItemCount(2) == 0 then
  21.     turtle.select(3)
  22.   elseif turtle.getItemCount(3) == 0 then
  23.     turtle.select(4)
  24.   end
  25. end
  26.  
  27. function fill()
  28.   turtle.turnLeft()
  29.   amount()
  30.   turtle.place()
  31.   turtle.placeDown()
  32.   turtle.up()
  33.   turtle.place()
  34.   turtle.turnLeft()
  35.   turtle.turnLeft()
  36.   turtle.placeUp()
  37.   turtle.place()
  38.   turtle.down()
  39.   turtle.place()
  40.   turtle.turnLeft()
  41. end
  42.  
  43. for i = 1,tArgs[1] do
  44.   turtle.dig()
  45.   turtle.digUp()
  46.   fill()
  47.   if turtle.forward() == true then
  48.     a = a + 1
  49.   elseif turtle.forward() == false then
  50.     repeat
  51.       turtle.dig()
  52.       sleep(0.5)
  53.     until turtle.detect() == false
  54.   end
  55.  
  56. if a == 5 then
  57.  turtle.select(1)
  58.  turtle.placeUp()
  59.  turtle.forward()
  60.  a = a - 5
  61. end
  62. end
  63.  
  64. turtle.turnLeft()
  65. turtle.turnLeft()
  66.  
  67. for i=1,tArgs[1] do
  68.   turtle.forward()
  69. end
  70.  
  71. drop()
Advertisement
Add Comment
Please, Sign In to add comment