BLucky_pb

wood.lua

Nov 6th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.08 KB | None | 0 0
  1. robot = require('robot')
  2. component = require('component')
  3.  
  4. local slot = robot.inventorySize()
  5. local item = component.inventory_controller.getStackInInternalSlot(slot)
  6.  
  7. function charge()
  8.   robot.select(slot)
  9.   component.inventory_controller.equip()
  10.   robot.turnRight()
  11.   os.sleep(3)
  12.   robot.drop()
  13.   os.sleep(10)
  14.   robot.suck()
  15.   component.inventory_controller.equip()
  16.   robot.select(1)
  17.   robot.turnLeft()
  18. end
  19.  
  20. function empty()
  21.   for j=2,robot.inventorySize()-1 do
  22.     robot.select(j)
  23.     if robot.count()>0 then
  24.       robot.drop()
  25.     end
  26.   end
  27.   robot.select(1)
  28.   os.sleep(10)
  29. end
  30.  
  31. i=0
  32. charge()
  33. while true do
  34. i=0
  35.   while i<700 do
  36.     robot.select(1)
  37.     if robot.count()>0 then
  38.       robot.place()
  39.     else
  40.       break
  41.     end
  42.     while select(2, robot.detect())=="passable" do
  43.       if i>700 then
  44.         break
  45.       else
  46.         robot.use()
  47.         i=i+1
  48.         print(700-i)
  49.       end
  50.     end
  51.  
  52.     robot.select(slot)
  53.     component.inventory_controller.equip()
  54.     robot.swing()
  55.     component.inventory_controller.equip()
  56.   end
  57. empty()
  58. charge()
  59. end
Add Comment
Please, Sign In to add comment