From 14a0dca7aebbde73df84fa60fda627552df6398d Mon Sep 17 00:00:00 2001 From: ShizCalev Date: Mon, 1 Aug 2022 18:58:41 -0400 Subject: [PATCH] unifies security record printing --- code/datums/datacore.dm | 47 ++++++++++++++++++++++++ code/game/machinery/computer/security.dm | 44 ++-------------------- code/modules/paperwork/filingcabinet.dm | 11 +----- 3 files changed, 51 insertions(+), 51 deletions(-) diff --git a/code/datums/datacore.dm b/code/datums/datacore.dm index ac90efea861..716c685e314 100644 --- a/code/datums/datacore.dm +++ b/code/datums/datacore.dm @@ -312,3 +312,50 @@ 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) + +/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)) + CRASH("NO VALID LOCATION PASSED.") + + GLOB.data_core.securityPrintCount++ + var/obj/item/paper/P = new /obj/item/paper(location) + P.info = "
Security Record - (SR-[GLOB.data_core.securityPrintCount])

" + if((istype(general_data, /datum/data/record) && GLOB.data_core.general.Find(general_data))) + P.info += text("Name: [] ID: []
\nGender: []
\nAge: []
", general_data.fields["name"], general_data.fields["id"], general_data.fields["gender"], general_data.fields["age"]) + P.info += "\nSpecies: [general_data.fields["species"]]
" + P.info += text("\nFingerprint: []
\nPhysical Status: []
\nMental Status: []
", general_data.fields["fingerprint"], general_data.fields["p_stat"], general_data.fields["m_stat"]) + else + P.info += "General Record Lost!
" + if((istype(security, /datum/data/record) && GLOB.data_core.security.Find(security))) + P.info += text("
\n
Security Data

\nCriminal Status: []", security.fields["criminal"]) + + P.info += "
\n
\nCrimes:
\n" + P.info +={" + + + + + +"} + for(var/datum/data/crime/c in security.fields["crim"]) + P.info += "" + P.info += "" + P.info += "" + P.info += "" + P.info += "" + P.info += "
CrimeDetailsAuthorTime Added
[c.crimeName][c.crimeDetails][c.author][c.time]
" + + P.info += text("
\nImportant Notes:
\n\t[]
\n
\n
Comments/Log

", security.fields["notes"]) + var/counter = 1 + while(security.fields[text("com_[]", counter)]) + P.info += text("[]
", security.fields[text("com_[]", counter)]) + counter++ + P.name = text("SR-[] '[]'", GLOB.data_core.securityPrintCount, general_data.fields["name"]) + else //if no security record + P.info += "Security Record Lost!
" + P.name = text("SR-[] '[]'", GLOB.data_core.securityPrintCount, "Record Lost") + P.info += "" + P.update_appearance() + diff --git a/code/game/machinery/computer/security.dm b/code/game/machinery/computer/security.dm index 99b21fd536c..19e321a9a6d 100644 --- a/code/game/machinery/computer/security.dm +++ b/code/game/machinery/computer/security.dm @@ -549,48 +549,10 @@ 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/P = new /obj/item/paper( loc ) - P.info = "
Security Record - (SR-[GLOB.data_core.securityPrintCount])

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

\nCriminal Status: []", active2.fields["criminal"]) - - P.info += "
\n
\nCrimes:
\n" - P.info +={" - - - - - -"} - for(var/datum/data/crime/c in active2.fields["crim"]) - P.info += "" - P.info += "" - P.info += "" - P.info += "" - P.info += "" - P.info += "
CrimeDetailsAuthorTime Added
[c.crimeName][c.crimeDetails][c.author][c.time]
" - - P.info += text("
\nImportant Notes:
\n\t[]
\n
\n
Comments/Log

", active2.fields["notes"]) - var/counter = 1 - while(active2.fields[text("com_[]", counter)]) - P.info += text("[]
", active2.fields[text("com_[]", counter)]) - counter++ - P.name = text("SR-[] '[]'", GLOB.data_core.securityPrintCount, active1.fields["name"]) - else - P.info += "Security Record Lost!
" - P.name = text("SR-[] '[]'", GLOB.data_core.securityPrintCount, "Record Lost") - P.info += "" - P.update_appearance() + print_security_record(active1, active2, loc) printing = null if("Print Poster") if(!( printing )) diff --git a/code/modules/paperwork/filingcabinet.dm b/code/modules/paperwork/filingcabinet.dm index 126903f8d1a..0db8c0f2359 100644 --- a/code/modules/paperwork/filingcabinet.dm +++ b/code/modules/paperwork/filingcabinet.dm @@ -129,16 +129,7 @@ var/datum/data/record/S = find_record("name", G.fields["name"], GLOB.data_core.security) if(!S) continue - var/obj/item/paper/P = new /obj/item/paper(src) - P.info = "
Security Record

" - P.info += "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"]]
" - P.info += "
\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]"]) - P.info += "[S.fields["com_[counter]"]]
" - counter++ - P.info += "" - P.name = "paper - '[G.fields["name"]]'" + 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.