Merge pull request #12295 from Kyep/brig_notices

Brig Timer Upgrades
This commit is contained in:
variableundefined
2019-09-15 19:05:25 -04:00
committed by GitHub
+41 -3
View File
@@ -71,9 +71,23 @@
playsound(C.loc, "sound/goonstation/machines/printer_dotmatrix.ogg", 50, 1)
GLOB.cell_logs += P
var/datum/data/record/G = find_record("name", logname, data_core.general)
var/prisoner_drank = "unknown"
var/prisoner_trank = "unknown"
if(G)
if(G.fields["rank"])
prisoner_drank = G.fields["rank"]
if(G.fields["real_rank"]) // Ignore alt job titles - necessary for lookups
prisoner_trank = G.fields["real_rank"]
var/datum/data/record/R = find_security_record("name", logname)
Radio.autosay("Detainee [logname] has been incarcerated for [seconds_to_time(timetoset / 10)] for the charges of, '[logcharges]'. \
Arresting Officer: [usr.name].[R ? "" : " Detainee record not found, manual record update required."]", name, "Security", list(z))
var/announcetext = "Detainee [logname] ([prisoner_drank]) has been incarcerated for [seconds_to_time(timetoset / 10)] for the charges of, '[logcharges]'. \
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(R)
prisoner = R
@@ -87,9 +101,33 @@
R.fields["comments"] = list()
R.fields["comments"] += "Autogenerated by [name] on [current_date_string] [station_time_timestamp()]<BR>Sentenced to [timetoset/10] seconds for the charges of \"[logcharges]\" by [rank] [usr.name]."
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 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()
..()