yokmama

Branch Mining

Jun 10th, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.80 KB | None | 0 0
  1. --Getting the variables
  2. local tArgs = { ... }
  3. if #tArgs < 1 then
  4.     print("Usage: branch <length> <torches>")
  5.     return true
  6. end
  7. steps = tonumber(tArgs[1])
  8. if #tArgs >= 2 and tArgs[2] == "nt" then
  9.     torch = false
  10. else
  11.     torch = true
  12. end
  13.  
  14. --Starting the dig
  15. for x = 1, steps do
  16.     if not turtle.forward() then
  17.         repeat
  18.             turtle.dig()
  19.             sleep(0.6)
  20.         until turtle.forward()
  21.     end
  22. end
  23.  
  24. --Getting into position for the return
  25. turtle.digUp()
  26. turtle.up()
  27. turtle.turnRight()
  28. turtle.turnRight()
  29.  
  30. --Starting the return
  31. for x = 1, steps do
  32.     if torch and x % 8 == 0 then
  33.         turtle.placeDown()
  34.     end
  35.     if not turtle.forward() then
  36.         repeat
  37.             turtle.dig()
  38.             sleep(0.25)    
  39.         until turtle.forward()
  40.     end
  41. end
Add Comment
Please, Sign In to add comment