Advertisement
demon012

bigReactorRegulator

Aug 17th, 2013
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.99 KB | None | 0 0
  1. Reactor = {
  2.     direction = "south"
  3. }
  4.  
  5. Chest = {
  6.     chest = peripheral.wrap("gold_chest_2")
  7. }
  8.  
  9. EnergyCell = {
  10. }
  11. EnergyCell_mt = {__index = EnergyCell}
  12. function EnergyCell:create()--{{{
  13.     local newEnergyCell = {}
  14.     setmetatable(newEnergyCell, EnergyCell_mt)
  15.     return newEnergyCell
  16. end--}}}
  17.  
  18. energyCells = {}
  19. energyCells[1] = EnergyCell:create()
  20. energyCells[1].cell = peripheral.wrap("redstone_energy_cell_2")
  21. energyCells[2] = EnergyCell:create()
  22. energyCells[2].cell = peripheral.wrap("redstone_energy_cell_3")
  23. energyCells[3] = EnergyCell:create()
  24. energyCells[3].cell = peripheral.wrap("redstone_energy_cell_4")
  25. energyCells[4] = EnergyCell:create()
  26. energyCells[4].cell = peripheral.wrap("redstone_energy_cell_5")
  27. energyCells[5] = EnergyCell:create()
  28. energyCells[5].cell = peripheral.wrap("redstone_energy_cell_6")
  29. energyCells[6] = EnergyCell:create()
  30. energyCells[6].cell = peripheral.wrap("redstone_energy_cell_7")
  31. energyCells[7] = EnergyCell:create()
  32. energyCells[7].cell = peripheral.wrap("redstone_energy_cell_8")
  33.  
  34. function Chest:findFuel(name)--{{{
  35.     for slot=0,self.chest.getSizeInventory() do
  36.         local slotContents = self.chest.getStackInSlot(slot)
  37.         if name == slotContents.name then
  38.             return slotContents
  39.         end
  40.     end
  41. end--}}}
  42.  
  43. function getTotalStoredEnergy(energyCells)
  44.     local total = 0
  45.     for key, energyCell in pairs(energyCells) do
  46.         total = total + energyCell.cell.getEnergyStored()
  47.     end
  48.     return total
  49. end
  50.  
  51. function Chest:insertIntoReactor(fuelType, quantity)
  52. end
  53.  
  54. function refuelReactor(chest, reactor)
  55.     chest.chest.condense()
  56.     for slot=0,chest.chest.getSizeInventory()-1 do
  57.  
  58.     end
  59. end
  60.  
  61. reactor = Reactor
  62. chest = Chest
  63. cell = EnergyCell
  64.  
  65. while true do
  66.     os.startTimer(60)
  67.     event, param1, param2, param3 = os.pullEvent("timer")
  68.     if event == 'timer' then
  69.         print(total)
  70.         total = getTotalStoredEnergy(energyCells)
  71.         if total < 600000 then
  72.  
  73.         end
  74.     end
  75. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement