mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-01-14 11:23:05 +00:00
* first reordering, committed in case i fuck up badly next * from the moment i understood the weakness of my flesh * sdafa * you asked for this * we can't have nice things * sdafasdf * sdafasd * sdfa * fsa * worth a shot * more pain * sdfasdf
48 lines
1.3 KiB
Plaintext
48 lines
1.3 KiB
Plaintext
/var/global/datum/alarm_handler/atmosphere/atmosphere_alarm = new()
|
|
/var/global/datum/alarm_handler/camera/camera_alarm = new()
|
|
/var/global/datum/alarm_handler/fire/fire_alarm = new()
|
|
/var/global/datum/alarm_handler/motion/motion_alarm = new()
|
|
/var/global/datum/alarm_handler/power/power_alarm = new()
|
|
|
|
SUBSYSTEM_DEF(alarm)
|
|
name = "Alarms"
|
|
init_order = INIT_ORDER_MISC_FIRST
|
|
priority = SS_PRIORITY_ALARMS
|
|
runlevels = RUNLEVELS_PLAYING
|
|
|
|
var/list/datum/alarm/all_handlers
|
|
var/tmp/list/current = list()
|
|
|
|
var/tmp/list/active_alarm_cache = list()
|
|
|
|
/datum/controller/subsystem/alarm/Initialize(timeofday)
|
|
all_handlers = list(atmosphere_alarm, camera_alarm, fire_alarm, motion_alarm, power_alarm)
|
|
|
|
return SS_INIT_SUCCESS
|
|
|
|
/datum/controller/subsystem/alarm/fire(resumed = FALSE)
|
|
if (!resumed)
|
|
current = all_handlers.Copy()
|
|
active_alarm_cache.Cut()
|
|
|
|
while (current.len)
|
|
var/datum/alarm_handler/AH = current[current.len]
|
|
current.len--
|
|
|
|
AH.process()
|
|
|
|
active_alarm_cache += AH.alarms
|
|
|
|
if (MC_TICK_CHECK)
|
|
return
|
|
|
|
/datum/controller/subsystem/alarm/proc/active_alarms()
|
|
return active_alarm_cache.Copy()
|
|
|
|
/datum/controller/subsystem/alarm/proc/number_of_active_alarms()
|
|
return active_alarm_cache.len
|
|
|
|
/datum/controller/subsystem/alarm/stat_entry(msg)
|
|
msg = "A:[active_alarm_cache.len]"
|
|
return ..()
|