Skip to content

Commit

Permalink
Отработка по ревью
Browse files Browse the repository at this point in the history
  • Loading branch information
msw7007 committed Dec 10, 2024
1 parent 142ba05 commit 2634c12
Show file tree
Hide file tree
Showing 4 changed files with 129 additions and 69 deletions.
4 changes: 0 additions & 4 deletions code/modules/mob/new_player/new_player.dm
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,6 @@
return FALSE
if(job.get_exp_restrictions(client))
return FALSE
// SS220 EDIT START - RACE/JOB BANS
if(job.species_ban(client))
return FALSE
// SS220 EDIT END - RACE/JOB BANS

if(GLOB.configuration.jobs.assistant_limit)
if(job.title == "Assistant")
Expand Down
152 changes: 94 additions & 58 deletions config/example/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -517,64 +517,6 @@ job_slot_amounts = [
{ name = "Assistant", lowpop = -1, highpop = -1 },
]

# Should enable job ban for species
allow_to_ban_job_for_species = false
# Job blacklist marks. Add specie name to ban job for a specific specie. Example: { name = "Captain", species_blacklist = ["Vox"] },
job_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 = [] },
]

################################################################


Expand Down Expand Up @@ -1218,3 +1160,97 @@ tag = "vox_raiders"
"candidates_required" = 2

################################################################

[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 = "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 = [] },
]

################################################################
28 changes: 25 additions & 3 deletions modular_ss220/jobs/code/configuration.dm
Original file line number Diff line number Diff line change
@@ -1,8 +1,30 @@
/datum/configuration_section/job_configuration
/datum/configuration_section/job_configuration_restriction
var/list/blacklist_species = list()
var/enable_black_list = FALSE

/datum/configuration_section/job_configuration/load_data(list/data)
. = .. ()
/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)
return

var/list/name_list = list()
for(var/job_info in blacklist_species)
name_list += job_info["name"]

var/list/all_jobs = SSjobs.name_occupations
for(var/check_job in all_jobs)
if(check_job in name_list)
continue
else
CRASH("[check_job] job not found in config block job_configuration_restriction")

/datum/server_configuration/load_all_sections()
. = ..()
jobs_restrict = new()
safe_load(jobs_restrict, "job_configuration_restriction")
14 changes: 10 additions & 4 deletions modular_ss220/jobs/code/jobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,20 @@
return FALSE

/datum/job/proc/species_ban(client/C)
if(!GLOB.configuration.jobs.enable_black_list)
GLOB.configuration.jobs_restrict.sanitize_job_checks()
if(!GLOB.configuration.jobs_restrict.enable_black_list)
return FALSE

var/list/job_ban = GLOB.configuration.jobs.blacklist_species.Copy()

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((src.title == job_data["name"]) && (C.prefs.active_character.species in job_data["species_blacklist"]))
if((title == job_data["name"]) && (C.prefs.active_character.species in job_data["species_blacklist"]))
return TRUE
return FALSE

/mob/new_player/IsJobAvailable(rank)
. = .. ()
var/datum/job/job = SSjobs.GetJob(rank)
if(job.species_ban(client))
return FALSE

0 comments on commit 2634c12

Please sign in to comment.