diff --git a/code/controllers/subsystem/jobs.dm b/code/controllers/subsystem/jobs.dm index 6f7894ca428..41451ba8b61 100644 --- a/code/controllers/subsystem/jobs.dm +++ b/code/controllers/subsystem/jobs.dm @@ -642,6 +642,32 @@ SUBSYSTEM_DEF(jobs) oldjobdatum.current_positions-- newjobdatum.current_positions++ +/datum/controller/subsystem/jobs/proc/force_free_slot(oldtitle) + // Used when a crew ID is demoted/terminated in an ID computer. + var/datum/job/oldjobdatum = SSjobs.GetJob(oldtitle) + if(istype(oldjobdatum) && oldjobdatum.current_positions > 0) + oldjobdatum.current_positions-- + +/datum/controller/subsystem/jobs/proc/notify_dept_head(jobtitle, antext) + // Used to notify the department head of jobtitle X that their employee was brigged, demoted or terminated + if(!jobtitle || !antext) + return + var/datum/job/tgt_job = GetJob(jobtitle) + if(!tgt_job) + return + if(!tgt_job.department_head[1]) + return + var/boss_title = tgt_job.department_head[1] + var/obj/item/pda/target_pda + for(var/obj/item/pda/check_pda in GLOB.PDAs) + if(check_pda.ownrank == boss_title) + target_pda = check_pda + if(!target_pda) + return + var/datum/data/pda/app/messenger/PM = target_pda.find_program(/datum/data/pda/app/messenger) + if(PM && PM.can_receive()) + PM.notify("Automated Notification: \"[antext]\" (Unable to Reply)") + /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 40005f8fd12..4920c3a7183 100644 --- a/code/game/machinery/computer/card.dm +++ b/code/game/machinery/computer/card.dm @@ -464,6 +464,7 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0) if(is_authenticated(usr) && !target_dept) var/delcount = SSjobs.delete_log_records(scan.registered_name, TRUE) if(delcount) + message_admins("[key_name_admin(usr)] has wiped all ID computer logs.") playsound(src, 'sound/machines/terminal_prompt_confirm.ogg', 50, 0) SSnanoui.update_uis(src) @@ -503,9 +504,17 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0) if("terminate") if(is_authenticated(usr) && !target_dept) var/jobnamedata = modify.getRankAndAssignment() - log_game("[key_name(usr)] has terminated the employment of \"[modify.registered_name]\" the \"[jobnamedata]\".") - message_admins("[key_name_admin(usr)] has terminated the employment of \"[modify.registered_name]\" the \"[jobnamedata]\".") + var/reason = sanitize(copytext(input("Enter legal reason for termination. Enter nothing to cancel.","Employment Termination"),1,MAX_MESSAGE_LEN)) + if(!reason || !is_authenticated(usr) || !modify) + return 0 + var/m_ckey = modify.getPlayerCkey() + var/m_ckey_text = m_ckey ? "([m_ckey])" : "(no ckey)" + log_game("[key_name(usr)] has terminated the employment of \"[modify.registered_name]\" [m_ckey_text] the \"[jobnamedata]\" for: \"[reason]\".") + message_admins("[key_name_admin(usr)] has terminated the employment of \"[modify.registered_name]\" [m_ckey_text] the \"[jobnamedata]\" for: \"[reason]\".") SSjobs.log_job_transfer(modify.registered_name, jobnamedata, "Terminated", scan.registered_name) + if(modify.owner_uid) + SSjobs.force_free_slot(modify.rank) + SSjobs.notify_dept_head(modify.rank, "[scan.registered_name] has terminated the employment of \"[modify.registered_name]\" the \"[jobnamedata]\" for \"[reason]\".") modify.assignment = "Terminated" modify.access = list() @@ -517,16 +526,21 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0) if(!job_in_department(SSjobs.GetJob(modify.rank), FALSE)) visible_message("[src]: Heads may only demote members of their own department.") return 0 - + var/reason = sanitize(copytext(input("Enter legal reason for demotion. Enter nothing to cancel.","Legal Demotion"),1,MAX_MESSAGE_LEN)) + if(!reason || !is_authenticated(usr) || !modify) + return 0 var/list/access = list() var/datum/job/jobdatum = new /datum/job/civilian access = jobdatum.get_access() - var/jobnamedata = modify.getRankAndAssignment() - log_game("[key_name(usr)] has demoted \"[modify.registered_name]\" the \"[jobnamedata]\" to \"Civilian (Demoted)\".") - message_admins("[key_name_admin(usr)] has demoted \"[modify.registered_name]\" the \"[jobnamedata]\" to \"Civilian (Demoted)\".") + var/m_ckey = modify.getPlayerCkey() + var/m_ckey_text = m_ckey ? "([m_ckey])" : "(no ckey)" + log_game("[key_name(usr)] has demoted \"[modify.registered_name]\" the \"[jobnamedata]\" [m_ckey_text] to \"Civilian (Demoted)\" for: \"[reason]\".") + message_admins("[key_name_admin(usr)] has demoted \"[modify.registered_name]\" the \"[jobnamedata]\" [m_ckey_text] to \"Civilian (Demoted)\" for: \"[reason]\".") SSjobs.log_job_transfer(modify.registered_name, jobnamedata, "Demoted", scan.registered_name) - + if(modify.owner_uid) + SSjobs.force_free_slot(modify.rank) + SSjobs.notify_dept_head(modify.rank, "[scan.registered_name] has demoted \"[modify.registered_name]\" the \"[jobnamedata]\" for \"[reason]\".") modify.access = access modify.rank = "Civilian" modify.assignment = "Demoted" diff --git a/code/game/machinery/doors/brigdoors.dm b/code/game/machinery/doors/brigdoors.dm index 29549a05630..0850b5a4b45 100644 --- a/code/game/machinery/doors/brigdoors.dm +++ b/code/game/machinery/doors/brigdoors.dm @@ -86,8 +86,8 @@ Arresting Officer: [usr.name].[R ? "" : " Detainee record not found, manual record update required."]" Radio.autosay(announcetext, name, "Security", list(z)) - if(prisoner_trank != "unknown") - notify_dept_head(prisoner_trank, announcetext) + if(prisoner_trank != "unknown" && prisoner_trank != "Civilian") + SSjobs.notify_dept_head(prisoner_trank, announcetext) if(R) prisoner = R @@ -103,31 +103,6 @@ update_all_mob_security_hud() return 1 - -/obj/machinery/door_timer/proc/notify_dept_head(jobtitle, antext) - if(!jobtitle || !antext) - return - if(jobtitle == "Civilian") - // Don't notify the HoP about greytiding civilians - return - var/datum/job/brigged_job = SSjobs.GetJob(jobtitle) - if(!brigged_job) - return - if(!brigged_job.department_head[1]) - return - var/boss_title = brigged_job.department_head[1] - - var/obj/item/pda/target_pda - for(var/obj/item/pda/check_pda in GLOB.PDAs) - if(check_pda.ownrank == boss_title) - target_pda = check_pda - if(!target_pda) - return - var/datum/data/pda/app/messenger/PM = target_pda.find_program(/datum/data/pda/app/messenger) - if(PM && PM.can_receive()) - PM.notify("Message from Brig Timer (Automated), \"[antext]\" (Unable to Reply)") - - /obj/machinery/door_timer/Initialize() ..() diff --git a/code/game/objects/items/weapons/cards_ids.dm b/code/game/objects/items/weapons/cards_ids.dm index 405ce47a033..86f36513a2e 100644 --- a/code/game/objects/items/weapons/cards_ids.dm +++ b/code/game/objects/items/weapons/cards_ids.dm @@ -212,6 +212,11 @@ return M owner_ckey = null +/obj/item/card/id/proc/getPlayerCkey() + var/mob/living/carbon/human/H = getPlayer() + if(istype(H)) + return H.ckey + /obj/item/card/id/proc/is_untrackable() return untrackable 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 9067a345d4e..f440e3ad214 100644 --- a/code/modules/modular_computers/file_system/programs/command/card.dm +++ b/code/modules/modular_computers/file_system/programs/command/card.dm @@ -289,6 +289,7 @@ if(is_authenticated(usr)) var/delcount = SSjobs.delete_log_records(scan.registered_name, TRUE) if(delcount) + message_admins("[key_name_admin(usr)] has wiped all ID computer logs.") playsound(src, 'sound/machines/terminal_prompt_confirm.ogg', 50, 0) if("PRG_print") @@ -330,9 +331,15 @@ if("PRG_terminate") if(is_authenticated(usr)) var/jobnamedata = modify.getRankAndAssignment() - log_game("[key_name(usr)] has terminated the employment of \"[modify.registered_name]\" the \"[jobnamedata]\".") - message_admins("[key_name_admin(usr)] has terminated the employment of \"[modify.registered_name]\" the \"[jobnamedata]\".") + var/reason = sanitize(copytext(input("Enter legal reason for termination. Enter nothing to cancel.","Employment Termination"),1,MAX_MESSAGE_LEN)) + if(!reason || !is_authenticated(usr) || !modify) + return + log_game("[key_name(usr)] has terminated the employment of \"[modify.registered_name]\" the \"[jobnamedata]\" for: \"[reason]\".") + message_admins("[key_name_admin(usr)] has terminated the employment of \"[modify.registered_name]\" the \"[jobnamedata]\" for: \"[reason]\".") SSjobs.log_job_transfer(modify.registered_name, jobnamedata, "Terminated", scan.registered_name) + if(modify.owner_uid) + SSjobs.force_free_slot(modify.rank) + SSjobs.notify_dept_head(modify.rank, "[scan.registered_name] has terminated the employment of \"[modify.registered_name]\" the \"[jobnamedata]\" for \"[reason]\".") modify.assignment = "Terminated" modify.access = list()