Advertisement
Solomeister

lumberbot v0.12

Aug 6th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local robot = require("robot")
  2. local comp = require("computer")
  3. local component = require("component")
  4. local inv = component.inventory_controller
  5. local term = require("term")
  6. local sides = require("sides")
  7.  
  8.  
  9.  
  10. function rechTool()
  11.   robot.select(2)
  12.   robot.turnRight()
  13.   robot.drop()
  14.   os.sleep(2)
  15.   robot.suck()
  16.   robot.turnLeft()
  17. end
  18.  
  19. function checkTool()
  20.   robot.select(2)
  21.   inv.equip()
  22.   dur = robot.durability()
  23.   inv.equip()
  24.   return dur
  25. end
  26.      
  27. function routine()
  28.   _, det = robot.detect()
  29.   if det == 'solid' then
  30.     robot.swing()
  31.     robot.use(1, true)
  32.     robot.use(1, true)
  33.     for i = 1, 4 do
  34.       robot.swingUp()
  35.       robot.up()
  36.     end
  37.     while robot.detectDown() == 0 do
  38.       robot.down()
  39.     end
  40.     robot.use(1, true)
  41.     robot.suckUp()
  42.   elseif det == 'passable' then
  43.     robot.select(2)
  44.     inv.equip()
  45.     for i = 1, 10 do
  46.       robot.use()
  47.     end
  48.     robot.select(2)
  49.     inv.equip()
  50.   else
  51.     robot.select(1)
  52.     robot.place()  
  53.   end
  54. end
  55.  
  56. function lumbMain()
  57.   b = 0
  58.   while robot.count(16) < 63 do
  59.     routine()
  60.     robot.suckUp()
  61.     b = b + 1
  62.     if b == 100 then
  63.       if checkTool() == 0 then
  64.         break
  65.         rechTool()
  66.       end
  67.     b = 0
  68.     end
  69.   end
  70.   for i = 4, 16 do
  71.     robot.select(i)
  72.     robot.dropDown()
  73.   end
  74.   robot.select(1)
  75.   lumbMain()
  76. end
  77. lumbMain()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement