Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keycard authenticator can call ERT winout admin intervention #4477

Closed
wants to merge 12 commits into from
2 changes: 0 additions & 2 deletions code/controllers/configuration/entries/game_options.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 18 additions & 0 deletions code/datums/emergency_calls/emergency_call.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)] (<A HREF='?_src_=admin_holder;[HrefToken(forceGlobal = TRUE)];distress=\ref[user]'>SEND</A>) (<A HREF='?_src_=admin_holder;[HrefToken(forceGlobal = TRUE)];ccdeny=\ref[user]'>DENY</A>) [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! (<A HREF='?_src_=admin_holder;[HrefToken(forceGlobal = TRUE)];distresscancel=\ref[user]'>DENY</A>)[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)
Diegoflores31 marked this conversation as resolved.
Show resolved Hide resolved
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"
Expand Down
55 changes: 44 additions & 11 deletions code/modules/security_levels/keycard_authentication.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand All @@ -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)
Expand All @@ -64,12 +65,13 @@

if(screen == 1)
dat += "Select an event to trigger:<ul>"
dat += "<li><A href='?src=\ref[src];triggerevent=Red alert'>Red alert</A></li>"
if(!CONFIG_GET(flag/ert_admin_call_only))
Diegoflores31 marked this conversation as resolved.
Show resolved Hide resolved
dat += "<li><A href='?src=\ref[src];triggerevent=Emergency Response Team'>Emergency Response Team</A></li>"
if(GLOB.security_level < SEC_LEVEL_RED)
dat += "<li><A href='?src=\ref[src];triggerevent=Red alert'>Red alert</A></li>"
if(!SSticker.mode.ert_dispatched)
dat += "<li><A href='?src=\ref[src];triggerevent=Distress Beacon'>Distress Beacon</A></li>"

dat += "<li><A href='?src=\ref[src];triggerevent=enable_maint_sec'>Enable Maintenance Security</A></li>"
dat += "<li><A href='?src=\ref[src];triggerevent=disable_maint_sec'>Disable Maintenance Security</A></li>"
dat += "<li><A href='?src=\ref[src];triggerevent=Disable Maintenance Access'>Disable Maintenance Access</A></li>"
dat += "<li><A href='?src=\ref[src];triggerevent=Enable Maintenance Access'>Enable Maintenance Access</A></li>"
dat += "</ul>"
if(screen == 2)
dat += "Please swipe your card to authorize the following event: <b>[event]</b>"
Expand Down Expand Up @@ -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

Diegoflores31 marked this conversation as resolved.
Show resolved Hide resolved
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)

Expand Down