From 97e53916f6b16193b7ccc8e9600d6972de55beea Mon Sep 17 00:00:00 2001 From: Kyep Date: Mon, 29 Apr 2019 20:10:06 -0700 Subject: [PATCH] job transfers now correctly update job slots --- code/controllers/subsystem/jobs.dm | 9 +++++++++ code/game/machinery/computer/card.dm | 2 +- .../file_system/programs/command/card.dm | 2 ++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/code/controllers/subsystem/jobs.dm b/code/controllers/subsystem/jobs.dm index 5abd6f165f3..b68a24a2574 100644 --- a/code/controllers/subsystem/jobs.dm +++ b/code/controllers/subsystem/jobs.dm @@ -624,6 +624,15 @@ SUBSYSTEM_DEF(jobs) 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 = "" diff --git a/code/game/machinery/computer/card.dm b/code/game/machinery/computer/card.dm index 60d11cc1e30..1d654fc30f8 100644 --- a/code/game/machinery/computer/card.dm +++ b/code/game/machinery/computer/card.dm @@ -408,6 +408,7 @@ var/time_last_changed_position = 0 message_admins("[key_name_admin(usr)] has reassigned \"[modify.registered_name]\" from \"[jobnamedata]\" to \"[t1]\".") SSjobs.log_job_transfer(modify.registered_name, jobnamedata, t1, scan.registered_name) + SSjobs.slot_job_transfer(modify.rank, t1) var/mob/living/carbon/human/H = modify.getPlayer() if(istype(H)) @@ -416,7 +417,6 @@ var/time_last_changed_position = 0 if(H.mind) H.mind.playtime_role = t1 - modify.access = access modify.rank = t1 modify.assignment = t1 diff --git a/code/modules/modular_computers/file_system/programs/command/card.dm b/code/modules/modular_computers/file_system/programs/command/card.dm index 82abf75d36f..2a13861e51b 100644 --- a/code/modules/modular_computers/file_system/programs/command/card.dm +++ b/code/modules/modular_computers/file_system/programs/command/card.dm @@ -250,6 +250,8 @@ message_admins("[key_name_admin(usr)] has reassigned \"[modify.registered_name]\" from \"[jobnamedata]\" to \"[t1]\".") SSjobs.log_job_transfer(modify.registered_name, jobnamedata, t1, scan.registered_name) + SSjobs.slot_job_transfer(modify.rank, t1) + var/mob/living/carbon/human/H = modify.getPlayer() if(istype(H)) if(jobban_isbanned(H, t1))