Cleaned up bunker automation logic, added admin control verb

This commit is contained in:
Patrick Meade
2020-03-11 04:52:12 -05:00
parent 4fffcd676d
commit b6a6d49714
2 changed files with 26 additions and 9 deletions
+18 -2
View File
@@ -78,7 +78,8 @@ 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/spawn_floor_cluwne,
/client/proc/set_server_capacity
)
var/list/admin_verbs_ban = list(
/client/proc/unban_panel,
@@ -143,7 +144,8 @@ var/list/admin_verbs_server = list(
/client/proc/toggle_antagHUD_use,
/client/proc/toggle_antagHUD_restrictions,
/client/proc/set_ooc,
/client/proc/reset_ooc
/client/proc/reset_ooc,
/client/proc/set_server_capacity
)
var/list/admin_verbs_debug = list(
/client/proc/cmd_admin_list_open_jobs,
@@ -1016,3 +1018,17 @@ 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/set_server_capacity()
set name = "Set Server Capacity"
set category = "Admin"
set desc = "Prevent new players connecting when over capacity."
if(!check_rights(R_ADMIN))
return
var/capacity = input("Please input the new Server Capacity (player count)", "Set Server Capacity", 150) as num
config.panic_bunker_threshold = Clamp(capacity, 0, 500)
log_admin("[key_name(usr)] has set the Server Capacity to [capacity].")
message_admins("[key_name_admin(usr)] has set the Server Capacity to [capacity].")
+8 -7
View File
@@ -417,13 +417,14 @@
// 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]")
if(GLOB.panic_bunker_enabled)
if(playercount < threshold)
GLOB.panic_bunker_enabled = FALSE
message_admins("Panic bunker has been automatically disabled due to playercount dropping below Server Capacity [threshold]")
else
if(playercount > threshold)
GLOB.panic_bunker_enabled = TRUE
message_admins("Panic bunker has been automatically enabled due to playercount rising above Server Capacity [threshold]")
/client/proc/is_connecting_from_localhost()
var/localhost_addresses = list("127.0.0.1", "::1") // Adresses