mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2025-12-20 15:21:29 +00:00
- Integrates Volundr's btime library and associated process scheduler changes. - btime is implemented separately from the process scheduler, as precise time measurement is also useful elsewhere. - `TimeOfHour` is no longer internally throttled; throttling is instead done by `SCHECK`. - If btime's `gettime` cannot be called at world startup, an error will be output and the world will stop. - Retains the change to schedule processes according to game time, rather than real time. - Removes the (now unused) update queue files. - Removes the process scheduler testing files. - These are standalone tests for the process scheduler, completely unrelated to its use in the full codebase. We never used them. - Moves the process scheduler defines into __DEFINES. - Makes the lighting process run once before the round starts. - Renames `scheck` to `sleepCheck`, to ensure any code that tries to use `scheck` will fail to compile. - Adds `SCHECK` and `SCHECK_EVERY` macros that skip calling `sleepCheck` entirely until a specified number of `SCHECK`s (50 by default) have been called. - Makes most processes iterate using their `last_object` variable, allowing hang recovery to show the type that caused the hang. - Makes processes output an error when they filter out a type they refuse to process. - Rolls the recently-added alarm subsystem into the alarm process. - Removes the now unused subsystems code.
36 lines
1.3 KiB
Plaintext
36 lines
1.3 KiB
Plaintext
// We manually initialize the alarm handlers instead of looping over all existing types
|
|
// to make it possible to write: camera.triggerAlarm() rather than alarm_manager.managers[datum/alarm_handler/camera].triggerAlarm() or a variant thereof.
|
|
/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()
|
|
|
|
// Alarm Manager, the manager for alarms.
|
|
var/datum/controller/process/alarm/alarm_manager
|
|
|
|
/datum/controller/process/alarm
|
|
var/list/datum/alarm/all_handlers
|
|
|
|
/datum/controller/process/alarm/setup()
|
|
name = "alarm"
|
|
schedule_interval = 20 // every 2 seconds
|
|
all_handlers = list(atmosphere_alarm, camera_alarm, fire_alarm, motion_alarm, power_alarm)
|
|
alarm_manager = src
|
|
|
|
/datum/controller/process/alarm/doWork()
|
|
for(var/datum/alarm_handler/AH in all_handlers)
|
|
AH.process()
|
|
|
|
/datum/controller/process/alarm/proc/active_alarms()
|
|
var/list/all_alarms = new
|
|
for(var/datum/alarm_handler/AH in all_handlers)
|
|
var/list/alarms = AH.alarms
|
|
all_alarms += alarms
|
|
|
|
return all_alarms
|
|
|
|
/datum/controller/process/alarm/proc/number_of_active_alarms()
|
|
var/list/alarms = active_alarms()
|
|
return alarms.len
|