diff --git a/code/controllers/subsystem/jobs.dm b/code/controllers/subsystem/jobs.dm index ccd83640aa6..02f2681b22d 100644 --- a/code/controllers/subsystem/jobs.dm +++ b/code/controllers/subsystem/jobs.dm @@ -8,6 +8,8 @@ SUBSYSTEM_DEF(jobs) var/list/name_occupations = list() //Dict of all jobs, keys are titles var/list/type_occupations = list() //Dict of all jobs, keys are types var/list/prioritized_jobs = list() // List of jobs set to priority by HoP/Captain + var/list/id_change_records = list() // List of all job transfer records + var/list/id_change_counter = 1 //Players who need jobs var/list/unassigned = list() //Debug info @@ -601,3 +603,84 @@ SUBSYSTEM_DEF(jobs) spawn(0) to_chat(H, "Your account number is: [M.account_number], your account pin is: [M.remote_access_pin]") + +/datum/controller/subsystem/jobs/proc/format_jobs_for_id_computer(obj/item/card/id/tgtcard) + var/list/jobs_to_formats = list() + if(tgtcard) + var/mob/M = tgtcard.getPlayer() + for(var/datum/job/job in occupations) + if(tgtcard.assignment && tgtcard.assignment == job.title) + jobs_to_formats[job.title] = "disabled" // the job they already have is pre-selected + else if(!job.would_accept_job_transfer_from_player(M)) + jobs_to_formats[job.title] = "linkDiscourage" // karma jobs they don't have available are discouraged + else if(job.total_positions && !job.current_positions && job.title != "Civilian") + jobs_to_formats[job.title] = "linkEncourage" // jobs with nobody doing them at all are encouraged + else if(job.total_positions >= 0 && job.current_positions >= job.total_positions) + jobs_to_formats[job.title] = "linkDiscourage" // jobs that are full (no free positions) are discouraged + return jobs_to_formats + + +/datum/controller/subsystem/jobs/proc/log_job_transfer(transferee, oldvalue, newvalue, whodidit) + id_change_records["[id_change_counter]"] = list("transferee" = transferee, "oldvalue" = oldvalue, "newvalue" = newvalue, "whodidit" = whodidit, "timestamp" = station_time_timestamp()) + id_change_counter++ + +/datum/controller/subsystem/jobs/proc/slot_job_transfer(oldtitle, newtitle) + var/datum/job/oldjobdatum = SSjobs.GetJob(oldtitle) + var/datum/job/newjobdatum = SSjobs.GetJob(newtitle) + if(istype(oldjobdatum) && oldjobdatum.current_positions > 0 && istype(newjobdatum)) + if(!(oldjobdatum.title in command_positions) && !(newjobdatum.title in command_positions)) + oldjobdatum.current_positions-- + newjobdatum.current_positions++ + + +/datum/controller/subsystem/jobs/proc/fetch_transfer_record_html(var/centcom) + var/record_html = "
| [thisheader] | " + record_html += "|
| [thisrecord[lkey]] | " + else + continue + else + record_html += "[thisrecord[lkey]] | " + record_html += "