Redoes how alarms are handled, moves their behavior to datums (#60060)

* Adds in a set of datums to support sending, listening and storing alerts
In contrast to the old system, we now store a list of send alerts on the listener, rather then the area itself.

This makes clearing "our" alerts on destroy not a massive headache.

In addition, we now use a direct ref to the area's cameras list and signals to prevent camera hard deletes. This, combined with the aformentioned ability to clear, virtually eliminates hard deletes
sourced from alerts caused by strange senarios like the alert source moving its tile.

* Converts areas to the system, of note is the fact that areas no longer store a bool that determins if an alert
for power or atmos has been sent, that's instead handled by the alert sender datum. This means the sources list
on alert listeners actually means something

additionally, in order to prevent dumbassery with fire alarms since they're area based, fire alerts are sent by
an alert handler on the area itself
This commit is contained in:
LemonInTheDark
2021-08-13 11:54:44 -07:00
committed by GitHub
parent 3352d10c97
commit 79dc58fe2a
19 changed files with 425 additions and 579 deletions
@@ -1,4 +1,4 @@
// Look up levels[z].traits[trait]
/// Look up levels[z].traits[trait]
/datum/controller/subsystem/mapping/proc/level_trait(z, trait)
if (!isnum(z) || z < 1)
return null
@@ -15,21 +15,21 @@
return list()
return default[z][DL_TRAITS][trait]
// Check if levels[z] has any of the specified traits
/// Check if levels[z] has any of the specified traits
/datum/controller/subsystem/mapping/proc/level_has_any_trait(z, list/traits)
for (var/I in traits)
if (level_trait(z, I))
return TRUE
return FALSE
// Check if levels[z] has all of the specified traits
/// Check if levels[z] has all of the specified traits
/datum/controller/subsystem/mapping/proc/level_has_all_traits(z, list/traits)
for (var/I in traits)
if (!level_trait(z, I))
return FALSE
return TRUE
// Get a list of all z which have the specified trait
/// Get a list of all z which have the specified trait
/datum/controller/subsystem/mapping/proc/levels_by_trait(trait)
. = list()
var/list/_z_list = z_list
@@ -38,7 +38,7 @@
if (S.traits[trait])
. += S.z_value
// Get a list of all z which have any of the specified traits
/// Get a list of all z which have any of the specified traits
/datum/controller/subsystem/mapping/proc/levels_by_any_trait(list/traits)
. = list()
var/list/_z_list = z_list
@@ -49,7 +49,7 @@
. += S.z_value
break
// Attempt to get the turf below the provided one according to Z traits
/// Attempt to get the turf below the provided one according to Z traits
/datum/controller/subsystem/mapping/proc/get_turf_below(turf/T)
if (!T)
return
@@ -58,7 +58,7 @@
return
return locate(T.x, T.y, T.z + offset)
// Attempt to get the turf above the provided one according to Z traits
/// Attempt to get the turf above the provided one according to Z traits
/datum/controller/subsystem/mapping/proc/get_turf_above(turf/T)
if (!T)
return
@@ -67,7 +67,7 @@
return
return locate(T.x, T.y, T.z + offset)
// Prefer not to use this one too often
/// Prefer not to use this one too often
/datum/controller/subsystem/mapping/proc/get_station_center()
var/station_z = levels_by_trait(ZTRAIT_STATION)[1]
return locate(round(world.maxx * 0.5, 1), round(world.maxy * 0.5, 1), station_z)