Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --lua
- args = {...} ;
- if #args < 1 or #args > 4 then
- print('useage: woodman2 nx [ny] [step]') ;
- return ;
- end ;
- os.loadAPI('rom/luo/api') ; for k , v in pairs(api) do loadstring(string.format("%s = api.%s" , k , k))() end ;
- slots = {
- [1] = {'fuel'} ;
- [2] = {'sapling'} ;
- [3] = {'wood'} ;
- [4] = {'fertilizer'} ;
- } ;
- slot.checkList(slots , 3) ;
- cutTree = function(nx , ny , step)
- workMode.destroy = true ;
- workMode.force = true ;
- local count = 0 ;
- local startTime = os.time() ;
- f = function()
- if not compare.left(2) then
- link(digAll({3})) ;
- count = count + 1 ;
- end
- place.left(2) ;
- place.left(4 , {tryTime = 0 , destroy = false , force = false}) ;
- end
- step1 = scan('l' , ny , {step = step , first = 0}) ;
- step2 = scan('f' , nx , {step = step , first = 1}) ;
- link(step1 , step2 , f) ;
- local timeUsed = os.time() - startTime ;
- return count , timeUsed ;
- end ;
- if #args == 1 then
- print(string.format('Cutted Trees : %d\nTime Used : %d h') , cutTree(tonumber(args[1]) , tonumber(args[1]) , 5)) ;
- elseif #args == 2 then
- print(string.format('Cutted Trees : %d\nTime Used : %d h') , cutTree(tonumber(args[1]) , tonumber(args[2]) , 5)) ;
- elseif #args == 3 then
- print(string.format('Cutted Trees : %d\nTime Used : %d h') , cutTree(tonumber(args[1]) , tonumber(args[2]) , tonumber(args[3]))) ;
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement