ivan52

IC2:reactor

Apr 9th, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.36 KB | None | 0 0
  1. --IC2:reactor--
  2. local r = require('robot')
  3. local comp = require('computer')
  4. local com = require('component')
  5. local inv = com.inventory_controller
  6. local db = com.database
  7.  
  8. fuel = {}
  9. fuel['IC2:reactorUraniumSimple'] = true
  10. fuel['IC2:reactorMOXSimple'] = true
  11.  
  12. othod = {}
  13. othod['IC2:reactorUraniumSimpledepleted'] = true
  14. othod['IC2:reactorMOXSimpledepleted'] = true
  15.  
  16. sizeDB = 24
  17. mesto = {}
  18. q = 0
  19. for i = 1, sizeDB do
  20.   if db.get(i) ~= nil then
  21.     if fuel[db.get(i).name] then
  22.       name = db.get(i).name
  23.       q = q + 1
  24.       mesto[q] = i
  25.     end
  26.   end
  27. end
  28.  
  29. size = inv.getInventorySize(3)
  30.  
  31. while true do
  32.   while r.count(1)<q do
  33.     i=1
  34.     for i=1, size do
  35.       if inv.getStackInSlot(3,i) ~= nil then
  36.         if inv.getStackInSlot(3,i).name == name then
  37.           inv.suckFromSlot(3, i, q - r.count(1))
  38.           if r.count(1) == 12 then
  39.             break
  40.           end
  41.         end
  42.       end
  43.     end
  44.     i=i+1
  45.   end
  46.   for i = 1, q do
  47.     inv.dropIntoSlot(0, mesto[i], 1)
  48.   end
  49.  
  50.   while not r.back() do end
  51.   r.useDown()
  52.   while not r.forward() do end
  53.   while not othod[inv.getStackInSlot(0,mesto[1]).name] do
  54.     os.sleep(8)
  55.   end
  56.   os.sleep(15)
  57.   while not r.back() do end
  58.   r.useDown()
  59.   while not r.forward() do end
  60.  
  61.   for i = 1, q do
  62.     inv.suckFromSlot(0, mesto[i], 1)
  63.   end
  64.   r.turnRight()
  65.   r.drop()
  66.   r.turnLeft()
  67. end
Add Comment
Please, Sign In to add comment