Advertisement
Asioron

Avtovalilka_rob

Mar 15th, 2017
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.81 KB | None | 0 0
  1. ---------------------------------------------------------
  2. --                    Программа                        --
  3. -- для сушки мяса и других вещей на досках вяления     --
  4. --   в Майнкрафт на роботе из мода OpenComputers       --
  5. --                   Автовялилка v0.1                  --
  6. --          проект http://computercraft.ru             --
  7. --                 2017, © Asior                       --
  8. ---------------------------------------------------------
  9. local com = require("component")
  10. local computer = require("computer")
  11. local ic = com.inventory_controller
  12. local r = require("robot")
  13. print('Положите в первый слот что будем вялеть/n Во второй что на выходе получится')
  14. os.sleep(5)
  15. local output = ic.getStackInInternalSlot(2).name
  16. local input = ic.getStackInInternalSlot(1).name
  17.  
  18. function sortirovka()
  19.   local size = ic.getStackInInternalSlot(1)
  20.   if size and size.size <= 9 then
  21.     for i = 3, r.inventorySize() do
  22.       local info = ic.getStackInInternalSlot(i)
  23.       if info and info.name == input then
  24.         r.select(i)
  25.         r.transferTo(1)
  26.         r.select(1)
  27.         return
  28.       end
  29.     end
  30.   end
  31. end
  32.  
  33. while true do
  34.   local name = ic.getStackInSlot(1, 1)
  35.   if name and name.name == output then
  36.     r.suckUp()
  37.     r.dropUp()
  38.   elseif name == nil then
  39.     r.dropUp()
  40.   end
  41.   local name = ic.getStackInSlot(0, 1)
  42.   if name and name.name == output then
  43.     r.suckDown()
  44.     r.dropDown()
  45.   elseif name == nil then
  46.     r.dropDown()
  47.   end
  48.   local name = ic.getStackInSlot(3, 1)
  49.   if name and name.name == output then
  50.     r.suck()
  51.     r.drop()
  52.   elseif name == nil then
  53.     r.drop()
  54.   else
  55.     os.sleep(50)
  56.   end
  57.   sortirovka()
  58. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement