diff --git a/modular_ss220/modular_ss220.dme b/modular_ss220/modular_ss220.dme index ff4752541cbc..4073d4dc2b87 100644 --- a/modular_ss220/modular_ss220.dme +++ b/modular_ss220/modular_ss220.dme @@ -70,6 +70,7 @@ #include "outfits/_outfits.dme" #include "world_view_bigger/_world_view_bigger.dme" #include "mecha_skins/mecha_skins.dme" +#include "queue/_queue.dme" // --- PRIME --- // // #define MODPACK_MAIN_ONLY diff --git a/modular_ss220/queue/_queue.dm b/modular_ss220/queue/_queue.dm new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/modular_ss220/queue/_queue.dme b/modular_ss220/queue/_queue.dme new file mode 100644 index 000000000000..4931c496030f --- /dev/null +++ b/modular_ss220/queue/_queue.dme @@ -0,0 +1,4 @@ +#include "_queue.dm" + +#include "code/new_player_procs.dm" +#include "code/queue_bypass.dm" diff --git a/modular_ss220/queue/code/new_player_procs.dm b/modular_ss220/queue/code/new_player_procs.dm new file mode 100644 index 000000000000..7b1c9d1fd20d --- /dev/null +++ b/modular_ss220/queue/code/new_player_procs.dm @@ -0,0 +1,30 @@ +/mob/new_player/Login() + . = ..() + + if(!SSdbcore.IsConnected()) + return + + if(SSqueue.queue_enabled) + if(client?.ckey in SSqueue.queue_bypass_list) + return + + if(client?.holder) + SSqueue.queue_bypass_list |= ckey + return + + if(length(GLOB.clients) < SSqueue.queue_threshold) + SSqueue.queue_bypass_list |= ckey + return + + src << link(GLOB.configuration.overflow.overflow_server_location) + +/mob/new_player/Logout() + . = ..() + + addtimer(CALLBACK(src, PROC_REF(reserve_queue_slot)), 10 MINUTES) + +/mob/new_player/proc/reserve_queue_slot() + if(client?.ckey in GLOB.player_list) + return + + SSqueue.queue_bypass_list.Remove(last_known_ckey) diff --git a/modular_ss220/queue/code/queue_bypass.dm b/modular_ss220/queue/code/queue_bypass.dm new file mode 100644 index 000000000000..0cfa19707ab1 --- /dev/null +++ b/modular_ss220/queue/code/queue_bypass.dm @@ -0,0 +1,17 @@ +/datum/world_topic_handler/queue_bypass + topic_key = "queue_bypass" + requires_commskey = TRUE + +/datum/world_topic_handler/queue_bypass/execute(list/input, key_valid) + var/ckey_check = input["ckey_check"] + + if(!ckey_check) + return json_encode(list("error" = "No ckey supplied")) + + var/list/output_data = list() + output_data["queue_enabled"] = SSqueue.queue_enabled + + if(SSqueue.queue_enabled) + SSqueue.queue_bypass_list |= ckey_check + + return json_encode(output_data)