Advertisement
lambdaCraft

mc-woodman

Jan 18th, 2020
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.33 KB | None | 0 0
  1. --lua
  2. args = {...} ;
  3. if #args < 1 or #args > 4 then
  4.     print('useage: woodman2 nx [ny] [step]') ;
  5.     return ;
  6. end ;
  7.  
  8. os.loadAPI('rom/luo/api') ; for k , v in pairs(api) do loadstring(string.format("%s = api.%s" , k , k))() end ;
  9.  
  10. slots = {
  11.     [1] = {'fuel'} ;
  12.     [2] = {'sapling'} ;
  13.     [3] = {'wood'} ;
  14.     [4] = {'fertilizer'} ;
  15. } ;
  16. slot.checkList(slots , 3) ;
  17.  
  18.  
  19. cutTree = function(nx , ny , step)
  20.     workMode.destroy = true ;
  21.     workMode.force = true ;
  22.     local count = 0 ;
  23.     local startTime = os.time() ;
  24.     f = function()
  25.         if not compare.left(2) then
  26.             link(digAll({3})) ;
  27.             count = count + 1 ;
  28.         end
  29.         place.left(2) ;
  30.         place.left(4 , {tryTime = 0 , destroy = false , force = false}) ;
  31.     end
  32.     step1 = scan('l' , ny , {step = step , first = 0}) ;
  33.     step2 = scan('f' , nx , {step = step , first = 1}) ;
  34.     link(step1 , step2 , f) ;
  35.     local timeUsed = os.time() - startTime ;
  36.     return count , timeUsed ;
  37. end ;
  38.  
  39. if #args == 1 then
  40.     print(string.format('Cutted Trees : %d\nTime Used : %d h') , cutTree(tonumber(args[1]) , tonumber(args[1]) , 5)) ;
  41. elseif #args == 2 then
  42.     print(string.format('Cutted Trees : %d\nTime Used : %d h') , cutTree(tonumber(args[1]) , tonumber(args[2]) , 5)) ;
  43. elseif #args == 3 then
  44.     print(string.format('Cutted Trees : %d\nTime Used : %d h') , cutTree(tonumber(args[1]) , tonumber(args[2]) , tonumber(args[3]))) ;
  45. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement