Refactor: refactor security levels (#21899)

* refactor: datumize security levels

* refactor: implement `SSsecurity_level` for handling security level related stuff

* feat: returns back old `delta_alarm` sound

* refactor: adjust existing code to use `SSsecurity_level`

* fix: remove redundunt new init order

* fix: fix type in var

* refactor: apply reviewer changes

* fix: replace `can_fire=FALSE` with `ss_flags = SS_NO_FIRE`, as subsystem will never fire

* fix: use `flags` instead of `ss_flags` for subsystem

Co-authored-by: SteelSlayer <42044220+SteelSlayer@users.noreply.github.com>

* fix: replace old security level interactions

* feat: implement `Recover` proc for `SSsecurity_level`

* refactor: add clearer doc for `security_level_set_timer_id`  propery of `SSsecurirt_level`

* refactor: swap `security_level` datum properties to make it clearer to read

* refactor: move initialization code from `New` to `Initialize` for `/obj/machinery/firealarm`

* fix: revert back `delta_alarm` annoing sound, use `delta_claxon` on change to delta security level

---------

Co-authored-by: SteelSlayer <42044220+SteelSlayer@users.noreply.github.com>
This commit is contained in:
Gaxeer
2023-10-14 21:46:49 +02:00
committed by GitHub
co-authored by SteelSlayer
parent 6a2704a3ad
commit eda2102bdc
29 changed files with 450 additions and 321 deletions
@@ -95,7 +95,7 @@
/obj/machinery/keycard_auth/ui_data()
var/list/data = list()
data["redAvailable"] = GLOB.security_level == SEC_LEVEL_RED ? FALSE : TRUE
data["redAvailable"] = SSsecurity_level.get_current_level_as_number() != SEC_LEVEL_RED
data["swiping"] = swiping
data["busy"] = busy
data["event"] = active && event_source && event_source.event ? event_source.event : event
@@ -172,7 +172,7 @@
SHOULD_NOT_SLEEP(TRUE) // trigger_armed_response_team sleeps, which can cause issues for procs that call trigger_event(). We want to avoid that
switch(event)
if("Red Alert")
INVOKE_ASYNC(GLOBAL_PROC, GLOBAL_PROC_REF(set_security_level), SEC_LEVEL_RED)
INVOKE_ASYNC(SSsecurity_level, TYPE_PROC_REF(/datum/controller/subsystem/security_level, set_level), SEC_LEVEL_RED)
if("Grant Emergency Maintenance Access")
make_maint_all_access()
if("Revoke Emergency Maintenance Access")