Advertisement
Gokborg

Untitled

Oct 20th, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.50 KB | None | 0 0
  1. local reactor = peripheral.wrap("BigReactors-Reactor_2")
  2. local mon = peripheral.wrap("left")
  3. local energy = 0
  4. local fuel = 0
  5. local freak_out = false
  6. local insertion_level = 76
  7. while true do
  8.  
  9.   reactor.setAllControlRodLevels(insertion_level)
  10.  
  11.   --Energy in energy buffer
  12.   energy = getEnergyStored
  13.   --Is the fuel in mb
  14.   fuel = reactor.getFuelAmount()
  15.   --Percentages
  16.   percent_fuel = fuel/240000
  17.   percent_energy = energy/10000000
  18.  
  19.   mon.clear()
  20.   mon.setTextColor(colors.white)
  21.   mon.setCursorPos(1,1)
  22.  
  23.   --Freak out will keep the insertion level 0 until we hit 98%
  24.   if percent_energy >= 98 then
  25.     insertion_level = 76
  26.     freak_out = false
  27.   --Above 50% and below 90% insertion level 60
  28.   elseif percent_energy < 90 and freak_out == false and percent_energy > 50 then
  29.     mon.setTextColor(colors.yellow)
  30.     insertion_level = 60
  31.   --Below 50% insertion level 0
  32.   elseif percent_energy < 50 then
  33.     mon.setTextColor(colors.red)
  34.     freak_out = true
  35.     insertion_level = 0
  36.   end
  37.  
  38.   mon.write("Reactor Status")
  39.   mon.setCursorPos(1,2)
  40.   mon.setTextColor(colors.lightGray)
  41.   mon.write("===========================")
  42.  
  43.   --RF/T Display
  44.   mon.setCursorPos(1,3)
  45.   mon.setTextColor(colors.white)
  46.   mon.write("RF/T: ")
  47.   mon.setTextColor(colors.lime)
  48.   mon.write(math.floor(energy + 0.5))
  49.  
  50.   --Fuel Amount
  51.   mon.setCursorPos(1,4)
  52.   mon.setTextColor(colors.white)
  53.   mon.write("Fuel: ")
  54.   mon.setTextColor(colors.lime)
  55.   mon.write(percent_fuel)
  56.  
  57.  
  58.    
  59.   os.sleep(2)
  60. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement