Advertisement
Guest User

IC2 Reactor Control

a guest
Jan 23rd, 2016
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.41 KB | None | 0 0
  1. --[[
  2. Geronimo(TM) Hyper-Breeder XL
  3. IC2 Reactor Control Program
  4. DE, Inc. 2015
  5. --]]
  6.  
  7. local component = require("component")
  8. local sides = require("sides")
  9. local rs = component.redstone
  10.  
  11. -- Set Depleted Isotope Slots
  12. local enrichedCells = {}
  13. enrichedCells[5] = "IC2:item.reactorIsotopeCell"
  14. enrichedCells[13] = "IC2:item.reactorIsotopeCell"
  15. enrichedCells[15] = "IC2:item.reactorIsotopeCell"
  16. enrichedCells[21] = "IC2:item.reactorIsotopeCell"
  17. enrichedCells[23] = "IC2:item.reactorIsotopeCell"
  18. enrichedCells[25] = "IC2:item.reactorIsotopeCell"
  19. enrichedCells[30] = "IC2:item.reactorIsotopeCell"
  20. enrichedCells[33] = "IC2:item.reactorIsotopeCell"
  21. enrichedCells[36] = "IC2:item.reactorIsotopeCell"
  22. enrichedCells[40] = "IC2:item.reactorIsotopeCell"
  23. enrichedCells[42] = "IC2:item.reactorIsotopeCell"
  24. enrichedCells[50] = "IC2:item.reactorIsotopeCell"
  25.  
  26. -- Set Uranium Cell Slots
  27. local fuelCells = {}
  28. fuelCells[14] = "IC2:item.reactorUraniumSimple"
  29. fuelCells[22] = "IC2:item.reactorUraniumSimple"
  30. fuelCells[24] = "IC2:item.reactorUraniumSimple"
  31. fuelCells[31] = "IC2:item.reactorUraniumSimple"
  32. fuelCells[33] = "IC2:item.reactorUraniumSimple"
  33. fuelCells[41] = "IC2:item.reactorUraniumSimple"
  34.  
  35. -- Run Script
  36. while true do
  37.   local enriched = 12
  38.   local fuel = 6
  39.  
  40.   -- Check for Depleted Isotope Cells
  41.   for k, v in pairs(enrichedCells) do
  42.     local itemStack = component.inventory_controller.getStackInSlot(k, sides.back)
  43.    
  44.     -- Compare Slot to Depleted Isotope Cell
  45.     if tostring(itemStack.name) == tostring(v) then
  46.       enriched = enriched - 1
  47.     -- Turn on extraction    
  48.     else
  49.       rs.setOutput(sides.left, 15)
  50.     end
  51.    
  52.     -- Turn on activation signal
  53.     if enriched == 0 then
  54.       rs.setOutput(sides.left, 0)
  55.     end
  56.   end
  57.  
  58.   -- Check for Uranium Cells
  59.   for k, v in pairs(fuelCells) do
  60.     local itemStack = component.inventory_controller.getStackInSlot(k, sides.back)
  61.  
  62.     -- Compare Slot to Uranium Cell
  63.     if tostring(itemStack.name) == tostring(v) then
  64.       fuel = fuel - 1    
  65.     -- Turn on insertion
  66.     else
  67.       rs.setOutput(sides.right, 15)
  68.     end
  69.    
  70.     -- Turn on activation signal
  71.     if fuel == 0 then
  72.       rs.setOutput(sides.right, 0)
  73.     end
  74.   end
  75. end
  76.  
  77. --[[
  78. DISCLAIMER: This program is made by a virtual corporation, existing inside
  79. the Tekkify Minecraft server. For more information, contact the CEO at
  80. [email protected]. DO NOT DISTRIBUTE.
  81. --]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement