diff --git a/code/controllers/configuration_vr.dm b/code/controllers/configuration_vr.dm index 2ee0c8e8cf..e5110a51b4 100644 --- a/code/controllers/configuration_vr.dm +++ b/code/controllers/configuration_vr.dm @@ -4,6 +4,8 @@ /datum/configuration var/list/engine_map // Comma separated list of engines to choose from. Blank means fully random. + var/assistants_ratio + var/assistants_assured = 15 // Default 15, only used if the ratio is set though. /hook/startup/proc/read_vs_config() var/list/Lines = file2list("config/config.txt") @@ -30,6 +32,10 @@ continue switch (name) + if ("assistants_ratio") + config.assistants_ratio = value + if ("assistants_assured") + config.assistants_assured = value if ("chat_webhook_url") config.chat_webhook_url = value if ("chat_webhook_key") @@ -40,4 +46,5 @@ config.fax_export_dir = value if ("items_survive_digestion") config.items_survive_digestion = 1 + return 1 diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 123ad1d396..1946a79730 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -103,6 +103,7 @@ var/list/admin_verbs_admin = list( /datum/admins/proc/paralyze_mob, /client/proc/fixatmos, /datum/admins/proc/quick_nif, //VOREStation Add, + /datum/admins/proc/assistant_ratio, //VOREStation Add, /datum/admins/proc/sendFax ) diff --git a/code/modules/admin/verbs/debug_vr.dm b/code/modules/admin/verbs/debug_vr.dm index eb8cd37e01..5484f37771 100644 --- a/code/modules/admin/verbs/debug_vr.dm +++ b/code/modules/admin/verbs/debug_vr.dm @@ -30,3 +30,18 @@ log_and_message_admins("[key_name(src)] Quick NIF'd [H.real_name].") feedback_add_details("admin_verb","QNIF") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! + +/datum/admins/proc/assistant_ratio() + set category = "Admin" + set name = "Toggle Asst. Ratio" + set desc = "Toggles the assistant ratio enforcement on/off." + + if(!check_rights(R_ADMIN)) + return + + if(isnull(config.assistants_ratio)) + to_chat(usr,"Assistant ratio enforcement isn't even turned on...") + return + + config.assistants_ratio *= -1 + to_chat(usr,"Assistant ratio enforcement now [config.assistants_ratio > 0 ? "enabled" : "disabled"].") diff --git a/code/modules/mob/new_player/new_player_vr.dm b/code/modules/mob/new_player/new_player_vr.dm index d92df60859..0b5b2c26b6 100644 --- a/code/modules/mob/new_player/new_player_vr.dm +++ b/code/modules/mob/new_player/new_player_vr.dm @@ -47,6 +47,22 @@ pass = FALSE to_chat(src,"Your custom species is not playable. Reconfigure your traits on the VORE tab.") + //Assistant ratio enforcement + if (config.assistants_ratio > 0) //Stored as a negative number when inactive by admin verb + + var/nonassistants = 0 + var/assistants = 0 + for(var/job in job_master.occupations) + var/datum/job/J = job + if(istype(J,/datum/job/assistant)) + assistants += J.current_positions + else + nonassistants += J.current_positions + + if(assistants != 0 && assistants >= config.assistants_assured && nonassistants/assistants < config.assistants_ratio) + pass = FALSE + to_chat(src,"There are currently [assistants] assistants, and [nonassistants] normal employees, while we enforce a specific ratio. Please join as a job instead of assistant.") + //Final popup notice if (!pass) alert(src,"There were problems with spawning your character. Check your message log for details.","Error","OK")