mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
Fixes the occupation screen.
This commit is contained in:
@@ -54,23 +54,67 @@
|
||||
if(alt_title && !(alt_title in job.alt_titles))
|
||||
pref.player_alt_titles -= job.title
|
||||
|
||||
<<<<<<< HEAD
|
||||
/datum/category_item/player_setup_item/occupation/content(mob/user, limit = 20, list/splitJobs = list("Pathfinder")) //VOREStation Edit
|
||||
=======
|
||||
/datum/category_item/player_setup_item/occupation/content(mob/user, limit = 20, list/splitJobs = list())
|
||||
>>>>>>> 920e495... Merge pull request #6813 from Neerti/occupation_screen_fix
|
||||
if(!job_master)
|
||||
return
|
||||
|
||||
. = list()
|
||||
. += "<tt><center>"
|
||||
. += "<b>Choose occupation chances</b><br>Unavailable occupations are crossed out.<br>"
|
||||
. += "<table width='100%' cellpadding='1' cellspacing='0'><tr><td width='20%'>" // Table within a table for alignment, also allows you to easily add more columns.
|
||||
. += "<table width='100%' cellpadding='1' cellspacing='0'><tr><td width='20%' valign='top'>" // Table within a table for alignment, also allows you to easily add more columns.
|
||||
. += "<table width='100%' cellpadding='1' cellspacing='0'>"
|
||||
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
|
||||
<<<<<<< HEAD
|
||||
if (!job_master) return
|
||||
for(var/datum/job/job in job_master.occupations)
|
||||
if(job.latejoin_only) continue //VOREStation Code
|
||||
if((++index >= limit) || (job.title in splitJobs))
|
||||
=======
|
||||
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)
|
||||
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)
|
||||
>>>>>>> 920e495... Merge pull request #6813 from Neerti/occupation_screen_fix
|
||||
/*******
|
||||
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
|
||||
@@ -78,8 +122,9 @@
|
||||
for(var/i = 0, i < (limit - index), i++)
|
||||
. += "<tr bgcolor='[lastJob.selection_color]'><td width='60%' align='right'>//> </a></td><td><a> </a></td></tr>"
|
||||
*******/
|
||||
. += "</table></td><td width='20%'><table width='100%' cellpadding='1' cellspacing='0'>"
|
||||
. += "</table></td><td width='20%' valign='top'><table width='100%' cellpadding='1' cellspacing='0'>"
|
||||
index = 0
|
||||
last_department = current_department
|
||||
|
||||
. += "<tr bgcolor='[job.selection_color]'><td width='60%' align='right'>"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user