#186 F_ALARM use emergency+ level

This commit is contained in:
Mikayla Fischler
2023-03-04 11:46:59 -05:00
parent d01a6d548f
commit f7828dd05b
4 changed files with 10 additions and 8 deletions

View File

@@ -669,12 +669,13 @@ function unit.new(reactor_id, num_boilers, num_turbines)
-- READ STATES/PROPERTIES --
--#region
-- check if a critical alarm is tripped
-- check if an alarm of at least a certain priority level is tripped
---@nodiscard
---@param min_prio ALARM_PRIORITY alarms with this priority or higher will be checked
---@return boolean tripped
function public.has_critical_alarm()
function public.has_alarm_min_prio(min_prio)
for _, alarm in pairs(self.alarms) do
if alarm.tier == PRIO.CRITICAL and (alarm.state == AISTATE.TRIPPED or alarm.state == AISTATE.ACKED) then
if alarm.tier <= min_prio and (alarm.state == AISTATE.TRIPPED or alarm.state == AISTATE.ACKED) then
return true
end
end