From fec44e72a9d67de9ca2644888002b67157906d52 Mon Sep 17 00:00:00 2001 From: AffectedArc07 Date: Fri, 21 Jun 2019 16:23:21 +0100 Subject: [PATCH] Panic Bunker --- code/_globalvars/misc.dm | 4 +++- code/modules/admin/admin_verbs.dm | 18 ++++++++++++++++-- code/modules/client/client procs.dm | 8 ++++++++ 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/code/_globalvars/misc.dm b/code/_globalvars/misc.dm index f933105e13b..f4cdd766cb9 100644 --- a/code/_globalvars/misc.dm +++ b/code/_globalvars/misc.dm @@ -88,4 +88,6 @@ var/copier_items_printed_logged = FALSE GLOBAL_VAR(map_name) // Self explanatory -var/global/datum/datacore/data_core = null // Station datacore, manifest, etc \ No newline at end of file +var/global/datum/datacore/data_core = null // Station datacore, manifest, etc + +GLOBAL_VAR_INIT(panic_bunker_enabled, 0) // Is the panic bunker enabled \ No newline at end of file diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 06c2361b90a..ff99dd1cdde 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -79,7 +79,8 @@ var/list/admin_verbs_admin = list( /client/proc/list_ssds, /client/proc/cmd_admin_headset_message, /client/proc/spawn_floor_cluwne, - /client/proc/show_discord_duplicates, + /client/proc/show_discord_duplicates, // This needs removing at some point, ingame discord linking got removed in #11359 + /client/proc/toggle_panic_bunker ) var/list/admin_verbs_ban = list( /client/proc/unban_panel, @@ -1026,4 +1027,17 @@ var/list/admin_verbs_ticket = list( if(!check_rights(R_ADMIN)) return - holder.discord_duplicates() \ No newline at end of file + holder.discord_duplicates() + +/client/proc/toggle_panic_bunker() + set name = "Toggle Panic Bunker" + set category = "Admin" + set desc = "Disables new players connecting." + + if(!check_rights(R_ADMIN)) + return + + GLOB.panic_bunker_enabled = !GLOB.panic_bunker_enabled + + log_admin("[key_name(usr)] has [GLOB.panic_bunker_enabled ? "activated" : "deactivated"] the panic bunker.") + message_admins("[key_name_admin(usr)] has [GLOB.panic_bunker_enabled ? "activated" : "deactivated"] the panic bunker.") diff --git a/code/modules/client/client procs.dm b/code/modules/client/client procs.dm index 922502698fa..8b8963643f8 100644 --- a/code/modules/client/client procs.dm +++ b/code/modules/client/client procs.dm @@ -537,6 +537,14 @@ message_admins("SQL ERROR during log_client_to_db (update). Error : \[[err]\]\n") else //New player!! Need to insert all the stuff + + // Check new peeps for panic bunker + if(GLOB.panic_bunker_enabled) + message_admins("Failed Login: [key] - New account attempting to connect during panic bunker") + src << "Sorry but the server is currently not accepting connections from never before seen players." + del(src) + return // Dont insert or they can just go in again + var/DBQuery/query_insert = dbcon.NewQuery("INSERT INTO [format_table_name("player")] (id, ckey, firstseen, lastseen, ip, computerid, lastadminrank) VALUES (null, '[ckey]', Now(), Now(), '[sql_ip]', '[sql_computerid]', '[sql_admin_rank]')") if(!query_insert.Execute()) var/err = query_insert.ErrorMsg()