diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm
index 424e94eee07..63b3da76ec6 100644
--- a/code/game/machinery/doors/airlock.dm
+++ b/code/game/machinery/doors/airlock.dm
@@ -93,6 +93,7 @@ Airlock index -> wire color are { 9, 4, 6, 7, 5, 8, 1, 2, 3 }.
normalspeed = 1
var/obj/item/weapon/airlock_electronics/electronics = null
var/hasShocked = 0 //Prevents multiple shocks from happening
+ var/maintAccessReqRevoked = 0 // Used in the procs to revoke maint access/give maint access to all maint doors. Boolean.
/obj/machinery/door/airlock/command
name = "Airlock"
diff --git a/code/modules/security levels/keycard authentication.dm b/code/modules/security levels/keycard authentication.dm
index ae66ba5f5d1..d99d8de7696 100644
--- a/code/modules/security levels/keycard authentication.dm
+++ b/code/modules/security levels/keycard authentication.dm
@@ -144,17 +144,32 @@
if("Red alert")
set_security_level(SEC_LEVEL_RED)
feedback_inc("alert_keycard_auth_red",1)
- if("Emergency Maintenance Access")
+ if("Grant Emergency Maintenance Access")
make_maint_all_access()
- feedback_inc("alert_keycard_auth_maint",1)
+ feedback_inc("alert_keycard_auth_maintGrant",1)
+ if("Revoke Emergency Maintenance Access")
+ revoke_maint_all_access()
+ feedback_inc("alert_keycard_auth_maintRevoke",1)
if("Emergency Rescue Team")
trigger_armed_response_team(1)
feedback_inc("alert_keycard_auth_ert",1)
/proc/make_maint_all_access()
for(var/obj/machinery/door/airlock/A in machines)
- if(A.z == 1)
+ if(A.z == 1 && access_maint_tunnels in A.req_access)
+ A.maintAccessReqRevoked = 1
A.req_access.Remove(access_maint_tunnels)
world << "Attention!"
- world << "The maintenance access requirement has been revoked on all airlocks. All crew members are now permitted access to emergency maintenance areas."
\ No newline at end of file
+ world << "The maintenance access requirement has been revoked on all airlocks."
+
+/proc/revoke_maint_all_access()
+ for(var/obj/machinery/door/airlock/A in machines)
+ if(A.z == 1 && A.maintAccessReqRevoked == 1)
+ A.maintAccessReqRevoked = 0
+ A.req_access.Add(access_maint_tunnels)
+
+ world << "Attention!"
+ world << "The maintenance access requirement has been readded on all maintenance airlocks."
+
+