Advertisement
kaibochan

Reactor.lua

Feb 22nd, 2025
343
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.87 KB | None | 0 0
  1. local Rod = require("/apis/Reactor.Rod")
  2. local Battery = require("/apis/Reactor.Battery")
  3. local CoolantTank = require("/apis/Reactor.CoolantTank")
  4. local FuelTank = require("/apis/Reactor.FuelTank")
  5.  
  6. local Reactor = {
  7.     active = false,
  8.     ambient_temp = 0,
  9.     battery = Battery,
  10.     casing_temp = 0,
  11.     connected = false,
  12.     control_rods = {},
  13.     coolant_tank = CoolantTank,
  14.     fuel_tank = FuelTank,
  15.     fuel_temp = 0,
  16.     stack_temp = 0,
  17. }
  18. setmetatable(Reactor, Reactor)
  19.  
  20. function Reactor:new(reactor)
  21.     reactor = reactor or {}
  22.     setmetatable(reactor, Reactor)
  23.     Reactor.__index = Reactor
  24.  
  25.     reactor.battery = Battery:new(reactor.battery)
  26.     reactor.coolant_tank = CoolantTank:new(reactor.coolant_tank)
  27.     reactor.fuel_tank = FuelTank:new(reactor.fuel_tank)
  28.  
  29.     return {
  30.         active = function()
  31.             return reactor.active
  32.         end,
  33.         ambientTemperature = function()
  34.             return reactor.ambient_temp
  35.         end,
  36.         battery = function()
  37.             return reactor.battery
  38.         end,
  39.         controlRodCount = function()
  40.             return #reactor.control_rods
  41.         end,
  42.         coolantTank = function()
  43.             return reactor.coolant_tank
  44.         end,
  45.         fuelTank = function()
  46.             return reactor.fuel_tank
  47.         end,
  48.         fuelTemperature = function()
  49.             return reactor.fuel_temp
  50.         end,
  51.         getControlRod = function(index)
  52.             return reactor.control_rods[index]
  53.         end,
  54.         setActive = function(active)
  55.             reactor.active = active
  56.         end,
  57.         setAllControlRodLevels = function(level)
  58.             for _, rod in ipairs(reactor.control_rods) do
  59.                 rod.setLevel(level)
  60.             end
  61.         end,
  62.         stackTemperature = function()
  63.             return reactor.stack_temp
  64.         end,
  65.     }
  66. end
  67.  
  68. return Reactor
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement