mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-27 15:17:01 +01:00
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:
@@ -20,6 +20,8 @@
|
||||
var/list/start_showpieces = list() //Takes sublists in the form of list("type" = /obj/item/bikehorn, "trophy_message" = "henk")
|
||||
var/trophy_message = ""
|
||||
var/glass_fix = TRUE
|
||||
///Represents a signel source of screaming when broken
|
||||
var/datum/alarm_handler/alarm_manager
|
||||
|
||||
/obj/structure/displaycase/Initialize()
|
||||
. = ..()
|
||||
@@ -32,6 +34,7 @@
|
||||
if(start_showpiece_type)
|
||||
showpiece = new start_showpiece_type (src)
|
||||
update_appearance()
|
||||
alarm_manager = new(src)
|
||||
|
||||
/obj/structure/displaycase/vv_edit_var(vname, vval)
|
||||
. = ..()
|
||||
@@ -49,6 +52,7 @@
|
||||
/obj/structure/displaycase/Destroy()
|
||||
QDEL_NULL(electronics)
|
||||
QDEL_NULL(showpiece)
|
||||
QDEL_NULL(alarm_manager)
|
||||
return ..()
|
||||
|
||||
/obj/structure/displaycase/examine(mob/user)
|
||||
@@ -98,6 +102,10 @@
|
||||
return
|
||||
var/area/alarmed = get_area(src)
|
||||
alarmed.burglaralert(src)
|
||||
|
||||
alarm_manager.send_alarm(ALARM_BURGLAR)
|
||||
addtimer(CALLBACK(alarm_manager, /datum/alarm_handler/proc/clear_alarm, ALARM_BURGLAR), 1 MINUTES)
|
||||
|
||||
playsound(src, 'sound/effects/alert.ogg', 50, TRUE)
|
||||
|
||||
/obj/structure/displaycase/update_overlays()
|
||||
@@ -122,7 +130,7 @@
|
||||
to_chat(user, span_notice("You [open ? "close":"open"] [src]."))
|
||||
toggle_lock(user)
|
||||
else
|
||||
to_chat(user, span_alert("Access denied."))
|
||||
to_chat(user, span_alert("Access denied."))
|
||||
else if(W.tool_behaviour == TOOL_WELDER && !user.combat_mode && !broken)
|
||||
if(obj_integrity < max_integrity)
|
||||
if(!W.tool_start_check(user, amount=5))
|
||||
|
||||
Reference in New Issue
Block a user