Advertisement
Guest User

nuclear

a guest
Feb 20th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.93 KB | None | 0 0
  1. local setup = { 0, 1, 0, 1, 0, 1, 0, 0, 2, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 2 }
  2.  
  3. local reactor = peripheral.wrap("top")
  4. local storage = peripheral.wrap("tileinterface_4")
  5. local recycler = peripheral.wrap("tileinterface_5")
  6. local full = true
  7.  
  8. local x = 1
  9. local loops = 1
  10.  
  11. local lzhF = { id = "IC2:item.reactorCondensatorLap", dmg = 0, }
  12. local uranF = { id = "IC2:item.reactorUraniumQuad", dmg = 0, }
  13. local overF = { id = "IC2:item.reactorVentGold", dmg = 0, }
  14.  
  15. local function reFuel(check)
  16.   if x == 1 then
  17.     x = 0
  18.     loops = 0
  19.     rs.setOutput("front", false)
  20.    
  21.     if check then
  22.       for o = 1, 54 do
  23.         recycler.pullItem("north", o, 1, 1)
  24.       end
  25.     end
  26.  
  27.     for i = 1, 54 do
  28.    
  29.       if setup[i] == 0 then
  30.         storage.exportItem(lzhF, "south", 1, i)
  31.       elseif setup[i] == 1 then
  32.         storage.exportItem(uranF, "south", 1, i)
  33.       elseif setup[i] == 2 then
  34.         storage.exportItem(overF, "south", 1, i)
  35.       end
  36.     end
  37.     rs.setOutput("front", true)
  38.   end
  39. end
  40.  
  41. while true do
  42. term.clear()
  43. term.setCursorPos(1,1)
  44. full = rs.getInput("back")
  45. -- MAIN
  46.  
  47.   print("Running: " .. tostring(reactor.isActive()))
  48.   print("Heat: " .. reactor.getHeat())
  49.   print("Loops:" .. loops)
  50.  
  51.   if reactor.getHeat() >= 100 then
  52.     rs.setOutput("front", false)
  53.     for y = 1, 54 do
  54.        recycler.pullItem("north", y, 1, 1)
  55.     end
  56.   elseif reactor.getHeat() < 100 then
  57.     rs.setOutput("front", true)
  58.   end
  59.  
  60.   if reactor.isActive() and reactor.getHeat() < 100 then
  61.    
  62.     for w = 1, 54 do
  63.           if loops > 540 then
  64.           print("here")
  65.              rs.setOutput("front", false)
  66.              x = 1
  67.        end
  68.      
  69.         if reactor.getStackInSlot(w) ~= nil then
  70.           if setup[w] == 0 then
  71.                 if reactor.getStackInSlot(w).id == "IC2:item.reactorCondensatorLap" and reactor.getStackInSlot(w).dmg > 50000 then
  72.             loops = loops + 1
  73.             recycler.pullItem("north", w, 1, 1)
  74.             storage.exportItem(lzhF, "south", 1, w)
  75.                 end
  76.           elseif setup[w] == 1 then
  77.               if reactor.getStackInSlot(w).id == "IC2:item.reactorUraniumQuad" and reactor.getStackInSlot(w).dmg > 7500 then
  78.            loops = loops + 1           
  79.            recycler.pullItem("north", w, 1, 1)
  80.            storage.exportItem(uranF, "south", 1, w)
  81.             end
  82.           end
  83.         elseif reactor.getStackInSlot(w) == nil then
  84.       if setup[w] == 0 then
  85.         storage.exportItem(lzhF, "south", 1, w)
  86.       elseif setup[w] == 1 then
  87.         storage.exportItem(uranF, "south", 1, w)
  88.       end
  89.     end
  90.    end
  91.   end
  92.  
  93.   if full == true then
  94.     x = 1
  95.   elseif full == false and x == 1 then
  96.     if next(reactor.getAllStacks()) == nil then
  97.       reFuel(false)
  98.       x = 0
  99.     else
  100.       reFuel(true)
  101.       x = 0
  102.     end
  103.   end
  104.  
  105. os.queueEvent("fakeEvent")
  106. os.pullEvent()
  107. -- MAIN
  108. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement