Advertisement
Guest User

run

a guest
Aug 28th, 2015
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.67 KB | None | 0 0
  1. while true do
  2.   local reactor = peripheral.wrap("BigReactors-Reactor_0")
  3.   local turbine = peripheral.wrap("BigReactors-Turbine_0")
  4.   local mon = peripheral.wrap("monitor_0")
  5.   local MaxPower = 1000000
  6.  
  7.   local RPM = math.floor(turbine.getRotorSpeed())
  8.   local Coil = turbine.getInductorEngaged()
  9.  
  10.   local SteamReady = turbine.getInputAmount()
  11.   local SteamRate = turbine.getFluidFlowRate()
  12.  
  13.   local LowCent = 40
  14.   local HighCent = 80
  15.  
  16.   local LowPower = ((LowCent/100)*MaxPower)
  17.   local HighPower = ((HighCent/100)*MaxPower)
  18.  
  19.   local PowerNow = math.floor(turbine.getEnergyStored())
  20.   local Percent = math.floor((PowerNow/MaxPower)*100)
  21.   local PowerSimple = 0
  22.   local Unit = " Err"
  23.  
  24.   local State = "Off"
  25.  
  26.   if reactor.getActive() then
  27.     State = "On"
  28.   else
  29.     State = "Off"
  30.   end
  31.  
  32.   if SteamReady >= 2000 then
  33.     reactor.setActive(false)
  34.   else
  35.     reactor.setActive(true)
  36.   end
  37.  
  38.   if PowerNow >= 0 and PowerNow <= 9999 then
  39.     PowerSimple = PowerNow
  40.     Unit = " RF"
  41.   end
  42.   if PowerNow >= 10000 and PowerNow <= 999999 then
  43.     PowerSimple = PowerNow/1000
  44.     Unit = " KRF"
  45.   end
  46.   if PowerNow >= 1000000 then
  47.     PowerSimple = PowerNow/1000000
  48.     Unit = " MRF"
  49.   end
  50.   if PowerNow >= HighPower then
  51.    -- reactor.setActive(false)
  52.     turbine.setActive(false)
  53.     turbine.setInductorEngaged(false)
  54.   end
  55.  
  56.   turbine.setInductorEngaged(false)
  57.  
  58.   if RPM >= 1700 and RPM <= 1900 then
  59.     turbine.setInductorEngaged(true)
  60.   end
  61.  
  62.   if RPM >= 850 and RPM <= 1050 then
  63.     turbine.setInductorEngaged(true)
  64.   end
  65.   if RPM >= 2300 then
  66.     turbine.setInductorEngaged(true)
  67.   end
  68.   if PowerNow <= LowPower then
  69.     --reactor.setActive(true)
  70.     turbine.setActive(true)
  71.   end
  72.  
  73.  
  74.   mon.clear()
  75.  
  76.   mon.setCursorPos(1,1)
  77.   mon.setTextColor(colors.white)
  78.   mon.write("Reactor: ")
  79.   mon.setTextColor(colors.lime)
  80.   mon.write(State)
  81.  
  82.   mon.setCursorPos(1,2)
  83.   mon.setTextColor(colors.white)
  84.   mon.write("Threshold; Low: ")
  85.   mon.setTextColor(colors.lime)
  86.   mon.write(string.format("%.1d",LowCent))
  87.   mon.write("% ")
  88.   mon.setTextColor(colors.white)
  89.   mon.write("High: ")
  90.   mon.setTextColor(colors.lime)
  91.   mon.write(string.format("%.1d",HighCent))
  92.   mon.write("%")
  93.    
  94.   mon.setCursorPos(1,3)
  95.   mon.setTextColor(colors.white)
  96.   mon.write("Producing: ")  
  97.   mon.setTextColor(colors.lime)
  98.   mon.write(string.format("%.1d",turbine.getEnergyProducedLastTick()))
  99.   mon.write(" RF/t")
  100.  
  101.   mon.setCursorPos(1,4)
  102.   mon.setTextColor(colors.white)
  103.   mon.write("Stored: ")
  104.   mon.setTextColor(colors.lime)
  105.   mon.write(string.format("%.1d",PowerSimple))
  106.   mon.write(Unit)
  107.   mon.write("(")
  108.   mon.write(string.format("%.1d",Percent))
  109.   mon.write("%)")
  110.  
  111.   mon.setCursorPos(1,5)
  112.   mon.setTextColor(colors.white)
  113.   mon.write("Casing Temp: ")
  114.   mon.setTextColor(colors.lime)
  115.   mon.write(string.format("%.1d",reactor.getCasingTemperature()))
  116.   mon.write("'C")
  117.  
  118.   mon.setCursorPos(1,6)
  119.   mon.setTextColor(colors.white)
  120.   mon.write("Rod Temp: ")
  121.   mon.setTextColor(colors.lime)
  122.   mon.write(string.format("%.1d",reactor.getFuelTemperature()))
  123.   mon.write("'C")
  124.  
  125.   mon.setCursorPos(1,7)
  126.   mon.setTextColor(colors.white)
  127.   mon.write("RPM: ")
  128.   mon.setTextColor(colors.lime)
  129.   mon.write(string.format("%.1d",RPM))
  130.  
  131.   mon.setCursorPos(1,8)
  132.   mon.setTextColor(colors.white)
  133.   mon.write("Charging: ")
  134.   mon.setTextColor(colors.lime)
  135.   mon.write(Coil)
  136.  
  137.   mon.setCursorPos(1,9)
  138.   mon.setTextColor(colors.white)
  139.   mon.write("Steam in turbine: ")
  140.   mon.setTextColor(colors.lime)
  141.   mon.write(string.format("%.1d",SteamReady))
  142.   mon.write(" (")
  143.   mon.write(string.format("%.1d",SteamRate))
  144.   mon.write("mb/t)")
  145.  
  146.    sleep(1)
  147. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement