Fixes the ability to join a job as the wrong faction (#13059)

This commit is contained in:
Casper3667
2022-02-02 16:47:35 +01:00
committed by GitHub
parent a3bb43005a
commit 1d309ef966
2 changed files with 18 additions and 1 deletions
@@ -287,15 +287,26 @@
ResetJobs()
return TOPIC_REFRESH_UPDATE_PREVIEW
var/datum/species/S = pref.get_species_datum()
var/datum/faction/faction = SSjobs.name_factions[pref.faction]
for(var/datum/job/job in faction.get_occupations())
for(var/datum/job/job in SSjobs.occupations)
for(var/department = 1 to NUM_JOB_DEPTS)
if(pref.GetJobDepartment(job, department) & job.flag)
if(!(job in faction.get_occupations()))
to_client_chat(SPAN_DANGER("Your faction selection does not permit this job, [job.title] as [pref.faction]."))
to_client_chat(SPAN_DANGER("Your jobs have been reset due to this!"))
ResetJobs()
return TOPIC_REFRESH_UPDATE_PREVIEW
if(pref.species in job.blacklisted_species)
to_client_chat(SPAN_DANGER("Your faction selection does not permit this species-occupation combination, [pref.species] as [job.title]."))
to_client_chat(SPAN_DANGER("Your jobs have been reset due to this!"))
ResetJobs()
return TOPIC_REFRESH_UPDATE_PREVIEW
if(!is_type_in_typecache(S, faction.allowed_species_types))
to_client_chat(SPAN_DANGER("Your faction selection does not permit this species, [pref.species] as [pref.faction]."))
to_client_chat(SPAN_DANGER("Your jobs have been reset due to this!"))
ResetJobs()
return TOPIC_REFRESH_UPDATE_PREVIEW
/datum/category_item/player_setup_item/occupation/proc/SetPlayerAltTitle(datum/job/job, new_title)
// remove existing entry