unifies security record printing

This commit is contained in:
ShizCalev
2022-08-01 18:58:41 -04:00
parent bbca2d3841
commit 14a0dca7ae
3 changed files with 51 additions and 51 deletions
+47
View File
@@ -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 = "<CENTER><B>Security Record - (SR-[GLOB.data_core.securityPrintCount])</B></CENTER><BR>"
if((istype(general_data, /datum/data/record) && GLOB.data_core.general.Find(general_data)))
P.info += text("Name: [] ID: []<BR>\nGender: []<BR>\nAge: []<BR>", general_data.fields["name"], general_data.fields["id"], general_data.fields["gender"], general_data.fields["age"])
P.info += "\nSpecies: [general_data.fields["species"]]<BR>"
P.info += text("\nFingerprint: []<BR>\nPhysical Status: []<BR>\nMental Status: []<BR>", general_data.fields["fingerprint"], general_data.fields["p_stat"], general_data.fields["m_stat"])
else
P.info += "<B>General Record Lost!</B><BR>"
if((istype(security, /datum/data/record) && GLOB.data_core.security.Find(security)))
P.info += text("<BR>\n<CENTER><B>Security Data</B></CENTER><BR>\nCriminal Status: []", security.fields["criminal"])
P.info += "<BR>\n<BR>\nCrimes:<BR>\n"
P.info +={"<table style="text-align:center;" border="1" cellspacing="0" width="100%">
<tr>
<th>Crime</th>
<th>Details</th>
<th>Author</th>
<th>Time Added</th>
</tr>"}
for(var/datum/data/crime/c in security.fields["crim"])
P.info += "<tr><td>[c.crimeName]</td>"
P.info += "<td>[c.crimeDetails]</td>"
P.info += "<td>[c.author]</td>"
P.info += "<td>[c.time]</td>"
P.info += "</tr>"
P.info += "</table>"
P.info += text("<BR>\nImportant Notes:<BR>\n\t[]<BR>\n<BR>\n<CENTER><B>Comments/Log</B></CENTER><BR>", security.fields["notes"])
var/counter = 1
while(security.fields[text("com_[]", counter)])
P.info += text("[]<BR>", 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 += "<B>Security Record Lost!</B><BR>"
P.name = text("SR-[] '[]'", GLOB.data_core.securityPrintCount, "Record Lost")
P.info += "</TT>"
P.update_appearance()
+3 -41
View File
@@ -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 = "<CENTER><B>Security Record - (SR-[GLOB.data_core.securityPrintCount])</B></CENTER><BR>"
if((istype(active1, /datum/data/record) && GLOB.data_core.general.Find(active1)))
P.info += text("Name: [] ID: []<BR>\nGender: []<BR>\nAge: []<BR>", active1.fields["name"], active1.fields["id"], active1.fields["gender"], active1.fields["age"])
P.info += "\nSpecies: [active1.fields["species"]]<BR>"
P.info += text("\nFingerprint: []<BR>\nPhysical Status: []<BR>\nMental Status: []<BR>", active1.fields["fingerprint"], active1.fields["p_stat"], active1.fields["m_stat"])
else
P.info += "<B>General Record Lost!</B><BR>"
if((istype(active2, /datum/data/record) && GLOB.data_core.security.Find(active2)))
P.info += text("<BR>\n<CENTER><B>Security Data</B></CENTER><BR>\nCriminal Status: []", active2.fields["criminal"])
P.info += "<BR>\n<BR>\nCrimes:<BR>\n"
P.info +={"<table style="text-align:center;" border="1" cellspacing="0" width="100%">
<tr>
<th>Crime</th>
<th>Details</th>
<th>Author</th>
<th>Time Added</th>
</tr>"}
for(var/datum/data/crime/c in active2.fields["crim"])
P.info += "<tr><td>[c.crimeName]</td>"
P.info += "<td>[c.crimeDetails]</td>"
P.info += "<td>[c.author]</td>"
P.info += "<td>[c.time]</td>"
P.info += "</tr>"
P.info += "</table>"
P.info += text("<BR>\nImportant Notes:<BR>\n\t[]<BR>\n<BR>\n<CENTER><B>Comments/Log</B></CENTER><BR>", active2.fields["notes"])
var/counter = 1
while(active2.fields[text("com_[]", counter)])
P.info += text("[]<BR>", active2.fields[text("com_[]", counter)])
counter++
P.name = text("SR-[] '[]'", GLOB.data_core.securityPrintCount, active1.fields["name"])
else
P.info += "<B>Security Record Lost!</B><BR>"
P.name = text("SR-[] '[]'", GLOB.data_core.securityPrintCount, "Record Lost")
P.info += "</TT>"
P.update_appearance()
print_security_record(active1, active2, loc)
printing = null
if("Print Poster")
if(!( printing ))
+1 -10
View File
@@ -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 = "<CENTER><B>Security Record</B></CENTER><BR>"
P.info += "Name: [G.fields["name"]] ID: [G.fields["id"]]<BR>\nGender: [G.fields["gender"]]<BR>\nAge: [G.fields["age"]]<BR>\nFingerprint: [G.fields["fingerprint"]]<BR>\nPhysical Status: [G.fields["p_stat"]]<BR>\nMental Status: [G.fields["m_stat"]]<BR>"
P.info += "<BR>\n<CENTER><B>Security Data</B></CENTER><BR>\nCriminal Status: [S.fields["criminal"]]<BR>\n<BR>\nCrimes: [S.fields["crim"]]<BR>\nDetails: [S.fields["crim_d"]]<BR>\n<BR>\nImportant Notes:<BR>\n\t[S.fields["notes"]]<BR>\n<BR>\n<CENTER><B>Comments/Log</B></CENTER><BR>"
var/counter = 1
while(S.fields["com_[counter]"])
P.info += "[S.fields["com_[counter]"]]<BR>"
counter++
P.info += "</TT>"
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.