Advertisement
Guest User

Reactor

a guest
Aug 28th, 2015
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.79 KB | None | 0 0
  1. while true do
  2.   local reactor = peripheral.wrap("BigReactors-Reactor_0")
  3.   local mon = peripheral.wrap("monitor_1")
  4.   local MaxPower = 10000000
  5.  
  6.   local LowPower = 10000
  7.   local HighPower = 8000000
  8.  
  9.   local PowerNow = math.floor(reactor.getEnergyStored())
  10.   local Percent = math.floor((PowerNow/MaxPower)*100)
  11.   local PowerSimple = 0
  12.   local Unit = " Err"
  13.  
  14.   if PowerNow >= 0 and PowerNow <= 9999 then
  15.     PowerSimple = PowerNow
  16.     Unit = " RF"
  17.   end
  18.   if PowerNow >= 10000 and PowerNow <= 999999 then
  19.     PowerSimple = PowerNow/1000
  20.     Unit = " KRF"
  21.   end
  22.   if PowerNow >= 1000000 then
  23.     PowerSimple = PowerNow/1000000
  24.     Unit = " MRF"
  25.   end
  26.   if PowerNow >= HighPower then
  27.     reactor.setActive(false)
  28.   end
  29.   if PowerNow <= LowPower then
  30.     reactor.setActive(true)
  31.   end
  32.  
  33.  
  34.   mon.clear()
  35.  
  36.   mon.setCursorPos(1,1)
  37.   mon.setTextColor(colors.white)
  38.   mon.write("Active: ")
  39.   mon.setTextColor(colors.lime)
  40.   mon.write(reactor.getActive())
  41.    
  42.   mon.setCursorPos(1,2)
  43.   mon.setTextColor(colors.white)
  44.   mon.write("Producing: ")  
  45.   mon.setTextColor(colors.lime)
  46.   mon.write(math.floor(reactor.getEnergyProducedLastTick()))
  47.   mon.write(" RF/t")
  48.  
  49.   mon.setCursorPos(1,3)
  50.   mon.setTextColor(colors.white)
  51.   mon.write("Stored: ")
  52.   mon.setTextColor(colors.lime)
  53.   mon.write(PowerSimple)
  54.   mon.write(Unit)
  55.   mon.write("(")
  56.   mon.write(Percent)
  57.   mon.write("%)")
  58.  
  59.   mon.setCursorPos(1,4)
  60.   mon.setTextColor(colors.white)
  61.   mon.write("Casing Heat: ")
  62.   mon.setTextColor(colors.lime)
  63.   mon.write(math.floor(reactor.getCasingTemperature()))
  64.   mon.write("'C")
  65.  
  66.   mon.setCursorPos(1,5)
  67.   mon.setTextColor(colors.white)
  68.   mon.write("Rod Heat: ")
  69.   mon.setTextColor(colors.lime)
  70.   mon.write(math.floor(reactor.getFuelTemperature()))
  71.   mon.write("'C")
  72.  
  73.  
  74.    sleep(1)
  75. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement