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(distress_cancel)

Check failure on line 37 in code/datums/emergency_calls/emergency_call.dm

View workflow job for this annotation

GitHub Actions / Run Linters

undefined var: "distress_cancel"
distress_cancel = FALSE

Check failure on line 38 in code/datums/emergency_calls/emergency_call.dm

View workflow job for this annotation

GitHub Actions / Run Linters

undefined var: "distress_cancel"
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
43 changes: 37 additions & 6 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 Down Expand Up @@ -64,9 +65,10 @@

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(security_level < SEC_LEVEL_RED)

Check failure on line 68 in code/modules/security_levels/keycard_authentication.dm

View workflow job for this annotation

GitHub Actions / Run Linters

undefined var: "security_level"
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>"
Expand Down Expand Up @@ -144,10 +146,39 @@
make_maint_all_access()
if("enable_maint_sec")
revoke_maint_all_access()
if("distress_beacon")
call_ert()

/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
/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(security_level == SEC_LEVEL_DELTA)

Check failure on line 165 in code/modules/security_levels/keycard_authentication.dm

View workflow job for this annotation

GitHub Actions / Run Linters

undefined var: "security_level"
to_chat(usr, SPAN_WARNING("The ship is already undergoing self-destruct procedures!"))
return

if(security_level < SEC_LEVEL_RED)

Check failure on line 169 in code/modules/security_levels/keycard_authentication.dm

View workflow job for this annotation

GitHub Actions / Run Linters

undefined var: "security_level"
to_chat(usr, SPAN_WARNING("The ship security level is not high enough to call a distress beacon!"))
return

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)
else
SSticker.mode.request_ert(usr)
to_chat(usr, SPAN_NOTICE("An emergency distress beacon has been sent to nearby vessels."))
COOLDOWN_START(src, distress_cooldown, COOLDOWN_COMM_REQUEST)

GLOBAL_VAR_INIT(maint_all_access, TRUE)

Expand Down
Loading