Advertisement
kaibochan

Instrumentation.lua

Feb 22nd, 2025
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.45 KB | None | 0 0
  1. -- Instrumentation.lua
  2. ---------------------------------------------------------------------------
  3. --- Written 2025
  4. --- This file is part of the Nuclear Reactor Control System Instrumentation
  5. --- For Bigger Reactors on the ATM9TTS 1.1.3 Server
  6. --- Created by npick001
  7. ---
  8. --- *scope edits by kaibochan
  9. ---------------------------------------------------------------------------
  10. local Instruments = {}
  11.  
  12. function Instruments.CreateReactorStatus(reactor)
  13.     return {
  14.         activity = Instruments.CheckActivity(reactor),
  15.         control_rod_depths = Instruments.CheckRodDepths(reactor),
  16.         fuel = Instruments.CheckFuel(reactor),
  17.         fuel_heat = Instruments.CheckFuelHeat(reactor),
  18.         waste = Instruments.CheckWaste(reactor),
  19.         power_stored = Instruments.CheckPowerStorage(reactor)
  20.     }
  21. end
  22.  
  23. function Instruments.CheckActivity(r)
  24.     return r.active()
  25. end
  26.  
  27. function Instruments.CheckRodDepths(r)
  28.     -- check rod depth
  29.     num_rods = r.controlRodCount()
  30.     rod_depths = {}
  31.  
  32.     for i = 0, num_rods - 1 do
  33.         rod_depths[i + 1] = r.getControlRod(i).level()
  34.     end
  35.  
  36.     return rod_depths
  37. end
  38.  
  39. function Instruments.CheckFuel(r)
  40.     return r.fuelTank().fuel()
  41. end
  42.  
  43. function Instruments.CheckWaste(r)
  44.     return r.fuelTank().waste()
  45. end
  46.  
  47. function Instruments.CheckPowerStorage(r)
  48.     return r.battery().stored()
  49. end
  50.  
  51. function Instruments.CheckFuelHeat(r)
  52.     return r.fuelTemperature()
  53. end
  54.  
  55. return Instruments
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement