Clem105

Serum v1

Jan 26th, 2014
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.92 KB | None | 0 0
  1. local f = peripheral.wrap("front")
  2. local m = turtle
  3. local t = peripheral.wrap("top")
  4. local cData = {}
  5. local d = {}
  6.  
  7. function getSerumsSpecies()
  8.     local d  = t.getAllStacks()
  9.         for slot, item in pairs(d) do
  10.             cData[item.name] = slot
  11.         end
  12.     end
  13. end
  14.  
  15. function getSerumsOther()
  16.     local d  = f.getAllStacks()
  17.         for slot, item in pairs(d) do
  18.             cData[item.name] = slot
  19.         end
  20.     end
  21. end
  22.  
  23. function checkSerums(serumName)
  24.     return cData[serumName]
  25. end
  26.  
  27. function moveItems()
  28.     local data = m.getAllStacks()
  29.     for slot,item in pairs(data) do
  30.         local t = string.find(item.name,"Species")
  31.         if t  ~= nil then
  32.             getSerumsSpecies()
  33.         else
  34.             getSerumsOther()
  35.         end
  36.         if checkSerum(item.name) then
  37.             while r.pushItem("down",  slot, 1) == 0 do
  38.                 print("Furnace")
  39.                 sleep(2)
  40.             end
  41.         else
  42.             if t ~= nil  then
  43.                 turtle.drop()
  44.             else
  45.                 turtle.dropUp()
  46.             end
  47.         end
  48.     end
  49. end
  50.  
  51. moveItems()
Advertisement
Add Comment
Please, Sign In to add comment