[MIRROR] unifies security record printing [MDB IGNORE] (#15481)

* unifies security record printing

* unifies security record printing

Co-authored-by: ShizCalev <ShizCalev@users.noreply.github.com>
Co-authored-by: Tom <8881105+tf-4@users.noreply.github.com>
This commit is contained in:
SkyratBot
2022-08-17 15:53:15 +01:00
committed by GitHub
co-authored by ShizCalev Tom
parent 6a1ccb2474
commit f0b6a4e4b4
3 changed files with 64 additions and 64 deletions
+59
View File
@@ -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 = "<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)))
final_paper_text += text("Name: [] ID: []<BR>\nGender: []<BR>\nAge: []<BR>", general_data.fields["name"], general_data.fields["id"], general_data.fields["gender"], general_data.fields["age"])
final_paper_text += "\nSpecies: [general_data.fields["species"]]<BR>"
final_paper_text += text("\nFingerprint: []<BR>\nPhysical Status: []<BR>\nMental Status: []<BR>", 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 += "<B>General Record Lost!</B><BR>"
if((istype(security, /datum/data/record) && GLOB.data_core.security.Find(security)))
//final_paper_text += text("<BR>\n<CENTER><B>Security Data</B></CENTER><BR>\nCriminal Status: []", security.fields["criminal"]) // ORIGINAL
//SKYRAT EDIT ADDITION START - RP RECORDS
final_paper_text += text("<BR>\n<CENTER><B>Security Data</B></CENTER><BR>\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 += "<BR>\n<BR>\nCrimes:<BR>\n"
final_paper_text +={"<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"])
final_paper_text += "<tr><td>[c.crimeName]</td>"
final_paper_text += "<td>[c.crimeDetails]</td>"
final_paper_text += "<td>[c.author]</td>"
final_paper_text += "<td>[c.time]</td>"
final_paper_text += "</tr>"
final_paper_text += "</table>"
final_paper_text += 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)])
final_paper_text += text("[]<BR>", 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 += "<B>Security Record Lost!</B><BR>"
printed_paper.name = text("SR-[] '[]'", GLOB.data_core.securityPrintCount, "Record Lost")
final_paper_text += "</TT>"
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.
+4 -52
View File
@@ -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 = "<CENTER><B>Security Record - (SR-[GLOB.data_core.securityPrintCount])</B></CENTER><BR>"
if((istype(active1, /datum/data/record) && GLOB.data_core.general.Find(active1)))
final_paper_text += text("Name: [] ID: []<BR>\nGender: []<BR>\nAge: []<BR>", active1.fields["name"], active1.fields["id"], active1.fields["gender"], active1.fields["age"])
final_paper_text += "\nSpecies: [active1.fields["species"]]<BR>"
final_paper_text += text("\nFingerprint: []<BR>\nPhysical Status: []<BR>\nMental Status: []<BR>", 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 += "<B>General Record Lost!</B><BR>"
if((istype(active2, /datum/data/record) && GLOB.data_core.security.Find(active2)))
// final_paper_text += text("<BR>\n<CENTER><B>Security Data</B></CENTER><BR>\nCriminal Status: []", active2.fields["criminal"]) // SKYRAT EDIT ORIGINAL
//SKYRAT EDIT ADDITION START - RP RECORDS
final_paper_text += text("<BR>\n<CENTER><B>Security Data</B></CENTER><BR>\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 += "<BR>\n<BR>\nCrimes:<BR>\n"
final_paper_text +={"<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"])
final_paper_text += "<tr><td>[c.crimeName]</td>"
final_paper_text += "<td>[c.crimeDetails]</td>"
final_paper_text += "<td>[c.author]</td>"
final_paper_text += "<td>[c.time]</td>"
final_paper_text += "</tr>"
final_paper_text += "</table>"
final_paper_text += 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)])
final_paper_text += text("[]<BR>", active2.fields[text("com_[]", counter)])
counter++
printed_paper.name = text("SR-[] '[]'", GLOB.data_core.securityPrintCount, active1.fields["name"])
else
final_paper_text += "<B>Security Record Lost!</B><BR>"
printed_paper.name = text("SR-[] '[]'", GLOB.data_core.securityPrintCount, "Record Lost")
final_paper_text += "</TT>"
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"])
+1 -12
View File
@@ -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 = "<CENTER><B>Security Record</B></CENTER><BR>"
sec_record_text += "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>"
sec_record_text += "<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]"])
sec_record_text += "[S.fields["com_[counter]"]]<BR>"
counter++
sec_record_text += "</TT>"
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.