Advertisement
Guest User

branchmine

a guest
Jul 23rd, 2014
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.75 KB | None | 0 0
  1. --Get the arguments
  2. local tArgs = { ... }
  3. local branches   = tonumber(tArgs[1])
  4. local branchSize = tonumber(tArgs[2])
  5.  
  6. --Defaults for arguments
  7. local branches   = branches   or 5
  8. local branchSize = branchSize or 50
  9.  
  10. -- Alias for easier typing
  11. local tt = turtle
  12.  
  13. function turnAround()
  14.   tt.turnRight()
  15.   tt.turnRight()
  16. end
  17.  
  18. function digBranch( branchLength )
  19.  
  20.   print("Digging Branch...")
  21.  
  22.   for i=0,branchLength do
  23.     if tt.detect() then
  24.       tt.dig()
  25.     end
  26.  
  27.     tt.forward()
  28.  
  29.     if tt.detectUp() then
  30.       tt.digUp()
  31.     end
  32.  
  33.   end
  34.  
  35.   print("Torching Branch...")
  36.  
  37.   turnAround()
  38.  
  39.   for i=0,branchLength do
  40.     if ( i % 10 ) == 0 then
  41.       tt.placeUp()
  42.     end
  43.     tt.forward()
  44.   end
  45.  
  46. end
  47.  
  48. digBranch( 20 )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement