//used for pref.alternate_option
#define GET_RANDOM_JOB 0
#define BE_ASSISTANT 1
#define RETURN_TO_LOBBY 2
/datum/category_item/player_setup_item/occupation
name = "Occupation"
sort_order = 1
/datum/category_item/player_setup_item/occupation/load_character(var/savefile/S)
S["alternate_option"] >> pref.alternate_option
S["job_civilian_high"] >> pref.job_civilian_high
S["job_civilian_med"] >> pref.job_civilian_med
S["job_civilian_low"] >> pref.job_civilian_low
S["job_medsci_high"] >> pref.job_medsci_high
S["job_medsci_med"] >> pref.job_medsci_med
S["job_medsci_low"] >> pref.job_medsci_low
S["job_engsec_high"] >> pref.job_engsec_high
S["job_engsec_med"] >> pref.job_engsec_med
S["job_engsec_low"] >> pref.job_engsec_low
//VOREStation Add
S["job_talon_low"] >> pref.job_talon_low
S["job_talon_med"] >> pref.job_talon_med
S["job_talon_high"] >> pref.job_talon_high
//VOREStation Add End
S["player_alt_titles"] >> pref.player_alt_titles
/datum/category_item/player_setup_item/occupation/save_character(var/savefile/S)
S["alternate_option"] << pref.alternate_option
S["job_civilian_high"] << pref.job_civilian_high
S["job_civilian_med"] << pref.job_civilian_med
S["job_civilian_low"] << pref.job_civilian_low
S["job_medsci_high"] << pref.job_medsci_high
S["job_medsci_med"] << pref.job_medsci_med
S["job_medsci_low"] << pref.job_medsci_low
S["job_engsec_high"] << pref.job_engsec_high
S["job_engsec_med"] << pref.job_engsec_med
S["job_engsec_low"] << pref.job_engsec_low
//VOREStation Add
S["job_talon_low"] << pref.job_talon_low
S["job_talon_med"] << pref.job_talon_med
S["job_talon_high"] << pref.job_talon_high
//VOREStation Add End
S["player_alt_titles"] << pref.player_alt_titles
/datum/category_item/player_setup_item/occupation/sanitize_character()
pref.alternate_option = sanitize_integer(pref.alternate_option, 0, 2, initial(pref.alternate_option))
pref.job_civilian_high = sanitize_integer(pref.job_civilian_high, 0, 65535, initial(pref.job_civilian_high))
pref.job_civilian_med = sanitize_integer(pref.job_civilian_med, 0, 65535, initial(pref.job_civilian_med))
pref.job_civilian_low = sanitize_integer(pref.job_civilian_low, 0, 65535, initial(pref.job_civilian_low))
pref.job_medsci_high = sanitize_integer(pref.job_medsci_high, 0, 65535, initial(pref.job_medsci_high))
pref.job_medsci_med = sanitize_integer(pref.job_medsci_med, 0, 65535, initial(pref.job_medsci_med))
pref.job_medsci_low = sanitize_integer(pref.job_medsci_low, 0, 65535, initial(pref.job_medsci_low))
pref.job_engsec_high = sanitize_integer(pref.job_engsec_high, 0, 65535, initial(pref.job_engsec_high))
pref.job_engsec_med = sanitize_integer(pref.job_engsec_med, 0, 65535, initial(pref.job_engsec_med))
pref.job_engsec_low = sanitize_integer(pref.job_engsec_low, 0, 65535, initial(pref.job_engsec_low))
//VOREStation Add
pref.job_talon_high = sanitize_integer(pref.job_talon_high, 0, 65535, initial(pref.job_talon_high))
pref.job_talon_med = sanitize_integer(pref.job_talon_med, 0, 65535, initial(pref.job_talon_med))
pref.job_talon_low = sanitize_integer(pref.job_talon_low, 0, 65535, initial(pref.job_talon_low))
//VOREStation Add End
if(!(pref.player_alt_titles)) pref.player_alt_titles = new()
if(!job_master)
return
for(var/datum/job/job in job_master.occupations)
var/alt_title = pref.player_alt_titles[job.title]
if(alt_title && !(alt_title in job.alt_titles))
pref.player_alt_titles -= job.title
/datum/category_item/player_setup_item/occupation/content(mob/user, limit = 25, list/splitJobs = list())
if(!job_master)
return
. = list()
. += "
Unavailable occupations are crossed out.
"
. += "" // Table within a table for alignment, also allows you to easily add more columns.
. += " "
var/index = -1
//The job before the current job. I only use this to get the previous jobs color when I'm filling in blank rows.
var/datum/job/lastJob
var/datum/department/last_department = null // Used to avoid repeating the look-ahead check for if a whole department can fit.
var/list/all_valid_jobs = list()
// If the occupation window gets opened before SSJob initializes, then it'll just be blank, with no runtimes.
// It will work once init is finished.
for(var/D in SSjob.department_datums)
var/datum/department/department = SSjob.department_datums[D]
if(department.centcom_only) // No joining as a centcom role, if any are ever added.
continue
for(var/J in department.primary_jobs)
all_valid_jobs += department.jobs[J]
for(var/datum/job/job in all_valid_jobs)
if(job.latejoin_only) continue //VOREStation Code
var/datum/department/current_department = SSjob.get_primary_department_of_job(job)
// Should we add a new column?
var/make_new_column = FALSE
if(++index > limit)
// Ran out of rows, make a new column.
make_new_column = TRUE
else if(job.title in splitJobs)
// Is hardcoded to split at this job title.
make_new_column = TRUE
else if(current_department != last_department)
// If the department is bigger than the limit then we have to split.
if(limit >= current_department.primary_jobs.len)
// Look ahead to see if we would need to split, and if so, avoid it.
if(index + current_department.primary_jobs.len > limit)
// Looked ahead, and determined that a new column is needed to avoid splitting the department into two.
make_new_column = TRUE
if(make_new_column)
/*******
if((index < limit) && (lastJob != null))
//If the cells were broken up by a job in the splitJob list then it will fill in the rest of the cells with
//the last job's selection color and blank buttons that do nothing. Creating a rather nice effect.
for(var/i = 0, i < (limit - index), i++)
. += "
"
*******/
. += "//>    "
index = 0
last_department = current_department
. += "
"
. += " "
continue
if(!job.player_old_enough(user.client))
var/available_in_days = job.available_in_days(user.client)
. += ""
var/rank = job.title
lastJob = job
. += ""
if(jobban_isbanned(user, rank))
. += " [rank] \[BANNED] [rank] \[IN [(available_in_days)] DAYS] "
continue
//VOREStation Add
if(!job.player_has_enough_playtime(user.client))
var/available_in_hours = job.available_in_playhours(user.client)
. += "[rank] \[IN [(available_in_hours)] DEPTHOURS] "
continue
//VOREStation Add End
if(job.minimum_character_age && user.client && (user.client.prefs.age < job.minimum_character_age))
. += "[rank] \[MINIMUM CHARACTER AGE: [job.minimum_character_age]] "
continue
if((pref.job_civilian_low & ASSISTANT) && job.type != /datum/job/assistant)
. += "[rank]"
continue
if((rank in SSjob.get_job_titles_in_department(DEPARTMENT_COMMAND) ) || (rank == "AI"))//Bold head jobs
. += "[rank]"
else
. += "[rank]"
. += " "
. += ""
if(job.type == /datum/job/assistant)//Assistant is special
if(pref.job_civilian_low & ASSISTANT)
. += " \[Yes]"
else
. += " \[No]"
if(LAZYLEN(job.alt_titles)) //Blatantly cloned from a few lines down.
. += " "
. += ""
continue
if(pref.GetJobDepartment(job, 1) & job.flag)
. += " \[High]"
else if(pref.GetJobDepartment(job, 2) & job.flag)
. += " \[Medium]"
else if(pref.GetJobDepartment(job, 3) & job.flag)
. += " \[Low]"
else
. += " \[NEVER]"
if(LAZYLEN(job.alt_titles))
. += "  \[[pref.GetPlayerAltTitle(job)]\] "
. += ""
. += "  \[[pref.GetPlayerAltTitle(job)]\]
"
if(job.alt_titles)
dat += "Alternate titles: [english_list(job.alt_titles)]."
send_rsc(user, job.get_job_icon(), "job[ckey(rank)].png")
dat += "
"
if(job.departments)
dat += "Departments: [english_list(job.departments)]."
if(LAZYLEN(job.departments_managed))
dat += "You manage these departments: [english_list(job.departments_managed)]"
dat += "You answer to [job.supervisors] normally."
dat += "