Panic bunker threshold is configurable

This commit is contained in:
Patrick Meade
2020-03-05 02:08:17 -06:00
parent fe396a40c9
commit 4fffcd676d
5 changed files with 21 additions and 21 deletions
+1 -1
View File
@@ -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
GLOBAL_VAR_INIT(panic_bunker_enabled, FALSE) // Is the panic bunker enabled
+4
View File
@@ -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
+1 -15
View File
@@ -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.")
+12 -5
View File
@@ -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("<span class='adminnotice'>Failed Login: [key] - New account attempting to connect during panic bunker</span>")
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
+3
View File
@@ -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