Advertisement
Asioron

ugol 2

Jan 3rd, 2019
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.89 KB | None | 0 0
  1. local com = require("component")
  2. local inv = com.inventory_controller
  3. local r = require("robot")
  4.  
  5. local function go() while not r.forward() do r.swing() end end
  6.  
  7. while true do
  8.   print('опустошаю инвентарь')
  9.   for i=1, r.inventorySize() do
  10.     r.select(i)
  11.     r.dropDown(64)
  12.   end
  13.   r.select(1)
  14.   local num = 64
  15.   print('поиск руды в нижнем сундуке')
  16.   for i=1, inv.getInventorySize(0) do
  17.     local a = inv.getStackInSlot(0,i)
  18.     if a then
  19.       if a.label == "Coal Ore" and a.size >= num then
  20.         inv.suckFromSlot(0, i, num)
  21.         num = 0
  22.         print('руда найдена и перемещена')
  23.         break
  24.       end
  25.     end
  26.   end
  27.  
  28.   if num == 64 then
  29.     print('нет руды!')
  30.     os.exit()
  31.   end
  32.   print('Расставляю руду')
  33.   for i=1,64 do
  34.     r.placeUp()
  35.     os.sleep(0)
  36.     r.swingUp()
  37.   end
  38. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement