Advertisement
NiallDoherty

Reactor

Jul 30th, 2016
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.59 KB | None | 0 0
  1. local mon = peripheral.wrap("left")
  2. mon.setBackgroundColour(colors.black)
  3. local reactor = peripheral.wrap("BigReactors-Reactor_3")
  4.  
  5. local cell = peripheral.wrap("tile_thermalexpansion_cell_resonant_name_0")
  6.  
  7. local fuelBarrel = peripheral.wrap("mcp_mobius_betterbarrel_2")
  8.  
  9. local wasteBarrel = peripheral.wrap("mcp_mobius_betterbarrel_1")
  10.  
  11. for i, v in ipairs(peripheral.getMethods("tile_thermalexpansion_cell_resonant_name_0")) do
  12.   print(i..". "..v)
  13. end
  14.  
  15. function comma_value(amount)
  16.   local formatted = amount
  17.   while true do
  18.     formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2')
  19.     if(k == 0) then
  20.       break
  21.     end
  22.   end
  23.   return formatted
  24. end
  25.  
  26. while true do
  27.   if(cell.getEnergyStored() < 30000000) then
  28.     reactor.setActive(true)
  29.   else
  30.     if(cell.getEnergyStored() > 75000000) then
  31.       reactor.setActive(false)
  32.     end  
  33.   end
  34.   mon.clear()
  35.   mon.setCursorPos(1, 1)
  36.   mon.write("Reactor: "..tostring(reactor.getActive()))
  37.   mon.setCursorPos(1, 2)
  38.   mon.write("Energy in reactor: "..tostring(comma_value(reactor.getEnergyStored())).."RF")
  39.   mon.setCursorPos(1, 3)
  40.   mon.write("Energy in cell: "..tostring(comma_value(cell.getEnergyStored())).."RF")
  41. --  mon.setCursorPos(1, 4)
  42. --  local barrelFuel = fuelBarrel.getStoredItems().qty
  43. --  local barrelWaste = wasteBarrel.getStoredItems().qty
  44. --  mon.write("Fuel in barrel: "..tostring(math.floor(barrelFuel / 64)).."*64 + "..tostring(barrelFuel % 64))
  45. --  mon.setCursorPos(1, 5)
  46. -- mon.write("Waste in barrel: "..tostring(math.floor(barrelWaste / 64)).."*64 + "..tostring(barrelWaste % 64))
  47.   sleep(1.5)
  48. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement