From fec44e72a9d67de9ca2644888002b67157906d52 Mon Sep 17 00:00:00 2001 From: AffectedArc07 Date: Fri, 21 Jun 2019 16:23:21 +0100 Subject: [PATCH 1/3] 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() From afef712773b837c8b7e41953689ff368421a0d73 Mon Sep 17 00:00:00 2001 From: AffectedArc07 Date: Sat, 22 Jun 2019 09:58:18 +0100 Subject: [PATCH 2/3] Auto bunker --- code/modules/client/client procs.dm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/code/modules/client/client procs.dm b/code/modules/client/client procs.dm index 8b8963643f8..f4991a35320 100644 --- a/code/modules/client/client procs.dm +++ b/code/modules/client/client procs.dm @@ -412,6 +412,16 @@ Master.UpdateTickRate() + // Check total playercount + var/playercount = 0 + for(var/mob/M in GLOB.player_list) + if(M.client) + playercount += 1 + + if(playercount >= 150 && GLOB.panic_bunker_enabled == 0) + GLOB.panic_bunker_enabled = 1 + message_admins("Panic bunker has been automatically enabled due to playercount surpassing 150") + /client/proc/is_connecting_from_localhost() var/localhost_addresses = list("127.0.0.1", "::1") // Adresses if(!isnull(address) && address in localhost_addresses) From 9bd54a22672c2b166d623d012f572defadccc931 Mon Sep 17 00:00:00 2001 From: AffectedArc07 Date: Sun, 23 Jun 2019 11:33:08 +0100 Subject: [PATCH 3/3] Update client procs.dm --- code/modules/client/client procs.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/client/client procs.dm b/code/modules/client/client procs.dm index f4991a35320..29d297ca8f0 100644 --- a/code/modules/client/client procs.dm +++ b/code/modules/client/client procs.dm @@ -551,7 +551,7 @@ // 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." + src << "Sorry but the server is currently not accepting connections from never before seen players. Please try again later." del(src) return // Dont insert or they can just go in again