Allows setting/enforcing an assistant ratio

This commit is contained in:
Arokha Sieyes
2018-01-21 21:03:11 -05:00
parent 5673579e86
commit 4792ea713a
2 changed files with 22 additions and 0 deletions

View File

@@ -4,6 +4,8 @@
/datum/configuration /datum/configuration
var/list/engine_map // Comma separated list of engines to choose from. Blank means fully random. 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() /hook/startup/proc/read_vs_config()
var/list/Lines = file2list("config/config.txt") var/list/Lines = file2list("config/config.txt")
@@ -40,4 +42,8 @@
config.fax_export_dir = value config.fax_export_dir = value
if ("items_survive_digestion") if ("items_survive_digestion")
config.items_survive_digestion = 1 config.items_survive_digestion = 1
if ("assistants_ratio")
config.assistants_ratio = value
if ("assistants_assured")
config.assistants_assured = value
return 1 return 1

View File

@@ -47,6 +47,22 @@
pass = FALSE pass = FALSE
to_chat(src,"<span class='warning'>Your custom species is not playable. Reconfigure your traits on the VORE tab.</span>") to_chat(src,"<span class='warning'>Your custom species is not playable. Reconfigure your traits on the VORE tab.</span>")
//Assistant ratio enforcement
if (config.assistants_ratio)
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 //Final popup notice
if (!pass) if (!pass)
alert(src,"There were problems with spawning your character. Check your message log for details.","Error","OK") alert(src,"There were problems with spawning your character. Check your message log for details.","Error","OK")