From 187119d985fc08fe17b24af1f84ce2ea340b20b7 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Sun, 11 Apr 2021 01:11:52 +0200 Subject: [PATCH] [MIRROR] Security Level subsystem (#4809) * Security Level subsystem * aaa Co-authored-by: Arkatos1 <43862960+Arkatos1@users.noreply.github.com> Co-authored-by: Gandalf --- code/__DEFINES/dcs/signals.dm | 3 ++ code/controllers/subsystem/nightshift.dm | 2 +- code/controllers/subsystem/security_level.dm | 17 +++++++ code/game/gamemodes/dynamic/dynamic.dm | 2 +- code/game/gamemodes/game_mode.dm | 2 +- .../game/machinery/computer/communications.dm | 2 +- code/game/machinery/defibrillator_mount.dm | 4 +- code/game/machinery/doors/door.dm | 22 ++++++++- code/game/machinery/firealarm.dm | 20 ++++++-- .../security_levels/security_levels.dm | 49 ++++--------------- code/modules/shuttle/emergency.dm | 22 ++++++++- .../mob/living/dead/new_player/new_player.dm | 2 +- .../modules/alerts/code/firealarm.dm | 2 +- .../modules/alerts/code/set_security_level.dm | 42 ++++++---------- .../modules/autotransfer/code/shuttle.dm | 2 +- .../code/modules/antagonists/blob/overmind.dm | 4 +- tgstation.dme | 1 + 17 files changed, 113 insertions(+), 85 deletions(-) create mode 100644 code/controllers/subsystem/security_level.dm diff --git a/code/__DEFINES/dcs/signals.dm b/code/__DEFINES/dcs/signals.dm index cbf0d6372e8..08a1a3aba41 100644 --- a/code/__DEFINES/dcs/signals.dm +++ b/code/__DEFINES/dcs/signals.dm @@ -40,6 +40,9 @@ ///from SSsun when the sun changes position : (azimuth) #define COMSIG_SUN_MOVED "sun_moved" +///from SSsecurity_level when the security level changes : (new_level) +#define COMSIG_SECURITY_LEVEL_CHANGED "security_level_changed" + ////////////////////////////////////////////////////////////////// // /datum signals diff --git a/code/controllers/subsystem/nightshift.dm b/code/controllers/subsystem/nightshift.dm index bc16085f68c..1e8daad6e61 100644 --- a/code/controllers/subsystem/nightshift.dm +++ b/code/controllers/subsystem/nightshift.dm @@ -27,7 +27,7 @@ SUBSYSTEM_DEF(nightshift) priority_announce(message, sound='sound/misc/notice2.ogg', sender_override="Automated Lighting System Announcement") /datum/controller/subsystem/nightshift/proc/check_nightshift() - var/emergency = GLOB.security_level >= SEC_LEVEL_RED + var/emergency = SSsecurity_level.current_level >= SEC_LEVEL_RED var/announcing = TRUE var/time = station_time() var/night_time = (time < nightshift_end_time) || (time > nightshift_start_time) diff --git a/code/controllers/subsystem/security_level.dm b/code/controllers/subsystem/security_level.dm new file mode 100644 index 00000000000..e3168dee0c3 --- /dev/null +++ b/code/controllers/subsystem/security_level.dm @@ -0,0 +1,17 @@ +SUBSYSTEM_DEF(security_level) + name = "Security Level" + flags = SS_NO_FIRE + /// Currently set security level + var/current_level = SEC_LEVEL_GREEN + +/** + * Sets a new security level as our current level + * + * Arguments: + * * new_level The new security level that will become our current level + */ +/datum/controller/subsystem/security_level/proc/set_level(new_level) + SSsecurity_level.current_level = new_level + SEND_SIGNAL(src, COMSIG_SECURITY_LEVEL_CHANGED, new_level) + SSnightshift.check_nightshift() + SSblackbox.record_feedback("tally", "security_level_changes", 1, get_security_level()) diff --git a/code/game/gamemodes/dynamic/dynamic.dm b/code/game/gamemodes/dynamic/dynamic.dm index e340217d258..55fe3a7c2aa 100644 --- a/code/game/gamemodes/dynamic/dynamic.dm +++ b/code/game/gamemodes/dynamic/dynamic.dm @@ -291,7 +291,7 @@ GLOBAL_VAR_INIT(dynamic_forced_threat_level, -1) print_command_report(., "Central Command Status Summary", announce=FALSE) priority_announce("A summary has been copied and printed to all communications consoles.", "Security level elevated.", ANNOUNCER_INTERCEPT) - if(GLOB.security_level < SEC_LEVEL_BLUE) + if(SSsecurity_level.current_level < SEC_LEVEL_BLUE) set_security_level(SEC_LEVEL_BLUE) // Yes, this is copy pasted from game_mode diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index ff1cb07d30a..379acbd0e44 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -327,7 +327,7 @@ print_command_report(intercepttext, "Central Command Status Summary", announce=FALSE) priority_announce("A summary has been copied and printed to all communications consoles.", "Enemy communication intercepted. Security level elevated.", ANNOUNCER_INTERCEPT) - if(GLOB.security_level < SEC_LEVEL_BLUE) + if(SSsecurity_level.current_level < SEC_LEVEL_BLUE) set_security_level(SEC_LEVEL_BLUE) /* diff --git a/code/game/machinery/computer/communications.dm b/code/game/machinery/computer/communications.dm index 2be6e757a26..3433ea23941 100755 --- a/code/game/machinery/computer/communications.dm +++ b/code/game/machinery/computer/communications.dm @@ -141,7 +141,7 @@ //if (new_sec_level != SEC_LEVEL_GREEN && new_sec_level != SEC_LEVEL_BLUE) - ORIGINAL if (new_sec_level < SEC_LEVEL_GREEN || new_sec_level > SEC_LEVEL_AMBER) //SKYRAT EDIT CHANGE - ALERTS return - if (GLOB.security_level == new_sec_level) + if (SSsecurity_level.current_level == new_sec_level) return set_security_level(new_sec_level) diff --git a/code/game/machinery/defibrillator_mount.dm b/code/game/machinery/defibrillator_mount.dm index 57022bf665f..a0790247679 100644 --- a/code/game/machinery/defibrillator_mount.dm +++ b/code/game/machinery/defibrillator_mount.dm @@ -37,7 +37,7 @@ . = ..() if(defib) . += "There is a defib unit hooked up. Alt-click to remove it." - if(GLOB.security_level >= SEC_LEVEL_RED) + if(SSsecurity_level.current_level >= SEC_LEVEL_RED) . += "Due to a security situation, its locking clamps can be toggled by swiping any ID." else . += "Its locking clamps can be [clamps_locked ? "dis" : ""]engaged by swiping an ID with access." @@ -102,7 +102,7 @@ return var/obj/item/card/id = I.GetID() if(id) - if(check_access(id) || GLOB.security_level >= SEC_LEVEL_RED) //anyone can toggle the clamps in red alert! + if(check_access(id) || SSsecurity_level.current_level >= SEC_LEVEL_RED) //anyone can toggle the clamps in red alert! if(!defib) to_chat(user, "You can't engage the clamps on a defibrillator that isn't there.") return diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index 12dfe7d531e..dfd08f2b954 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -47,7 +47,7 @@ /obj/machinery/door/examine(mob/user) . = ..() if(red_alert_access) - if(GLOB.security_level >= SEC_LEVEL_RED) + if(SSsecurity_level.current_level >= SEC_LEVEL_RED) . += "Due to a security threat, its access requirements have been lifted!" else . += "In the event of a red alert, its access requirements will automatically lift." @@ -57,7 +57,7 @@ . += "It has labels indicating that it has an emergency mechanism to open it with just your hands if there's no power." /obj/machinery/door/check_access_list(list/access_list) - if(red_alert_access && GLOB.security_level >= SEC_LEVEL_RED) + if(red_alert_access && SSsecurity_level.current_level >= SEC_LEVEL_RED) return TRUE return ..() @@ -77,6 +77,7 @@ //doors only block while dense though so we have to use the proc real_explosion_block = explosion_block explosion_block = EXPLOSION_BLOCK_PROC + RegisterSignal(SSsecurity_level, COMSIG_SECURITY_LEVEL_CHANGED, .proc/check_security_level) /obj/machinery/door/proc/set_init_door_layer() if(density) @@ -93,6 +94,23 @@ air_update_turf(TRUE, FALSE) return ..() +/** + * Signal handler for checking if we notify our surrounding that access requirements are lifted accordingly to a newly set security level + * + * Arguments: + * * source The datum source of the signal + * * new_level The new security level that is in effect + */ +/obj/machinery/door/proc/check_security_level(datum/source, new_level) + SIGNAL_HANDLER + + if(new_level <= SEC_LEVEL_BLUE) + return + if(!red_alert_access) + return + audible_message("[src] whirr[p_s()] as [p_they()] automatically lift[p_s()] access requirements!") + playsound(src, 'sound/machines/boltsup.ogg', 50, TRUE) + /obj/machinery/door/proc/try_safety_unlock(mob/user) if(safety_mode && !hasPower() && density) to_chat(user, "You begin unlocking the airlock safety mechanism...") diff --git a/code/game/machinery/firealarm.dm b/code/game/machinery/firealarm.dm index 874c779bb8f..bbf32901c87 100644 --- a/code/game/machinery/firealarm.dm +++ b/code/game/machinery/firealarm.dm @@ -51,6 +51,7 @@ update_appearance() myarea = get_area(src) LAZYADD(myarea.firealarms, src) + RegisterSignal(SSsecurity_level, COMSIG_SECURITY_LEVEL_CHANGED, .proc/check_security_level) /obj/machinery/firealarm/ComponentInitialize() . = ..() @@ -78,9 +79,9 @@ . += "fire_overlay" if(is_station_level(z)) - . += "fire_[GLOB.security_level]" - . += mutable_appearance(icon, "fire_[GLOB.security_level]", layer, plane) - . += mutable_appearance(icon, "fire_[GLOB.security_level]", layer, EMISSIVE_PLANE) + . += "fire_[SSsecurity_level.current_level]" + . += mutable_appearance(icon, "fire_[SSsecurity_level.current_level]", layer, plane) + . += mutable_appearance(icon, "fire_[SSsecurity_level.current_level]", layer, EMISSIVE_PLANE) else . += "fire_[SEC_LEVEL_GREEN]" . += mutable_appearance(icon, "fire_[SEC_LEVEL_GREEN]", layer, plane) @@ -145,6 +146,19 @@ myarea.triggered_firealarms -= 1 update_appearance() +/** + * Signal handler for checking if we should update fire alarm appearance accordingly to a newly set security level + * + * Arguments: + * * source The datum source of the signal + * * new_level The new security level that is in effect + */ +/obj/machinery/firealarm/proc/check_security_level(datum/source, new_level) + SIGNAL_HANDLER + + if(is_station_level(z)) + update_appearance() + /obj/machinery/firealarm/proc/alarm(mob/user) if(!is_operational || !COOLDOWN_FINISHED(src, last_alarm)) return diff --git a/code/modules/security_levels/security_levels.dm b/code/modules/security_levels/security_levels.dm index 25292b54ce4..80ccff438b9 100644 --- a/code/modules/security_levels/security_levels.dm +++ b/code/modules/security_levels/security_levels.dm @@ -1,4 +1,3 @@ -GLOBAL_VAR_INIT(security_level, SEC_LEVEL_GREEN) //SEC_LEVEL_GREEN = code green //SEC_LEVEL_BLUE = code blue //SEC_LEVEL_RED = code red @@ -20,21 +19,17 @@ GLOBAL_VAR_INIT(security_level, SEC_LEVEL_GREEN) level = SEC_LEVEL_DELTA //Will not be announced if you try to set to the same level as it already is - if(level >= SEC_LEVEL_GREEN && level <= SEC_LEVEL_DELTA && level != GLOB.security_level) + if(level >= SEC_LEVEL_GREEN && level <= SEC_LEVEL_DELTA && level != SSsecurity_level.current_level) switch(level) if(SEC_LEVEL_GREEN) minor_announce(CONFIG_GET(string/alert_green), "Attention! Security level lowered to green:") if(SSshuttle.emergency.mode == SHUTTLE_CALL || SSshuttle.emergency.mode == SHUTTLE_RECALL) - if(GLOB.security_level >= SEC_LEVEL_RED) + if(SSsecurity_level.current_level >= SEC_LEVEL_RED) SSshuttle.emergency.modTimer(4) else SSshuttle.emergency.modTimer(2) - GLOB.security_level = SEC_LEVEL_GREEN - for(var/obj/machinery/firealarm/FA in GLOB.machines) - if(is_station_level(FA.z)) - FA.update_appearance() if(SEC_LEVEL_BLUE) - if(GLOB.security_level < SEC_LEVEL_BLUE) + if(SSsecurity_level.current_level < SEC_LEVEL_BLUE) minor_announce(CONFIG_GET(string/alert_blue_upto), "Attention! Security level elevated to blue:",1) if(SSshuttle.emergency.mode == SHUTTLE_CALL || SSshuttle.emergency.mode == SHUTTLE_RECALL) SSshuttle.emergency.modTimer(0.5) @@ -42,52 +37,28 @@ GLOBAL_VAR_INIT(security_level, SEC_LEVEL_GREEN) minor_announce(CONFIG_GET(string/alert_blue_downto), "Attention! Security level lowered to blue:") if(SSshuttle.emergency.mode == SHUTTLE_CALL || SSshuttle.emergency.mode == SHUTTLE_RECALL) SSshuttle.emergency.modTimer(2) - GLOB.security_level = SEC_LEVEL_BLUE - for(var/obj/machinery/firealarm/FA in GLOB.machines) - if(is_station_level(FA.z)) - FA.update_appearance() if(SEC_LEVEL_RED) - if(GLOB.security_level < SEC_LEVEL_RED) + if(SSsecurity_level.current_level < SEC_LEVEL_RED) minor_announce(CONFIG_GET(string/alert_red_upto), "Attention! Code red!",1) if(SSshuttle.emergency.mode == SHUTTLE_CALL || SSshuttle.emergency.mode == SHUTTLE_RECALL) - if(GLOB.security_level == SEC_LEVEL_GREEN) + if(SSsecurity_level.current_level == SEC_LEVEL_GREEN) SSshuttle.emergency.modTimer(0.25) else SSshuttle.emergency.modTimer(0.5) else minor_announce(CONFIG_GET(string/alert_red_downto), "Attention! Code red!") - GLOB.security_level = SEC_LEVEL_RED - - for(var/obj/machinery/firealarm/FA in GLOB.machines) - if(is_station_level(FA.z)) - FA.update_appearance() - for(var/obj/machinery/computer/shuttle/pod/pod in GLOB.machines) - pod.locked = FALSE if(SEC_LEVEL_DELTA) minor_announce(CONFIG_GET(string/alert_delta), "Attention! Delta security level reached!",1) if(SSshuttle.emergency.mode == SHUTTLE_CALL || SSshuttle.emergency.mode == SHUTTLE_RECALL) - if(GLOB.security_level == SEC_LEVEL_GREEN) + if(SSsecurity_level.current_level == SEC_LEVEL_GREEN) SSshuttle.emergency.modTimer(0.25) - else if(GLOB.security_level == SEC_LEVEL_BLUE) + else if(SSsecurity_level.current_level == SEC_LEVEL_BLUE) SSshuttle.emergency.modTimer(0.5) - GLOB.security_level = SEC_LEVEL_DELTA - for(var/obj/machinery/firealarm/FA in GLOB.machines) - if(is_station_level(FA.z)) - FA.update_appearance() - for(var/obj/machinery/computer/shuttle/pod/pod in GLOB.machines) - pod.locked = FALSE - if(level >= SEC_LEVEL_RED) - for(var/obj/machinery/door/D in GLOB.machines) - if(D.red_alert_access) - D.visible_message("[D] whirrs as it automatically lifts access requirements!") - playsound(D, 'sound/machines/boltsup.ogg', 50, TRUE) - SSblackbox.record_feedback("tally", "security_level_changes", 1, get_security_level()) - SSnightshift.check_nightshift() - else - return + + SSsecurity_level.set_level(level) /proc/get_security_level() - switch(GLOB.security_level) + switch(SSsecurity_level.current_level) if(SEC_LEVEL_GREEN) return "green" if(SEC_LEVEL_BLUE) diff --git a/code/modules/shuttle/emergency.dm b/code/modules/shuttle/emergency.dm index 87dc7c509b4..fb1e37e4133 100644 --- a/code/modules/shuttle/emergency.dm +++ b/code/modules/shuttle/emergency.dm @@ -575,7 +575,7 @@ var/obj/machinery/computer/shuttle/C = getControlConsole() if(!istype(C, /obj/machinery/computer/shuttle/pod)) return ..() - if(GLOB.security_level >= SEC_LEVEL_RED || (C && (C.obj_flags & EMAGGED))) + if(SSsecurity_level.current_level >= SEC_LEVEL_RED || (C && (C.obj_flags & EMAGGED))) if(launch_status == UNLAUNCHED) launch_status = EARLY_LAUNCHED return ..() @@ -595,6 +595,10 @@ light_color = LIGHT_COLOR_BLUE density = FALSE +/obj/machinery/computer/shuttle/pod/Initialize(mapload) + . = ..() + RegisterSignal(SSsecurity_level, COMSIG_SECURITY_LEVEL_CHANGED, .proc/check_lock) + /obj/machinery/computer/shuttle/pod/ComponentInitialize() . = ..() AddElement(/datum/element/update_icon_blocker) @@ -610,6 +614,20 @@ . = ..() possible_destinations += ";[port.id]_lavaland" +/** + * Signal handler for checking if we should lock or unlock escape pods accordingly to a newly set security level + * + * Arguments: + * * source The datum source of the signal + * * new_level The new security level that is in effect + */ +/obj/machinery/computer/shuttle/pod/proc/check_lock(datum/source, new_level) + SIGNAL_HANDLER + + if(obj_flags & EMAGGED) + return + locked = new_level < SEC_LEVEL_RED + /obj/docking_port/stationary/random name = "escape pod" id = "pod" @@ -705,7 +723,7 @@ /obj/item/storage/pod/can_interact(mob/user) if(!..()) return FALSE - if(GLOB.security_level >= SEC_LEVEL_RED || unlocked) + if(SSsecurity_level.current_level >= SEC_LEVEL_RED || unlocked) return TRUE to_chat(user, "The storage unit will only unlock during a Red or Delta security alert.") diff --git a/modular_skyrat/master_files/code/modules/mob/living/dead/new_player/new_player.dm b/modular_skyrat/master_files/code/modules/mob/living/dead/new_player/new_player.dm index e073f7eddd5..4943f3da701 100644 --- a/modular_skyrat/master_files/code/modules/mob/living/dead/new_player/new_player.dm +++ b/modular_skyrat/master_files/code/modules/mob/living/dead/new_player/new_player.dm @@ -432,7 +432,7 @@ /mob/dead/new_player/proc/LateChoices() var/list/dat = list("
Round Duration: [DisplayTimeText(world.time - SSticker.round_start_time)]
") - dat += "
Alert Level: [capitalize(num2seclevel(GLOB.security_level))]
" + dat += "
Alert Level: [capitalize(num2seclevel(SSsecurity_level.current_level))]
" if(SSshuttle.emergency) switch(SSshuttle.emergency.mode) if(SHUTTLE_ESCAPE) diff --git a/modular_skyrat/modules/alerts/code/firealarm.dm b/modular_skyrat/modules/alerts/code/firealarm.dm index 09c566386a7..a3c979fe394 100644 --- a/modular_skyrat/modules/alerts/code/firealarm.dm +++ b/modular_skyrat/modules/alerts/code/firealarm.dm @@ -1,6 +1,6 @@ /obj/machinery/firealarm/examine(mob/user) . = ..() - switch(GLOB.security_level) + switch(SSsecurity_level.current_level) if(SEC_LEVEL_GREEN) . += "The current alert level is green." if(SEC_LEVEL_BLUE) diff --git a/modular_skyrat/modules/alerts/code/set_security_level.dm b/modular_skyrat/modules/alerts/code/set_security_level.dm index b6869663848..b4f55471c10 100644 --- a/modular_skyrat/modules/alerts/code/set_security_level.dm +++ b/modular_skyrat/modules/alerts/code/set_security_level.dm @@ -9,10 +9,10 @@ GLOBAL_VAR_INIT(sec_level_cooldown, FALSE) /proc/set_security_level(level) level = isnum(level) ? level : seclevel2num(level) var modTimer = get_mod_timer(level) - var oldModTimer = get_mod_timer(GLOB.security_level) + var oldModTimer = get_mod_timer(SSsecurity_level.current_level) //Will not be announced if you try to set to the same level as it already is - if(level >= SEC_LEVEL_GREEN && level <= SEC_LEVEL_GAMMA && level != GLOB.security_level) + if(level >= SEC_LEVEL_GREEN && level <= SEC_LEVEL_GAMMA && level != SSsecurity_level.current_level) if(GLOB.sec_level_cooldown) message_admins("Attempt made to change security level while in cooldown!") return "COOLDOWN" @@ -23,27 +23,13 @@ GLOBAL_VAR_INIT(sec_level_cooldown, FALSE) deltimer(GLOB.gamma_timer_id) GLOB.gamma_timer_id = null announce_security_level(level) //IF YOU ARE ADDING A NEW SECURITY LEVEL, UPDATE THIS PROC - GLOB.security_level = level - for(var/obj/machinery/firealarm/FA in GLOB.machines) - if(is_station_level(FA.z)) - FA.update_icon() - if(level >= SEC_LEVEL_RED) - for(var/obj/machinery/computer/shuttle/pod/pod in GLOB.machines) - pod.locked = FALSE - for(var/obj/machinery/door/D in GLOB.machines) - if(D.red_alert_access) - D.visible_message("[D] whirrs as it automatically lifts access requirements!") - playsound(D, 'sound/machines/boltsup.ogg', 50, TRUE) + SSsecurity_level.set_level(level) if(SSshuttle.emergency.mode == SHUTTLE_CALL || SSshuttle.emergency.mode == SHUTTLE_RECALL) oldModTimer = 1/oldModTimer SSshuttle.emergency.modTimer(oldModTimer) SSshuttle.emergency.modTimer(modTimer) - SSblackbox.record_feedback("tally", "security_level_changes", 1, get_security_level()) - SSnightshift.check_nightshift() GLOB.sec_level_cooldown = TRUE addtimer(CALLBACK(GLOBAL_PROC, .proc/reset_sec_level_cooldown), SET_SEC_LEVEL_COOLDOWN) - else - return /proc/reset_sec_level_cooldown() GLOB.sec_level_cooldown = FALSE @@ -68,7 +54,7 @@ GLOBAL_VAR_INIT(sec_level_cooldown, FALSE) return 0.4 /proc/get_security_level() - switch(GLOB.security_level) + switch(SSsecurity_level.current_level) if(SEC_LEVEL_GREEN) return "green" if(SEC_LEVEL_BLUE) @@ -129,49 +115,49 @@ GLOBAL_VAR_INIT(sec_level_cooldown, FALSE) if(SEC_LEVEL_GREEN) minor_announce(CONFIG_GET(string/alert_green), "Attention! Alert level lowered to green:", sound = 'modular_skyrat/modules/alerts/sound/misc/downtoGREEN.ogg') if(SEC_LEVEL_BLUE) - if(GLOB.security_level < SEC_LEVEL_BLUE) + if(SSsecurity_level.current_level < SEC_LEVEL_BLUE) minor_announce(CONFIG_GET(string/alert_blue_upto), "Attention! Alert level elevated to blue:", sound = 'modular_skyrat/modules/alerts/sound/misc/blue.ogg') else minor_announce(CONFIG_GET(string/alert_blue_downto), "Attention! Alert level lowered to blue:", sound = 'modular_skyrat/modules/alerts/sound/misc/downtoBLUE.ogg') if(SEC_LEVEL_VIOLET) - if(GLOB.security_level < SEC_LEVEL_VIOLET) + if(SSsecurity_level.current_level < SEC_LEVEL_VIOLET) minor_announce(CONFIG_GET(string/alert_violet_upto), "Attention! Alert level set to violet:", TRUE, sound = 'modular_skyrat/modules/alerts/sound/misc/voyalert.ogg') else minor_announce(CONFIG_GET(string/alert_violet_downto), "Attention! Alert level set to violet:", sound = 'modular_skyrat/modules/alerts/sound/misc/voyalert.ogg') if(SEC_LEVEL_ORANGE) - if(GLOB.security_level < SEC_LEVEL_ORANGE) + if(SSsecurity_level.current_level < SEC_LEVEL_ORANGE) minor_announce(CONFIG_GET(string/alert_orange_upto), "Attention! Alert level set to orange:", TRUE, sound = 'modular_skyrat/modules/alerts/sound/misc/voyalert.ogg') else minor_announce(CONFIG_GET(string/alert_orange_downto), "Attention! Alert level set to orange:", sound = 'modular_skyrat/modules/alerts/sound/misc/voyalert.ogg') if(SEC_LEVEL_AMBER) - if(GLOB.security_level < SEC_LEVEL_AMBER) + if(SSsecurity_level.current_level < SEC_LEVEL_AMBER) minor_announce(CONFIG_GET(string/alert_amber_upto), "Attention! Alert level set to amber:", TRUE, sound = 'modular_skyrat/modules/alerts/sound/misc/voyalert.ogg') else minor_announce(CONFIG_GET(string/alert_amber_downto), "Attention! Alert level set to amber:", sound = 'modular_skyrat/modules/alerts/sound/misc/voyalert.ogg') if(SEC_LEVEL_RED) - if(GLOB.security_level < SEC_LEVEL_RED) + if(SSsecurity_level.current_level < SEC_LEVEL_RED) minor_announce(CONFIG_GET(string/alert_red_upto), "Attention! Code red!", TRUE, sound = 'modular_skyrat/modules/alerts/sound/misc/red.ogg') else minor_announce(CONFIG_GET(string/alert_red_downto), "Attention! Code red!", sound = 'modular_skyrat/modules/alerts/sound/misc/downtoRED.ogg') if(SEC_LEVEL_DELTA) - if(GLOB.security_level < SEC_LEVEL_DELTA) + if(SSsecurity_level.current_level < SEC_LEVEL_DELTA) minor_announce(CONFIG_GET(string/alert_delta_upto), "Attention! Delta Alert level reached!", TRUE, sound = 'modular_skyrat/modules/alerts/sound/misc/delta.ogg') else minor_announce(CONFIG_GET(string/alert_delta_downto), "Attention! Delta Alert level reached!", TRUE, sound = 'modular_skyrat/modules/alerts/sound/misc/delta.ogg') - GLOB.security_level = level //Snowflake shit to make sue they actually loop. + SSsecurity_level.current_level = level //Snowflake shit to make sue they actually loop. delta_alarm() if(SEC_LEVEL_GAMMA) minor_announce(CONFIG_GET(string/alert_gamma), "Attention! ZK-Class Reality Failure Scenario Detected, GAMMA Alert Level Reached!", TRUE, sound = 'modular_skyrat/modules/alerts/sound/misc/gamma_alert.ogg') - GLOB.security_level = level + SSsecurity_level.current_level = level gamma_loop() /proc/delta_alarm() //Delta alarm sounds every so often - if(GLOB.security_level == SEC_LEVEL_DELTA) + if(SSsecurity_level.current_level == SEC_LEVEL_DELTA) alert_sound_to_playing('modular_skyrat/modules/alerts/sound/alarm_delta.ogg') GLOB.delta_timer_id = addtimer(CALLBACK(GLOBAL_PROC, .proc/delta_alarm), DELTA_LOOP_LENGTH, TIMER_UNIQUE | TIMER_STOPPABLE) /proc/gamma_loop() //Loops gamma sound - if(GLOB.security_level == SEC_LEVEL_GAMMA) + if(SSsecurity_level.current_level == SEC_LEVEL_GAMMA) alert_sound_to_playing('modular_skyrat/modules/alerts/sound/misc/gamma_alert.ogg') GLOB.gamma_timer_id = addtimer(CALLBACK(GLOBAL_PROC, .proc/gamma_loop), GAMMA_LOOP_LENGTH, TIMER_UNIQUE | TIMER_STOPPABLE) diff --git a/modular_skyrat/modules/autotransfer/code/shuttle.dm b/modular_skyrat/modules/autotransfer/code/shuttle.dm index 668a58193d3..ea0a0d4cdde 100644 --- a/modular_skyrat/modules/autotransfer/code/shuttle.dm +++ b/modular_skyrat/modules/autotransfer/code/shuttle.dm @@ -4,7 +4,7 @@ /datum/controller/subsystem/shuttle/proc/autoEnd() if(EMERGENCY_IDLE_OR_RECALLED) SSshuttle.emergency.request(silent = TRUE) - priority_announce("The shift has come to an end and the shuttle called. [GLOB.security_level == SEC_LEVEL_RED ? "Red Alert state confirmed: Dispatching priority shuttle. " : "" ]It will arrive in [emergency.timeLeft(600)] minutes.", null, ANNOUNCER_SHUTTLECALLED, "Priority") + priority_announce("The shift has come to an end and the shuttle called. [SSsecurity_level.current_level == SEC_LEVEL_RED ? "Red Alert state confirmed: Dispatching priority shuttle. " : "" ]It will arrive in [emergency.timeLeft(600)] minutes.", null, ANNOUNCER_SHUTTLECALLED, "Priority") log_game("Round end vote passed. Shuttle has been auto-called.") message_admins("Round end vote passed. Shuttle has been auto-called.") emergencyNoRecall = TRUE diff --git a/modular_skyrat/modules/blob/code/modules/antagonists/blob/overmind.dm b/modular_skyrat/modules/blob/code/modules/antagonists/blob/overmind.dm index 2ac7a5ba54a..d6ac3cec06c 100644 --- a/modular_skyrat/modules/blob/code/modules/antagonists/blob/overmind.dm +++ b/modular_skyrat/modules/blob/code/modules/antagonists/blob/overmind.dm @@ -4,7 +4,7 @@ /mob/camera/blob/proc/announce_blob_distress_signal() has_announced_emergency = TRUE - if(GLOB.security_level != SEC_LEVEL_RED) // Why the hell is it not red yet?! + if(SSsecurity_level.current_level != SEC_LEVEL_RED) // Why the hell is it not red yet?! set_security_level("red") priority_announce("Biohazard lifeform aboard [GLOB.station_name] is rapidly approaching critical mass. Off-station Response Teams are requested to aid immediately.", "Automated Biohazard Distress Signal", sender_override = "[GLOB.station_name]") - + diff --git a/tgstation.dme b/tgstation.dme index e5a9cdf4850..a4c5d91fe63 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -369,6 +369,7 @@ #include "code\controllers\subsystem\research.dm" #include "code\controllers\subsystem\restaurant.dm" #include "code\controllers\subsystem\runechat.dm" +#include "code\controllers\subsystem\security_level.dm" #include "code\controllers\subsystem\server_maint.dm" #include "code\controllers\subsystem\shuttle.dm" #include "code\controllers\subsystem\skills.dm"