From a450ad9b9cd3d55ad6f5bbebba0f83de29fbfc66 Mon Sep 17 00:00:00 2001 From: Mikhail Dzianishchyts Date: Thu, 12 Sep 2024 19:58:31 +0300 Subject: [PATCH] Move global access procs to the mapping subsystem (#26664) * Move global access procs to the mapping subsystem * Apply requested changes --- .../subsystem/non_firing/SSmapping.dm | 40 ++++++++++++++++ .../weather/weather_types/radiation_storm.dm | 8 ++-- .../security_levels/keycard_authentication.dm | 48 ++----------------- 3 files changed, 48 insertions(+), 48 deletions(-) diff --git a/code/controllers/subsystem/non_firing/SSmapping.dm b/code/controllers/subsystem/non_firing/SSmapping.dm index 8a7b6a972479..b5c193284354 100644 --- a/code/controllers/subsystem/non_firing/SSmapping.dm +++ b/code/controllers/subsystem/non_firing/SSmapping.dm @@ -16,6 +16,10 @@ SUBSYSTEM_DEF(mapping) var/datum/lavaland_theme/lavaland_theme ///What primary cave theme we have picked for cave generation today. var/cave_theme + // Tells if all maintenance airlocks have emergency access enabled + var/maint_all_access = FALSE + // Tells if all station airlocks have emergency access enabled + var/station_all_access = FALSE /// A mapping of environment names to MILLA environment IDs. var/list/environments @@ -356,5 +360,41 @@ SUBSYSTEM_DEF(mapping) log_world("Ruin loader finished with [budget] left to spend.") +/datum/controller/subsystem/mapping/proc/make_maint_all_access() + for(var/area/station/maintenance/A in existing_station_areas) + for(var/obj/machinery/door/airlock/D in A) + D.emergency = TRUE + D.update_icon() + GLOB.minor_announcement.Announce("Access restrictions on maintenance and external airlocks have been removed.") + maint_all_access = TRUE + SSblackbox.record_feedback("nested tally", "keycard_auths", 1, list("emergency maintenance access", "enabled")) + +/datum/controller/subsystem/mapping/proc/revoke_maint_all_access() + for(var/area/station/maintenance/A in existing_station_areas) + for(var/obj/machinery/door/airlock/D in A) + D.emergency = FALSE + D.update_icon() + GLOB.minor_announcement.Announce("Access restrictions on maintenance and external airlocks have been re-added.") + maint_all_access = FALSE + SSblackbox.record_feedback("nested tally", "keycard_auths", 1, list("emergency maintenance access", "disabled")) + +/datum/controller/subsystem/mapping/proc/make_station_all_access() + for(var/obj/machinery/door/airlock/D in GLOB.airlocks) + if(is_station_level(D.z)) + D.emergency = TRUE + D.update_icon() + GLOB.minor_announcement.Announce("Access restrictions on all station airlocks have been removed due to an ongoing crisis. Trespassing laws still apply unless ordered otherwise by Command staff.") + station_all_access = TRUE + SSblackbox.record_feedback("nested tally", "keycard_auths", 1, list("emergency station access", "enabled")) + +/datum/controller/subsystem/mapping/proc/revoke_station_all_access() + for(var/obj/machinery/door/airlock/D in GLOB.airlocks) + if(is_station_level(D.z)) + D.emergency = FALSE + D.update_icon() + GLOB.minor_announcement.Announce("Access restrictions on all station airlocks have been re-added. Seek station AI or a colleague's assistance if you are stuck.") + station_all_access = FALSE + SSblackbox.record_feedback("nested tally", "keycard_auths", 1, list("emergency station access", "disabled")) + /datum/controller/subsystem/mapping/Recover() flags |= SS_NO_INIT diff --git a/code/datums/weather/weather_types/radiation_storm.dm b/code/datums/weather/weather_types/radiation_storm.dm index ccb43e11a816..4cb7314c4ab4 100644 --- a/code/datums/weather/weather_types/radiation_storm.dm +++ b/code/datums/weather/weather_types/radiation_storm.dm @@ -38,9 +38,9 @@ /datum/weather/rad_storm/telegraph() ..() status_alarm(TRUE) - pre_maint_all_access = GLOB.maint_all_access - if(!GLOB.maint_all_access) - make_maint_all_access() + pre_maint_all_access = SSmapping.maint_all_access + if(!SSmapping.maint_all_access) + SSmapping.make_maint_all_access() /datum/weather/rad_storm/weather_act(mob/living/L) if(!prob(60)) @@ -74,7 +74,7 @@ status_alarm(FALSE) if(!pre_maint_all_access) GLOB.minor_announcement.Announce("The radiation threat has passed. Please return to your workplaces. Door access resetting momentarily.", "Anomaly Alert") - addtimer(CALLBACK(SSweather, GLOBAL_PROC_REF(revoke_maint_all_access)), 10 SECONDS) // Bit of time to get out / break into somewhere. + addtimer(CALLBACK(SSmapping, TYPE_PROC_REF(/datum/controller/subsystem/mapping, revoke_maint_all_access)), 10 SECONDS) // Bit of time to get out / break into somewhere. else GLOB.minor_announcement.Announce("The radiation threat has passed. Please return to your workplaces.", "Anomaly Alert") diff --git a/code/modules/security_levels/keycard_authentication.dm b/code/modules/security_levels/keycard_authentication.dm index 441b31198b22..9ae9a8a0da4b 100644 --- a/code/modules/security_levels/keycard_authentication.dm +++ b/code/modules/security_levels/keycard_authentication.dm @@ -177,13 +177,13 @@ if("Red Alert") 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() + SSmapping.make_maint_all_access() if("Revoke Emergency Maintenance Access") - revoke_maint_all_access() + SSmapping.revoke_maint_all_access() if("Activate Station-Wide Emergency Access") - make_station_all_access() + SSmapping.make_station_all_access() if("Deactivate Station-Wide Emergency Access") - revoke_station_all_access() + SSmapping.revoke_station_all_access() if("Emergency Response Team") if(is_ert_blocked()) atom_say("All Emergency Response Teams are dispatched and can not be called at this time.") @@ -215,43 +215,3 @@ /obj/machinery/keycard_auth/proc/is_ert_blocked() return SSticker.mode && SSticker.mode.ert_disabled - -GLOBAL_VAR_INIT(maint_all_access, 0) -GLOBAL_VAR_INIT(station_all_access, 0) - -// Why are these global procs? -/proc/make_maint_all_access() - for(var/area/station/maintenance/A in world) // Why are these global lists? AAAAAAAAAAAAAA - for(var/obj/machinery/door/airlock/D in A) - D.emergency = 1 - D.update_icon() - GLOB.minor_announcement.Announce("Access restrictions on maintenance and external airlocks have been removed.") - GLOB.maint_all_access = 1 - SSblackbox.record_feedback("nested tally", "keycard_auths", 1, list("emergency maintenance access", "enabled")) - -/proc/revoke_maint_all_access() - for(var/area/station/maintenance/A in world) - for(var/obj/machinery/door/airlock/D in A) - D.emergency = 0 - D.update_icon() - GLOB.minor_announcement.Announce("Access restrictions on maintenance and external airlocks have been re-added.") - GLOB.maint_all_access = 0 - SSblackbox.record_feedback("nested tally", "keycard_auths", 1, list("emergency maintenance access", "disabled")) - -/proc/make_station_all_access() - for(var/obj/machinery/door/airlock/D in GLOB.airlocks) - if(is_station_level(D.z)) - D.emergency = 1 - D.update_icon() - GLOB.minor_announcement.Announce("Access restrictions on all station airlocks have been removed due to an ongoing crisis. Trespassing laws still apply unless ordered otherwise by Command staff.") - GLOB.station_all_access = 1 - SSblackbox.record_feedback("nested tally", "keycard_auths", 1, list("emergency station access", "enabled")) - -/proc/revoke_station_all_access() - for(var/obj/machinery/door/airlock/D in GLOB.airlocks) - if(is_station_level(D.z)) - D.emergency = 0 - D.update_icon() - GLOB.minor_announcement.Announce("Access restrictions on all station airlocks have been re-added. Seek station AI or a colleague's assistance if you are stuck.") - GLOB.station_all_access = 0 - SSblackbox.record_feedback("nested tally", "keycard_auths", 1, list("emergency station access", "disabled"))