Advertisement
Guest User

nuclear

a guest
Feb 19th, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.79 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 depleted = true
  7.  
  8. local x = 1
  9.  
  10. local lzhF = { id = "IC2:item.reactorCondensatorLap", dmg = 0, }
  11. local uranF = { id = "IC2:item.reactorUraniumQuad", dmg = 0, }
  12. local overF = { id = "IC2:item.reactorVentGold", dmg = 0, }
  13.  
  14. local function reFuel(check)
  15.   if x == 1 then
  16.     x = 0
  17.     rs.setOutput("front", false)
  18.    
  19.     if check then
  20.       for o = 1, 54 do
  21.         recycler.pullItem("north", o, 1, 1)
  22.       end
  23.     end
  24.  
  25.     for i = 1, 54 do
  26.    
  27.       if setup[i] == 0 then
  28.         storage.exportItem(lzhF, "south", 1, i)
  29.       elseif setup[i] == 1 then
  30.         storage.exportItem(uranF, "south", 1, i)
  31.       elseif setup[i] == 2 then
  32.         storage.exportItem(overF, "south", 1, i)
  33.       end
  34.     end
  35.     rs.setOutput("front", true)
  36.   end
  37. end
  38.  
  39. while true do
  40. term.clear()
  41. term.setCursorPos(1,1)
  42. -- MAIN
  43.  
  44.   print("Running: " .. tostring(reactor.isActive()))
  45.   print("Heat: " .. reactor.getHeat())
  46.  
  47.   if reactor.getHeat() >= 100 then
  48.         rs.setOutput("front", false)
  49.    
  50.         for y = 1, 54 do
  51.         recycler.pullItem("east", y, 1, 1)
  52.      end
  53.    
  54.   elseif reactor.getHeat() < 100 then
  55.  
  56.         rs.setOutput("front", true)
  57.    
  58.   end
  59.   depleted = rs.getInput("back")
  60.  
  61.   if depleted == true then
  62.     x = 1
  63.   elseif depleted == false and x == 1 then
  64.     if next(reactor.getAllStacks()) == nil then
  65.       reFuel(false)
  66.       x = 0
  67.     else
  68.       reFuel(true)
  69.       x = 0
  70.     end
  71.   end
  72.  
  73. os.queueEvent("fakeEvent")
  74. os.pullEvent()
  75. -- MAIN
  76. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement