diff --git a/code/_globalvars/misc.dm b/code/_globalvars/misc.dm index f4cdd766cb9..04db7233401 100644 --- a/code/_globalvars/misc.dm +++ b/code/_globalvars/misc.dm @@ -90,4 +90,4 @@ GLOBAL_VAR(map_name) // Self explanatory 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 +GLOBAL_VAR_INIT(panic_bunker_enabled, FALSE) // Is the panic bunker enabled diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index d1a3861676b..cb803e7d52a 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -57,6 +57,7 @@ var/allow_ai = 1 // allow ai job var/respawn = 0 var/guest_jobban = 1 + var/panic_bunker_threshold = 150 // above this player count threshold, never-before-seen players are blocked from connecting var/usewhitelist = 0 var/mods_are_mentors = 0 var/load_jobs_from_txt = 0 @@ -503,6 +504,9 @@ if("guest_ban") guests_allowed = 0 + if("panic_bunker_threshold") + config.panic_bunker_threshold = text2num(value) + if("usewhitelist") config.usewhitelist = 1 diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 12b670ccea9..b77eea08b7b 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -78,8 +78,7 @@ var/list/admin_verbs_admin = list( /client/proc/toggle_advanced_interaction, /*toggle admin ability to interact with not only machines, but also atoms such as buttons and doors*/ /client/proc/list_ssds_afks, /client/proc/cmd_admin_headset_message, - /client/proc/spawn_floor_cluwne, - /client/proc/toggle_panic_bunker + /client/proc/spawn_floor_cluwne ) var/list/admin_verbs_ban = list( /client/proc/unban_panel, @@ -1017,16 +1016,3 @@ var/list/admin_verbs_ticket = list( log_admin("[key_name(usr)] has [advanced_admin_interaction ? "activated" : "deactivated"] their advanced admin interaction.") message_admins("[key_name_admin(usr)] has [advanced_admin_interaction ? "activated" : "deactivated"] their advanced admin interaction.") - -/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 962be47cae9..e504a796052 100644 --- a/code/modules/client/client procs.dm +++ b/code/modules/client/client procs.dm @@ -414,9 +414,16 @@ 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") + // Update the state of the panic bunker based on current playercount + var/threshold = config.panic_bunker_threshold + + if((playercount > threshold) && (GLOB.panic_bunker_enabled == FALSE)) + GLOB.panic_bunker_enabled = TRUE + message_admins("Panic bunker has been automatically enabled due to playercount rising above [threshold]") + + if((playercount < threshold) && (GLOB.panic_bunker_enabled == TRUE)) + GLOB.panic_bunker_enabled = FALSE + message_admins("Panic bunker has been automatically disabled due to playercount dropping below [threshold]") /client/proc/is_connecting_from_localhost() var/localhost_addresses = list("127.0.0.1", "::1") // Adresses @@ -549,8 +556,8 @@ // 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." + var/threshold = config.panic_bunker_threshold + src << "Server is not accepting connections from never-before-seen players until player count is less than [threshold]. Please try again later." del(src) return // Dont insert or they can just go in again diff --git a/config/example/config.txt b/config/example/config.txt index 18c280f6141..4fbc5508db3 100644 --- a/config/example/config.txt +++ b/config/example/config.txt @@ -190,6 +190,9 @@ GUEST_JOBBAN ## Uncomment this to stop people connecting to your server without a registered ckey. (i.e. guest-* are all blocked from connecting) GUEST_BAN +## above this player count threshold, never-before-seen players are blocked from connecting +PANIC_BUNKER_THRESHOLD 150 + ### IPINTEL: ### This allows you to detect likely proxies by checking ips against getipintel.net ## Rating to warn at: (0.90 is good, 1 is 100% likely to be a spammer/proxy, 0.8 is 80%, etc) anything equal to or higher then this number triggers an admin warning