Guest User

Untitled

a guest
Sep 25th, 2014
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.33 KB | None | 0 0
  1. local mon = peripheral.wrap("monitor_1")
  2. local cell = peripheral.wrap("cofh_thermalexpansion_energycell_0")
  3. local reactor = peripheral.wrap("BigReactors-Reactor_0")
  4.  
  5. while true do
  6.     mon.clear()
  7.     mon.setCursorPos(1,1)
  8.     mon.setTextColor(colors.white)
  9.    
  10.     energyStored = math.floor(cell.getEnergyStored("default") + 0.5)
  11.     maxEnergy = cell.getMaxEnergyStored("default")
  12.     energyPerc = math.floor(energyStored / maxEnergy * 100 + 0.5)
  13.    
  14.     mon.write("Energy stored: ")
  15.     mon.setTextColor(colors.green)
  16.     mon.write(energyStored / 1000)
  17.     mon.write("k")
  18.    
  19.     mon.setTextColor(colors.white)
  20.     mon.setCursorPos(1,2)
  21.     mon.write("Energy Percentage: ")
  22.     mon.setTextColor(colors.green)
  23.     mon.write(energyPerc)
  24.     mon.write("%")
  25.    
  26.     mon.setTextColor(colors.white)
  27.     mon.setCursorPos(1,4)
  28.     mon.write("Reactor Status: ")
  29.     if reactor.getActive() == true then
  30.         mon.setTextColor(colors.green)
  31.         mon.write("Active")
  32.     else
  33.         mon.setTextColor(colors.red)
  34.         mon.write("Inactive")
  35.     end
  36.    
  37.     if reactor.getActive() == true then
  38.         mon.setTextColor(colors.white)
  39.         mon.setCursorPos(1,5)
  40.         mon.write("Reactor Power: ")
  41.         mon.setTextColor(colors.green)
  42.         mon.write(math.floor(reactor.getEnergyProducedLastTick() + 0.5))
  43.         mon.write(" RF/Tick")
  44.     end
  45.    
  46.     if energyPerc < 90 then
  47.         reactor.setActive(true)
  48.     else
  49.         reactor.setActive(false)
  50.     end
  51.     sleep(5)
  52. end
Advertisement
Add Comment
Please, Sign In to add comment