diff --git a/code/modules/client/preference/character.dm b/code/modules/client/preference/character.dm index 0c195ed001d6..1196cf946cbc 100644 --- a/code/modules/client/preference/character.dm +++ b/code/modules/client/preference/character.dm @@ -2084,6 +2084,11 @@ if(restrictions) html += "[rank] \[[restrictions]]" continue + // SS220 EDIT START - RACE/JOB BANS + if(job.species_ban(user.client)) + html += "[rank] \[SPECIES BLOCK\]" + continue + // SS220 EDIT END - RACE/JOB BANS if(job.barred_by_disability(user.client)) html += "[rank] \[DISABILITY\]" continue diff --git a/config/example/config.toml b/config/example/config.toml index 90174328879b..0f3cdf9abd87 100644 --- a/config/example/config.toml +++ b/config/example/config.toml @@ -1169,3 +1169,96 @@ endpoint = "https://models.inference.ai.azure.com/chat/completions" # Allows git model = "gpt-4o" ################################################################ + +[job_configuration_restriction] + +# Should enable job ban for species +allow_to_ban_job_for_species = false + +# Job blacklist marks. Add species name to ban job for a specific species. Example: { name = "Captain", species_blacklist = ["Vox"] }, +job_species_blacklist = [ + # Cental Command + { name = "Nanotrasen Navy Officer", species_blacklist = [] }, + { name = "Special Operations Officer", species_blacklist = [] }, + { name = "Trans-Solar Federation General", species_blacklist = [] }, + { name = "Syndicate Officer", species_blacklist = [] }, + # Commmand + { name = "Captain", species_blacklist = [] }, + { name = "Head of Personnel", species_blacklist = [] }, + { name = "Head of Security", species_blacklist = [] }, + { name = "Chief Engineer", species_blacklist = [] }, + { name = "Research Director", species_blacklist = [] }, + { name = "Chief Medical Officer", species_blacklist = [] }, + { name = "Quartermaster", species_blacklist = [] }, + { name = "Nanotrasen Representative", species_blacklist = [] }, + { name = "Blueshield", species_blacklist = [] }, + { name = "Magistrate", species_blacklist = [] }, + # Engineering + { name = "Life Support Specialist", species_blacklist = [] }, + { name = "Station Engineer", species_blacklist = [] }, + { name = "Trainee Engineer", species_blacklist = [] }, + # Medical + { name = "Chemist", species_blacklist = [] }, + { name = "Paramedic", species_blacklist = [] }, + { name = "Geneticist", species_blacklist = [] }, + { name = "Coroner", species_blacklist = [] }, + { name = "Psychiatrist", species_blacklist = [] }, + { name = "Medical Doctor", species_blacklist = [] }, + { name = "Medical Intern", species_blacklist = [] }, + { name = "Virologist", species_blacklist = [] }, + # Science + { name = "Roboticist", species_blacklist = [] }, + { name = "Scientist", species_blacklist = [] }, + { name = "Student Scientist", species_blacklist = [] }, + # Security + { name = "Detective", species_blacklist = [] }, + { name = "Security Officer", species_blacklist = [] }, + { name = "Security Cadet", species_blacklist = [] }, + { name = "Warden", species_blacklist = [] }, + { name = "Internal Affairs Agent", species_blacklist = [] }, + # Service + { name = "Bartender", species_blacklist = [] }, + { name = "Botanist", species_blacklist = [] }, + { name = "Chaplain", species_blacklist = [] }, + { name = "Chef", species_blacklist = [] }, + { name = "Janitor", species_blacklist = [] }, + { name = "Librarian", species_blacklist = [] }, + { name = "Clown", species_blacklist = [] }, + { name = "Mime", species_blacklist = [] }, + # Cargo/Supply + { name = "Explorer", species_blacklist = [] }, + { name = "Shaft Miner", species_blacklist = [] }, + { name = "Cargo Technician", species_blacklist = [] }, + # Silicon + { name = "AI", species_blacklist = [] }, + { name = "Cyborg", species_blacklist = [] }, + # Misc + { name = "Assistant", species_blacklist = [] }, + # Donor + { name = "Donor", species_blacklist = [] }, + { name = "Prisoner", species_blacklist = [] }, + { name = "Barber", species_blacklist = [] }, + { name = "Bath", species_blacklist = [] }, + { name = "Casino", species_blacklist = [] }, + { name = "Waiter", species_blacklist = [] }, + { name = "Acolyte", species_blacklist = [] }, + { name = "Wrestler", species_blacklist = [] }, + { name = "Musician", species_blacklist = [] }, + { name = "Actor", species_blacklist = [] }, + { name = "Administrator", species_blacklist = [] }, + { name = "Tourist TSF", species_blacklist = [] }, + { name = "Tourist USSP", species_blacklist = [] }, + { name = "Cleaning Manager", species_blacklist = [] }, + { name = "Guard", species_blacklist = [] }, + { name = "Migrant", species_blacklist = [] }, + { name = "Uncertain", species_blacklist = [] }, + { name = "Adjutant", species_blacklist = [] }, + { name = "Representative TSF", species_blacklist = [] }, + { name = "Representative USSP", species_blacklist = [] }, + { name = "Dealer", species_blacklist = [] }, + { name = "VIP Corporate Guest", species_blacklist = [] }, + { name = "Banker", species_blacklist = [] }, + { name = "Security Clown", species_blacklist = [] }, +] + +################################################################ diff --git a/modular_ss220/jobs/_jobs.dme b/modular_ss220/jobs/_jobs.dme index 52d6ceb3d615..6fee07d5919d 100644 --- a/modular_ss220/jobs/_jobs.dme +++ b/modular_ss220/jobs/_jobs.dme @@ -1,5 +1,6 @@ #include "_jobs.dm" +#include "code/configuration.dm" #include "code/card_computer.dm" #include "code/card_id.dm" #include "code/departaments.dm" diff --git a/modular_ss220/jobs/code/configuration.dm b/modular_ss220/jobs/code/configuration.dm new file mode 100644 index 000000000000..d8a7d1d17b18 --- /dev/null +++ b/modular_ss220/jobs/code/configuration.dm @@ -0,0 +1,34 @@ +/datum/configuration_section/job_configuration_restriction + var/list/blacklist_species = list() + var/enable_black_list = FALSE + +/datum/server_configuration + var/datum/configuration_section/job_configuration_restriction/jobs_restrict + +/datum/configuration_section/job_configuration_restriction/load_data(list/data) + CONFIG_LOAD_BOOL(enable_black_list, data["allow_to_ban_job_for_species"]) + CONFIG_LOAD_LIST(blacklist_species, data["job_species_blacklist"]) + +/datum/configuration_section/job_configuration_restriction/proc/sanitize_job_checks() + if(!SSjobs || !GLOB.all_species) + CRASH("Can't check job_configuration_restriction without SSjobs and GLOB.all_species") + + for(var/job_info in blacklist_species) + job_exist_in_config(job_info["name"]) + for(var/race_info in job_info["species_blacklist"]) + race_exist_in_config(race_info, job_info["name"]) + +/datum/configuration_section/job_configuration_restriction/proc/job_exist_in_config(job_name) + if(job_name in SSjobs.name_occupations) + return TRUE + CRASH("Job [job_name] mentioned in job_configuration_restriction not found in SSjobs.name_occupations") + +/datum/configuration_section/job_configuration_restriction/proc/race_exist_in_config(race_name, job_name) + if(race_name in GLOB.all_species) + return TRUE + CRASH("Race [race_name] mentioned in config of job_configuration_restriction for job [job_name] not found in global var of all species GLOB.all_species") + +/datum/server_configuration/load_all_sections() + . = ..() + jobs_restrict = new() + safe_load(jobs_restrict, "job_configuration_restriction") diff --git a/modular_ss220/jobs/code/jobs.dm b/modular_ss220/jobs/code/jobs.dm index e4c87cd2fe29..54f6a420f0ef 100644 --- a/modular_ss220/jobs/code/jobs.dm +++ b/modular_ss220/jobs/code/jobs.dm @@ -114,3 +114,27 @@ if(title in GLOB.all_jobs_ss220) return TRUE return FALSE + +/datum/job/proc/species_ban(client/C) + if(!GLOB.configuration.jobs_restrict.enable_black_list) + return FALSE + + var/list/job_ban = GLOB.configuration.jobs_restrict.blacklist_species + if(!C || !length(job_ban)) + return FALSE + for(var/job_data in job_ban) + if((title == job_data["name"]) && (C.prefs.active_character.species in job_data["species_blacklist"])) + return TRUE + return FALSE + +/mob/new_player/IsJobAvailable(rank) + . = ..() + if(!.) + return FALSE + var/datum/job/job = SSjobs.GetJob(rank) + if(job.species_ban(client)) + return FALSE + +/datum/controller/subsystem/jobs/Initialize() + . = ..() + GLOB.configuration.jobs_restrict.sanitize_job_checks()