ID computer demote/termination slot freedom, logging and upgrades

This commit is contained in:
Kyep
2020-04-26 17:59:54 -07:00
parent 895263a8df
commit 112baa534e
5 changed files with 63 additions and 36 deletions
+26
View File
@@ -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("<b>Automated Notification: </b>\"[antext]\" (Unable to Reply)")
/datum/controller/subsystem/jobs/proc/fetch_transfer_record_html(var/centcom)
var/record_html = "<TABLE border=\"1\">"
+21 -7
View File
@@ -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("<span class='notice'>[src]: Heads may only demote members of their own department.</span>")
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"
+2 -27
View File
@@ -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("<b>Message from Brig Timer (Automated), </b>\"[antext]\" (Unable to Reply)")
/obj/machinery/door_timer/Initialize()
..()
@@ -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
@@ -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()