Progress on DMDocs. PRing progress so far so there's not one mega PR
later with 1500 affected files.

I want my goddamn highlight text on what all these goddamn procs goddamn
do goddamnit. >:(

No actual code change anywhere in this PR, only comments.

---------

Signed-off-by: Batrachophreno <Batrochophreno@gmail.com>
This commit is contained in:
Batrachophreno
2025-08-09 08:22:56 -04:00
committed by GitHub
parent a840bd1cb1
commit c2f054fd81
88 changed files with 1574 additions and 879 deletions
+47 -22
View File
@@ -1,12 +1,19 @@
#define ALARM_RESET_DELAY 100 // How long will the alarm/trigger remain active once origin/source has been found to be gone?
/// How long will the alarm/trigger remain active once origin/source has been found to be gone?
#define ALARM_RESET_DELAY 100
/datum/alarm_source
var/source = null // The source trigger
var/source_name = "" // The name of the source should it be lost (for example a destroyed camera)
var/duration = 0 // How long this source will be alarming, 0 for indefinetely.
var/severity = 1 // How severe the alarm from this source is.
var/start_time = 0 // When this source began alarming.
var/end_time = 0 // Use to set when this trigger should clear, in case the source is lost.
//// The source trigger
var/source = null
/// The name of the source should it be lost (for example a destroyed camera)
var/source_name = ""
/// How long this source will be alarming, 0 for indefinitely.
var/duration = 0
/// How severe the alarm from this source is.
var/severity = 1
/// When this source began alarming.
var/start_time = 0
/// Use to set when this trigger should clear, in case the source is lost.
var/end_time = 0
/datum/alarm_source/New(var/atom/source)
src.source = source
@@ -14,20 +21,29 @@
source_name = source.get_source_name()
/datum/alarm
var/atom/origin //Used to identify the alarm area.
var/list/sources = new() //List of sources triggering the alarm. Used to determine when the alarm should be cleared.
var/list/sources_assoc = new() //Associative list of source triggers. Used to efficiently acquire the alarm source.
var/list/cameras //List of cameras that can be switched to, if the player has that capability.
var/cache_id //ID for camera cache, changed by invalidateCameraCache().
var/area/last_area //The last acquired area, used should origin be lost (for example a destroyed borg containing an alarming camera).
var/area/last_name //The last acquired name, used should origin be lost
var/area/last_camera_area //The last area in which cameras where fetched, used to see if the camera list should be updated.
var/end_time //Used to set when this alarm should clear, in case the origin is lost.
/// Used to identify the alarm area.
var/atom/origin
/// List of sources triggering the alarm. Used to determine when the alarm should be cleared.
var/list/sources = new()
/// Associative list of source triggers. Used to efficiently acquire the alarm source.
var/list/sources_assoc = new()
/// List of cameras that can be switched to, if the player has that capability.
var/list/cameras
/// ID for camera cache, changed by invalidateCameraCache().
var/cache_id
/// The last acquired area, used should origin be lost (for example a destroyed borg containing an alarming camera).
var/area/last_area
/// The last acquired name, used should origin be lost.
var/area/last_name
/// The last area in which cameras where fetched, used to see if the camera list should be updated.
var/area/last_camera_area
/// Used to set when this alarm should clear, in case the origin is lost.
var/end_time
/datum/alarm/New(var/atom/origin, var/atom/source, var/duration, var/severity)
src.origin = origin
cameras() // Sets up both cameras and last alarm area.
// Sets up both cameras and last alarm area.
cameras()
set_source_data(source, duration, severity)
/datum/alarm/process()
@@ -38,8 +54,8 @@
// Has the alarm passed its best before date?
if((AS.end_time && world.time > AS.end_time) || (AS.duration && world.time > (AS.start_time + AS.duration)))
sources -= AS
// Has the source gone missing? Then reset the normal duration and set end_time
if(!AS.source && !AS.end_time) // end_time is used instead of duration to ensure the reset doesn't remain in the future indefinetely.
// Has the source gone missing? Then reset the normal duration and set end_time.
if(!AS.source && !AS.end_time) // end_time is used instead of duration to ensure the reset doesn't remain in the future indefinitely.
AS.duration = 0
AS.end_time = world.time + ALARM_RESET_DELAY
@@ -49,7 +65,7 @@
AS = new/datum/alarm_source(source)
sources += AS
sources_assoc[source] = AS
// Currently only non-0 durations can be altered (normal alarms VS EMP blasts)
// Currently only non-0 durations can be altered (normal alarms VS EMP blasts).
if(AS.duration)
duration = SecondsToTicks(duration)
AS.duration = duration
@@ -74,8 +90,11 @@
last_name = origin.get_alarm_name()
return last_name
/**
* Resets the alarm's camera cache and tries to repopulate it (sometimes cameras move/leave, like borgs etc.).
*/
/datum/alarm/proc/cameras()
// reset camera cache
// Reset camera cache.
if(GLOB.camera_repository.camera_cache_id != cache_id)
cameras = null
cache_id = GLOB.camera_repository.camera_cache_id
@@ -100,12 +119,18 @@
/******************
* Assisting procs *
******************/
/**
* Returns the src's area.
*/
/atom/proc/get_alarm_area()
return get_area(src)
/area/get_alarm_area()
return src
/**
* Wrapper for get_area_display_name (no args).
*/
/atom/proc/get_alarm_name()
var/area/A = get_area(src)
var/display_name = get_area_display_name(A)
+6 -3
View File
@@ -3,9 +3,12 @@
/datum/alarm_handler
var/category = ""
var/list/datum/alarm/alarms = new // All alarms, to handle cases when an origin has been deleted with one or more active alarms
var/list/datum/alarm/alarms_assoc = new // Associative list of alarms, to efficiently acquire them based on origin.
var/list/listeners = new // A list of all objects interested in alarm changes.
// All alarms, to handle cases when an origin has been deleted with one or more active alarms
var/list/datum/alarm/alarms = new
// Associative list of alarms, to efficiently acquire them based on origin.
var/list/datum/alarm/alarms_assoc = new
// A list of all objects interested in alarm changes.
var/list/listeners = new
/datum/alarm_handler/process()
for(var/datum/alarm/A in alarms)