From f0b6a4e4b433a83480ca096d0197ef3882bbb157 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Wed, 17 Aug 2022 16:53:15 +0200 Subject: [PATCH] [MIRROR] unifies security record printing [MDB IGNORE] (#15481) * unifies security record printing * unifies security record printing Co-authored-by: ShizCalev Co-authored-by: Tom <8881105+tf-4@users.noreply.github.com> --- code/datums/datacore.dm | 59 ++++++++++++++++++++++++ code/game/machinery/computer/security.dm | 56 ++-------------------- code/modules/paperwork/filingcabinet.dm | 13 +----- 3 files changed, 64 insertions(+), 64 deletions(-) diff --git a/code/datums/datacore.dm b/code/datums/datacore.dm index d1a8f916b2c..7122ad733d9 100644 --- a/code/datums/datacore.dm +++ b/code/datums/datacore.dm @@ -329,3 +329,62 @@ GLOBAL_DATUM_INIT(data_core, /datum/datacore, new) /datum/datacore/proc/get_id_photo(mob/living/carbon/human/human, show_directions = list(SOUTH)) return get_flat_existing_human_icon(human, show_directions) + +//Todo: Add citations to the prinout - you get them from sec record's "citation" field, same as "crim" (which is frankly a terrible fucking field name) +///Standardized printed records. SPRs. Like SATs but for bad guys who probably didn't actually finish school. Input the records and out comes a paper. +/proc/print_security_record(datum/data/record/general_data, datum/data/record/security, atom/location) + if(!istype(general_data) && !istype(security)) + stack_trace("called without any datacores! this may or may not be intentional!") + if(!isatom(location)) //can't drop the paper if we didn't get passed an atom. + CRASH("NO VALID LOCATION PASSED.") + + GLOB.data_core.securityPrintCount++ //just alters the name of the paper. + var/obj/item/paper/printed_paper = new(location) + var/final_paper_text = "
Security Record - (SR-[GLOB.data_core.securityPrintCount])

" + if((istype(general_data, /datum/data/record) && GLOB.data_core.general.Find(general_data))) + final_paper_text += text("Name: [] ID: []
\nGender: []
\nAge: []
", general_data.fields["name"], general_data.fields["id"], general_data.fields["gender"], general_data.fields["age"]) + final_paper_text += "\nSpecies: [general_data.fields["species"]]
" + final_paper_text += text("\nFingerprint: []
\nPhysical Status: []
\nMental Status: []
", general_data.fields["fingerprint"], general_data.fields["p_stat"], general_data.fields["m_stat"]) + //SKYRAT EDIT ADD - RP RECORDS + if(!(general_data.fields["past_records"] == "")) + final_paper_text += "\nGeneral Records:\n[general_data.fields["past_records"]]\n" + //SKYRAT EDIT ADD END + else + final_paper_text += "General Record Lost!
" + if((istype(security, /datum/data/record) && GLOB.data_core.security.Find(security))) + //final_paper_text += text("
\n
Security Data

\nCriminal Status: []", security.fields["criminal"]) // ORIGINAL + //SKYRAT EDIT ADDITION START - RP RECORDS + final_paper_text += text("
\n
Security Data

\n") + if(!(security.fields["past_records"] == "")) + final_paper_text += "\nSecurity Records:\n[security.fields["past_records"]]\n" + final_paper_text += text("Criminal Status: []", security.fields["criminal"]) + //SKYRAT EDIT END + + final_paper_text += "
\n
\nCrimes:
\n" + final_paper_text +={" + + + + + +"} + for(var/datum/data/crime/c in security.fields["crim"]) + final_paper_text += "" + final_paper_text += "" + final_paper_text += "" + final_paper_text += "" + final_paper_text += "" + final_paper_text += "
CrimeDetailsAuthorTime Added
[c.crimeName][c.crimeDetails][c.author][c.time]
" + + final_paper_text += text("
\nImportant Notes:
\n\t[]
\n
\n
Comments/Log

", security.fields["notes"]) + var/counter = 1 + while(security.fields[text("com_[]", counter)]) + final_paper_text += text("[]
", security.fields[text("com_[]", counter)]) + counter++ + printed_paper.name = text("SR-[] '[]'", GLOB.data_core.securityPrintCount, general_data.fields["name"]) + else //if no security record + final_paper_text += "Security Record Lost!
" + printed_paper.name = text("SR-[] '[]'", GLOB.data_core.securityPrintCount, "Record Lost") + final_paper_text += "" + printed_paper.add_raw_text(final_paper_text) + printed_paper.update_appearance() //make sure we make the paper look like it has writing on it. diff --git a/code/game/machinery/computer/security.dm b/code/game/machinery/computer/security.dm index 99365738bfb..6ab9f54b0bd 100644 --- a/code/game/machinery/computer/security.dm +++ b/code/game/machinery/computer/security.dm @@ -568,59 +568,11 @@ What a mess.*/ if("Print Record") if(!( printing )) - printing = 1 - GLOB.data_core.securityPrintCount++ - playsound(loc, 'sound/items/poster_being_created.ogg', 100, TRUE) + printing = TRUE + playsound(src, 'sound/items/poster_being_created.ogg', 100, TRUE) sleep(30) - var/obj/item/paper/printed_paper = new /obj/item/paper(loc) - var/final_paper_text = "
Security Record - (SR-[GLOB.data_core.securityPrintCount])

" - if((istype(active1, /datum/data/record) && GLOB.data_core.general.Find(active1))) - final_paper_text += text("Name: [] ID: []
\nGender: []
\nAge: []
", active1.fields["name"], active1.fields["id"], active1.fields["gender"], active1.fields["age"]) - final_paper_text += "\nSpecies: [active1.fields["species"]]
" - final_paper_text += text("\nFingerprint: []
\nPhysical Status: []
\nMental Status: []
", active1.fields["fingerprint"], active1.fields["p_stat"], active1.fields["m_stat"]) - //SKYRAT EDIT ADD - RP RECORDS - if(!(active1.fields["past_records"] == "")) - final_paper_text += "\nGeneral Records:\n[active1.fields["past_records"]]\n" - //SKYRAT EDIT ADD END - else - final_paper_text += "General Record Lost!
" - if((istype(active2, /datum/data/record) && GLOB.data_core.security.Find(active2))) - // final_paper_text += text("
\n
Security Data

\nCriminal Status: []", active2.fields["criminal"]) // SKYRAT EDIT ORIGINAL - //SKYRAT EDIT ADDITION START - RP RECORDS - final_paper_text += text("
\n
Security Data

\n") - if(!(active2.fields["past_records"] == "")) - final_paper_text += "\nSecurity Records:\n[active2.fields["past_records"]]\n" - final_paper_text += text("Criminal Status: []", active2.fields["criminal"]) - //SKYRAT EDIT END - final_paper_text += "
\n
\nCrimes:
\n" - final_paper_text +={" - - - - - -"} - for(var/datum/data/crime/c in active2.fields["crim"]) - final_paper_text += "" - final_paper_text += "" - final_paper_text += "" - final_paper_text += "" - final_paper_text += "" - final_paper_text += "
CrimeDetailsAuthorTime Added
[c.crimeName][c.crimeDetails][c.author][c.time]
" - - final_paper_text += text("
\nImportant Notes:
\n\t[]
\n
\n
Comments/Log

", active2.fields["notes"]) - var/counter = 1 - while(active2.fields[text("com_[]", counter)]) - final_paper_text += text("[]
", active2.fields[text("com_[]", counter)]) - counter++ - printed_paper.name = text("SR-[] '[]'", GLOB.data_core.securityPrintCount, active1.fields["name"]) - else - final_paper_text += "Security Record Lost!
" - printed_paper.name = text("SR-[] '[]'", GLOB.data_core.securityPrintCount, "Record Lost") - final_paper_text += "" - printed_paper.add_raw_text(final_paper_text) - printed_paper.update_appearance() - printing = null + print_security_record(active1, active2, loc) + printing = FALSE if("Print Poster") if(!( printing )) var/wanted_name = tgui_input_text(usr, "Enter an alias for the criminal", "Print Wanted Poster", active1.fields["name"]) diff --git a/code/modules/paperwork/filingcabinet.dm b/code/modules/paperwork/filingcabinet.dm index a0f63f5ded1..b0a37a5c665 100644 --- a/code/modules/paperwork/filingcabinet.dm +++ b/code/modules/paperwork/filingcabinet.dm @@ -129,18 +129,7 @@ var/datum/data/record/S = find_record("name", G.fields["name"], GLOB.data_core.security) if(!S) continue - var/obj/item/paper/sec_record_paper = new /obj/item/paper(src) - var/sec_record_text = "
Security Record

" - sec_record_text += "Name: [G.fields["name"]] ID: [G.fields["id"]]
\nGender: [G.fields["gender"]]
\nAge: [G.fields["age"]]
\nFingerprint: [G.fields["fingerprint"]]
\nPhysical Status: [G.fields["p_stat"]]
\nMental Status: [G.fields["m_stat"]]
" - sec_record_text += "
\n
Security Data

\nCriminal Status: [S.fields["criminal"]]
\n
\nCrimes: [S.fields["crim"]]
\nDetails: [S.fields["crim_d"]]
\n
\nImportant Notes:
\n\t[S.fields["notes"]]
\n
\n
Comments/Log

" - var/counter = 1 - while(S.fields["com_[counter]"]) - sec_record_text += "[S.fields["com_[counter]"]]
" - counter++ - sec_record_text += "" - sec_record_paper.name = "paper - '[G.fields["name"]]'" - sec_record_paper.add_raw_text(sec_record_text) - sec_record_paper.update_appearance() + print_security_record(G, S, src) virgin = FALSE //tabbing here is correct- it's possible for people to try and use it //before the records have been generated, so we do this inside the loop.