Panic bunker threshold is configurable (#13080)

* Panic bunker threshold is configurable

* Cleaned up bunker automation logic, added admin control verb

* Changed Set Server Capacity to two toggle verbs; modified logic

* Revert "Changed Set Server Capacity to two toggle verbs; modified logic"

This reverts commit 398a8615a5.

* Revert "Cleaned up bunker automation logic, added admin control verb"

This reverts commit b6a6d49714.
This commit is contained in:
Patrick Meade
2020-03-12 01:24:16 -06:00
committed by GitHub
parent dfaba6a8be
commit 54f538307c
5 changed files with 21 additions and 21 deletions
+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