diff --git a/code/controllers/configuration/entries/game_options.dm b/code/controllers/configuration/entries/game_options.dm index 743f9be9fec0..e2659ce54cf8 100644 --- a/code/controllers/configuration/entries/game_options.dm +++ b/code/controllers/configuration/entries/game_options.dm @@ -101,8 +101,6 @@ /datum/config_entry/flag/continous_rounds -/datum/config_entry/flag/ert_admin_call_only - /datum/config_entry/flag/use_loyalty_implants /datum/config_entry/number/explosive_antigrief diff --git a/code/datums/emergency_calls/emergency_call.dm b/code/datums/emergency_calls/emergency_call.dm index 9db46955a5ea..bb56e449a700 100644 --- a/code/datums/emergency_calls/emergency_call.dm +++ b/code/datums/emergency_calls/emergency_call.dm @@ -15,12 +15,30 @@ var/input = "ARES. Online. Good morning, marines." shipwide_ai_announcement(input, name, 'sound/AI/ares_online.ogg') +///normal manual approval ERT request /datum/game_mode/proc/request_ert(user, ares = FALSE) if(!user) return FALSE message_admins("[key_name(user)] has requested a Distress Beacon! [ares ? SPAN_ORANGE("(via ARES)") : ""] ([SSticker.mode.ert_dispatched ? SPAN_RED("A random ERT was dispatched previously.") : SPAN_GREEN("No previous random ERT dispatched.")]) [CC_MARK(user)] (SEND) (DENY) [ADMIN_JMP_USER(user)] [CC_REPLY(user)]") return TRUE +/// Automatic Approval ERT request , Admins are given 15 seconds to DENY the ERT +/datum/game_mode/proc/authorized_request_ert(user) + if(!user) + return FALSE + if(ert_dispatched) //safety check we dont want ert spam + return FALSE + message_admins("[key_name(user)] has launched a keycard Distress Beacon! (DENY)[ADMIN_JMP_USER(user)] [CC_REPLY(user)]") + addtimer(CALLBACK(src, PROC_REF(process_ert_call)), 15 SECONDS) + return TRUE + +///Process of the ERT call , checks if the request was denied, if not it will call ERT +/datum/game_mode/proc/process_ert_call(user) + if(GLOB.distress_cancel) + GLOB.distress_cancel = FALSE + return + activate_distress() + //The distress call parent. Cannot be called itself due to "name" being a filtered target. /datum/emergency_call var/name = "name" diff --git a/code/modules/security_levels/keycard_authentication.dm b/code/modules/security_levels/keycard_authentication.dm index 4b7cdd69a449..fba9b6fca15a 100644 --- a/code/modules/security_levels/keycard_authentication.dm +++ b/code/modules/security_levels/keycard_authentication.dm @@ -21,6 +21,7 @@ idle_power_usage = 2 active_power_usage = 6 power_channel = POWER_CHANNEL_ENVIRON + COOLDOWN_DECLARE(distress_cooldown) /obj/structure/machinery/keycard_auth/attack_remote(mob/user as mob) to_chat(user, "The station AI is not to interact with these devices.") @@ -41,7 +42,7 @@ else if(screen == 2) event_triggered_by = usr broadcast_request() //This is the device making the initial event request. It needs to broadcast to other devices - + playsound(src, 'sound/machines/switch.ogg', 25, 1) /obj/structure/machinery/keycard_auth/power_change() ..() if(stat & NOPOWER) @@ -64,12 +65,13 @@ if(screen == 1) dat += "Select an event to trigger:" if(screen == 2) dat += "Please swipe your card to authorize the following event: [event]" @@ -140,14 +142,45 @@ switch(event) if("Red alert") set_security_level(SEC_LEVEL_RED) - if("disable_maint_sec") + if("Enable Maintenance Access") make_maint_all_access() - if("enable_maint_sec") + if("Disable Maintenance Access") revoke_maint_all_access() + if("Distress Beacon") + call_ert() + +/obj/structure/machinery/keycard_auth/proc/call_ert() + if(world.time < DISTRESS_TIME_LOCK) + to_chat(usr, SPAN_WARNING("The distress beacon cannot be launched this early in the operation. Please wait another [time_left_until(DISTRESS_TIME_LOCK, world.time, 1 MINUTES)] minutes before trying again.")) + return + + if(!COOLDOWN_FINISHED(src, distress_cooldown)) + to_chat(usr, SPAN_WARNING("The distress beacon has recently broadcast a message. Please wait.")) + return + + if(SSticker.mode.ert_dispatched) + to_chat(usr, SPAN_WARNING("A distress beacon has already launched successfully!")) + return + + if(GLOB.security_level == SEC_LEVEL_DELTA) + to_chat(usr, SPAN_WARNING("The ship is already undergoing self-destruct procedures!")) + return + + if(GLOB.security_level < SEC_LEVEL_RED) + to_chat(usr, SPAN_WARNING("The ship security level is not high enough to call a distress beacon!")) + return -/obj/structure/machinery/keycard_auth/proc/is_ert_blocked() - if(CONFIG_GET(flag/ert_admin_call_only)) return 1 - return SSticker.mode && SSticker.mode.ert_disabled + for(var/client/client in GLOB.admins) + if((R_ADMIN|R_MOD) & client.admin_holder.rights) + playsound_client(client,'sound/effects/sos-morse-code.ogg') + if(SSticker.mode.is_in_endgame) + SSticker.mode.authorized_request_ert(usr) + to_chat(usr, SPAN_WARNING("Priority distress beacon launched successfully!")) + else + SSticker.mode.request_ert(usr) + to_chat(usr, SPAN_NOTICE("Distress beacon request sent to ARES systems.")) + playsound(src, 'sound/machines/terminal_success.ogg', 25, 1) + COOLDOWN_START(src, distress_cooldown, COOLDOWN_COMM_REQUEST) GLOBAL_VAR_INIT(maint_all_access, TRUE)