Advertisement
cowslaw

1x3 Branch Miner

Jun 10th, 2013
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.38 KB | None | 0 0
  1. -- 1x3 Branch By: ZakyyyHD
  2. -- Protected under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported (http://creativecommons.org/licenses/by-nc-nd/3.0/)
  3. -- Place Chest Under Turtle When Starting!
  4. -- Place Fuel In Slot 1.
  5. -- Put Torches In Slot 2.
  6.  
  7. -- Variables
  8. local tArgs = { ... }
  9. turtle.select(1)
  10. local togo = tonumber(tArgs[1])
  11. togo = togo or 1
  12. torch = 0
  13. amount = 0
  14.  
  15. -- Functions
  16. function cFuel()
  17.  if turtle.getFuelLevel() <= 10 then
  18.   turtle.select(1)
  19.   turtle.refuel(1)
  20.  end
  21. end
  22.  
  23. function tAr()
  24.  turtle.turnRight()
  25.  turtle.turnRight()
  26. end
  27.  
  28. function dDandU()
  29.   if turtle.detectUp() then
  30.    turtle.digUp()
  31.   end
  32.   if turtle.detectDown() then
  33.    turtle.digDown()
  34.   end
  35. end
  36.  
  37.  
  38. -- Main Script
  39. cFuel()
  40. for i = 1, togo do
  41.  amount = amount + 1
  42.  torch = torch + 1
  43.  term.clear()
  44.  term.setCursorPos(1,1)
  45.  print("Turtle is on block ", amount, " out of ", togo, ".")
  46.  cFuel()
  47.  if turtle.detect() == true then
  48.   repeat
  49.    turtle.dig()
  50.    sleep(0.25)
  51.   until turtle.detect() == false
  52.  turtle.forward()
  53.  dDandU()
  54.  else
  55.   turtle.forward()
  56.   dDandU()
  57.  end
  58.   if torch == 11 then
  59.    turtle.select(2)
  60.    turtle.down()
  61.    tAr()
  62.    turtle.place()
  63.    tAr()
  64.    turtle.up()
  65.    torch = 0
  66.   end
  67. end
  68.  
  69. -- Return
  70. tAr()
  71. for b = 1, togo do
  72.  cFuel()
  73.  turtle.forward()
  74. end
  75. print("Done!")
  76. for e = 3, 16 do
  77.  turtle.select(e)
  78.  turtle.dropDown()
  79. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement