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 d39275c326e..7687b22f71c 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -80,7 +80,8 @@ var/list/admin_verbs_admin = list( /client/proc/list_afks, /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, @@ -1027,4 +1028,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 84e86b0f4d3..95f6c16ba97 100644 --- a/code/modules/client/client procs.dm +++ b/code/modules/client/client procs.dm @@ -408,6 +408,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) @@ -533,6 +543,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. Please try again later." + 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()