Replaces panic bunker with queue server

This commit is contained in:
AffectedArc07
2021-08-13 22:24:25 +01:00
parent a3bb1c0313
commit 42ebe326a6
11 changed files with 149 additions and 23 deletions
+2 -3
View File
@@ -97,10 +97,9 @@
qdel(exist_query)
else
if(!exist_query.NextRow()) // If there isnt a row, they aint been seen before
if(GLOB.panic_bunker_enabled)
if(SSqueue && SSqueue.queue_enabled && (length(GLOB.clients) > SSqueue.queue_threshold) && !(ckey in SSqueue.queue_bypass_list)) // To the person who tells me in code review "Oh you should use ?. here". No. That logic isnt appropriate here. It needs a dedicated null check due to the length comparison.
qdel(exist_query)
var/threshold = GLOB.configuration.general.panic_bunker_threshold
return list("reason" = "panic bunker", "desc" = "Server is not accepting connections from never-before-seen players until player count is less than [threshold]. Please try again later.")
return list("reason" = "server queue", "desc" = "You seem to have managed to skip the server queue, possibly due to connecting during a restart. Please reconnect in 10 minutes. If you still cant connect, please inform the server host.")
qdel(exist_query)
+3 -1
View File
@@ -137,7 +137,9 @@ GLOBAL_LIST_INIT(admin_verbs_server, list(
/client/proc/toggle_antagHUD_restrictions,
/client/proc/set_ooc,
/client/proc/reset_ooc,
/client/proc/set_next_map
/client/proc/set_next_map,
/client/proc/manage_queue,
/client/proc/add_queue_server_bypass
))
GLOBAL_LIST_INIT(admin_verbs_debug, list(
/client/proc/cmd_admin_list_open_jobs,
+58
View File
@@ -0,0 +1,58 @@
/client/proc/manage_queue()
set name = "Manage Queue Server"
set desc = "Manage the queue server and its settings"
set category = "Server"
if(!check_rights(R_SERVER))
return
var/list/choices = list("Show Status", "Toggle Queue Server", "Set Threshold", "Toggle Setting Persistence")
var/choice = input(usr, "Please, select an option", "Queue Server Manipulation") as null|anything in choices
switch(choice)
if("Show Status")
to_chat(usr, "<b>Queue Server Status</b>")
to_chat(usr, "Enabled: <b>[SSqueue.queue_enabled ? "<font color='green'>Yes</font>" : "<font color='red'>No</font>"]</b>")
to_chat(usr, "Queue Threshold: <b>[SSqueue.queue_threshold]</b>")
to_chat(usr, "Setting Persistence: <b>[SSqueue.persist_queue ? "<font color='green'>Yes</font>" : "<font color='red'>No</font>"]</b>")
if("Toggle Queue Server")
SSqueue.queue_enabled = !SSqueue.queue_enabled
to_chat(usr, "Queue server is now <b>[SSqueue.queue_enabled ? "<font color='green'>Enabled</font>" : "<font color='red'>Disabled</font>"]</b>")
message_admins("[key_name_admin(usr)] has [SSqueue.queue_enabled ? "enabled" : "disabled"] the server queue.")
log_admin("[key_name(usr)] has [SSqueue.queue_enabled ? "enabled" : "disabled"] the server queue.")
if("Set Threshold")
var/new_threshold = input(usr, "Enter new threshold", "Queue Server Manipulation", SSqueue.queue_threshold) as num|null
if(!new_threshold)
return
SSqueue.queue_threshold = new_threshold
to_chat(usr, "Queue threshold is now <b>[SSqueue.queue_threshold]</b>")
message_admins("[key_name_admin(usr)] has set the queue threshold to [SSqueue.queue_threshold].")
log_admin("[key_name(usr)] has set the queue threshold to [SSqueue.queue_threshold].")
if("Toggle Setting Persistence")
SSqueue.persist_queue = !SSqueue.persist_queue
to_chat(usr, "Queue server setting persistence is now <b>[SSqueue.persist_queue ? "<font color='green'>Enabled</font>" : "<font color='red'>Disabled</font>"]</b>")
message_admins("[key_name_admin(usr)] has [SSqueue.persist_queue ? "enabled" : "disabled"] the server queue settings persistence.")
log_admin("[key_name(usr)] has [SSqueue.persist_queue ? "enabled" : "disabled"] the server queue settings persistence.")
/client/proc/add_queue_server_bypass()
set name = "Add Queue Server Bypass"
set desc = "Allow a ckey to bypass the server queue"
set category = "Server"
if(!check_rights(R_SERVER))
return
var/bypass_ckey = input(usr, "Please, enter a ckey", "Queue Server Bypass")
if(!bypass_ckey)
return
var/clean_ckey = ckey(bypass_ckey)
if(!clean_ckey)
to_chat(usr, "Invalid ckey supplied")
return
SSqueue.queue_bypass_list.Add(clean_ckey)
message_admins("[key_name_admin(usr)] has added the ckey [clean_ckey] to the queue bypass list.")
log_admin("[key_name(usr)] has added the ckey [clean_ckey] to the queue bypass list.")