From a8be3bf0640df55b3d79fd913d7a710cd5642e4e Mon Sep 17 00:00:00 2001 From: nikothedude <59709059+nikothedude@users.noreply.github.com> Date: Wed, 1 Sep 2021 12:18:56 -0400 Subject: [PATCH] Enables sec/med huds to view records on examine, as well as antagonists being able to view exploitables. (#7859) * R.field * i hate modularization * AAAAAAAAAAAAAAAAAAAAAAAA * agony * almost done * h * Delete admins.txt * Add files via upload * Update and rename admins.txt to config/admins.txt * Update admins.txt * rwrwawdaw * fuckfuckfuck * Apply (safe) suggestions from code review not committing all of them, gonna test them on my PC first Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com> * asaaaaaaaaaa dont merge this aaaaaaaaaaa * i hate gitignores with a passion./ * HATE> HATE GITIGNORE. * final tweaks * quite possibly the worst code i have ever written * i forgot to remove this comment * prefs * THE SPAGHETTI CODE IS GONE (also more maintainable) * Update readme.md * why was it unticked * more maintainability Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com> --- code/datums/datacore.dm | 6 + .../mob/living/carbon/human/examine.dm | 15 ++- code/modules/mob/living/carbon/human/human.dm | 111 +++++++++++------- .../antagonists/_common/antag_datum.dm | 30 +++++ modular_skyrat/master_files/readme.md | 1 + .../modules/records_on_examine/readme.md | 36 ++++++ tgstation.dme | 1 + 7 files changed, 155 insertions(+), 45 deletions(-) create mode 100644 modular_skyrat/master_files/code/modules/antagonists/_common/antag_datum.dm create mode 100644 modular_skyrat/modules/records_on_examine/readme.md diff --git a/code/datums/datacore.dm b/code/datums/datacore.dm index f032a357f70..371f5ee9283 100644 --- a/code/datums/datacore.dm +++ b/code/datums/datacore.dm @@ -328,6 +328,12 @@ GLOBAL_DATUM_INIT(data_core, /datum/datacore, new) L.fields["features"] = H.dna.features L.fields["image"] = image L.fields["mindref"] = H.mind + // SKYRAT EDIT ADD BEGIN - EXAMINE RECORDS + if(C && C.prefs && C.prefs.general_record) + L.fields["exp_records"] = C.prefs.exploitable_info //TODO: somebody with less coding anxiety please add a field that stores C.prefs.background_info + else + L.fields["exp_records"] = "" + // SKYRAT EDIT END locked += L return diff --git a/code/modules/mob/living/carbon/human/examine.dm b/code/modules/mob/living/carbon/human/examine.dm index a3e49a694aa..a07e1c81289 100644 --- a/code/modules/mob/living/carbon/human/examine.dm +++ b/code/modules/mob/living/carbon/human/examine.dm @@ -429,6 +429,10 @@ if(R) . += "\[Medical evaluation\]
" . += "\[See quirks\]" + //SKYRAT EDIT ADDITION BEGIN - EXAMINE RECORDS + . += "\[View medical records\]" + . += "\[View general records\]" + //SKYRAT EDIT END if(HAS_TRAIT(user, TRAIT_SECURITY_HUD)) if(!user.stat && user != src) @@ -440,11 +444,13 @@ criminal = R.fields["criminal"] . += "Criminal status: \[[criminal]\]" - . += jointext(list("Security record: \[View\]", + . += jointext(list("Security record: \[View security records\]", //SKYRAT EDIT CHANGE - EXAMINE RECORDS (changed viewsec) "\[Add citation\]", "\[Add crime\]", "\[View comment log\]", "\[Add comment\]"), "") + + . += jointext(list("General record: \[View general records\]"), "") //SKYRAT EDIT ADDITION - EXAMINE RECORDS else if(isobserver(user)) . += "Traits: [get_quirk_string(FALSE, CAT_QUIRK_ALL)]" //SKYRAT EDIT ADDITION BEGIN - GUNPOINT @@ -482,7 +488,12 @@ else . += "[copytext_char(temporary_flavor_text, 1, 37)]... More..." - + //SKYRAT EDIT ADDITION BEGIN - EXAMINE RECORDS + var/datum/data/record/isinworld = find_record("name", perpname, GLOB.data_core.locked) //i dont know of a better way to do this-it doesnt work on off-station roles. please fix this someone better at coding. + for(var/datum/antagonist/antag_datum in user?.mind?.antag_datums) + if ((is_special_character(user)) && isinworld && (antag_datum.view_exploitables)) + . += "\[View exploitable info\]" + //SKYRAT EDIT END //RP RECORDS FOR OBSERVERS if(client && user.client.holder && isobserver(user)) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index f43e4f58768..38176d3557d 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -110,9 +110,11 @@ var/perpname = get_face_name(get_id_name("")) if(!HAS_TRAIT(H, TRAIT_SECURITY_HUD) && !HAS_TRAIT(H, TRAIT_MEDICAL_HUD)) return - var/datum/data/record/R = find_record("name", perpname, GLOB.data_core.general) + var/datum/data/record/general_record = find_record("name", perpname, GLOB.data_core.general) //SKYRAT EDIT ADDITION BEGIN - EXAMINE RECORDS + var/datum/data/record/med_record = find_record("name", perpname, GLOB.data_core.medical) + var/datum/data/record/sec_record = find_record("name", perpname, GLOB.data_core.security)//SKYRAT EDIT ADDITION END if(href_list["photo_front"] || href_list["photo_side"]) - if(!R) + if(!general_record) //SKYRAT EDIT CHANGE - EXAMINE RECORDS return if(!H.canUseHUD()) return @@ -120,9 +122,9 @@ return var/obj/item/photo/P = null if(href_list["photo_front"]) - P = R.fields["photo_front"] + P = general_record.fields["photo_front"] //SKYRAT EDIT CHANGE - EXAMINE RECORDS (note to maintainers: most of these single examine records edits are just me changing R to another variable, in this case, its general_record) else if(href_list["photo_side"]) - P = R.fields["photo_side"] + P = general_record.fields["photo_side"] //SKYRAT EDIT CHANGE - EXAMINE RECORDS if(P) P.show(H) return @@ -180,26 +182,26 @@ to_chat(H, span_warning("ERROR: Invalid access")) return if(href_list["p_stat"]) - var/health_status = input(usr, "Specify a new physical status for this person.", "Medical HUD", R.fields["p_stat"]) in list("Active", "Physically Unfit", "*Unconscious*", "*Deceased*", "Cancel") - if(!R) + var/health_status = input(usr, "Specify a new physical status for this person.", "Medical HUD", general_record.fields["p_stat"]) in list("Active", "Physically Unfit", "*Unconscious*", "*Deceased*", "Cancel") + if(!general_record) //SKYRAT EDIT CHANGE - EXAMINE RECORDS return if(!H.canUseHUD()) return if(!HAS_TRAIT(H, TRAIT_MEDICAL_HUD)) return if(health_status && health_status != "Cancel") - R.fields["p_stat"] = health_status + general_record.fields["p_stat"] = health_status //SKYRAT EDIT CHANGE - EXAMINE RECORDS return if(href_list["m_stat"]) - var/health_status = input(usr, "Specify a new mental status for this person.", "Medical HUD", R.fields["m_stat"]) in list("Stable", "*Watch*", "*Unstable*", "*Insane*", "Cancel") - if(!R) + var/health_status = input(usr, "Specify a new mental status for this person.", "Medical HUD", general_record.fields["m_stat"]) in list("Stable", "*Watch*", "*Unstable*", "*Insane*", "Cancel") + if(!general_record) //SKYRAT EDIT CHANGE - EXAMINE RECORDS return if(!H.canUseHUD()) return if(!HAS_TRAIT(H, TRAIT_MEDICAL_HUD)) return if(health_status && health_status != "Cancel") - R.fields["m_stat"] = health_status + general_record.fields["m_stat"] = health_status //SKYRAT EDIT CHANGE - EXAMINE RECORDS return if(href_list["quirk"]) var/quirkstring = get_quirk_string(TRUE, CAT_QUIRK_ALL) @@ -207,6 +209,12 @@ to_chat(usr, "Detected physiological traits:\n[quirkstring]") else to_chat(usr, "No physiological traits found.") + if(href_list["medrecords"]) + //SKYRAT EDIT ADDITION BEGIN - EXAMINE RECORDS + to_chat(usr, "Medical Record: [med_record.fields["past_records"]]") + if(href_list["genrecords"]) + to_chat(usr, "General Record: [general_record.fields["past_records"]]") + //SKYRAT EDIT END return //Medical HUD ends here. if(href_list["hud"] == "s") @@ -235,31 +243,30 @@ if(!perpname) to_chat(H, span_warning("ERROR: Can not identify target.")) return - R = find_record("name", perpname, GLOB.data_core.security) - if(!R) + if(!sec_record) //SKYRAT EDIT CHANGE - EXAMINE RECORDS to_chat(usr, span_warning("ERROR: Unable to locate data core entry for target.")) return if(href_list["status"]) - var/setcriminal = input(usr, "Specify a new criminal status for this person.", "Security HUD", R.fields["criminal"]) in list("None", "*Arrest*", "Incarcerated", "Paroled", "Discharged", "Cancel") + var/setcriminal = input(usr, "Specify a new criminal status for this person.", "Security HUD", sec_record.fields["criminal"]) in list("None", "*Arrest*", "Incarcerated", "Paroled", "Discharged", "Cancel") //SKYRAT EDIT CHANGE - EXAMINE RECORDS if(setcriminal != "Cancel") - if(!R) + if(!sec_record) //SKYRAT EDIT CHANGE - EXAMINE RECORDS return if(!H.canUseHUD()) return if(!HAS_TRAIT(H, TRAIT_SECURITY_HUD)) return - investigate_log("[key_name(src)] has been set from [R.fields["criminal"]] to [setcriminal] by [key_name(usr)].", INVESTIGATE_RECORDS) - R.fields["criminal"] = setcriminal + investigate_log("[key_name(src)] has been set from [sec_record.fields["criminal"]] to [setcriminal] by [key_name(usr)].", INVESTIGATE_RECORDS) //SKYRAT EDIT CHANGE - EXAMINE RECORDS + sec_record.fields["criminal"] = setcriminal //SKYRAT EDIT CHANGE - EXAMINE RECORDS sec_hud_set_security_status() return - if(href_list["view"]) + if(href_list["viewsec"]) //SKYRAT EDIT CHANGE - EXAMINE RECORDS if(!H.canUseHUD()) return if(!HAS_TRAIT(H, TRAIT_SECURITY_HUD)) return - to_chat(usr, "Name: [R.fields["name"]] Criminal Status: [R.fields["criminal"]]") - for(var/datum/data/crime/c in R.fields["crim"]) + to_chat(usr, "Name: [sec_record.fields["name"]] Criminal Status: [sec_record.fields["criminal"]]") //SKYRAT EDIT CHANGE - EXAMINE RECORDS + for(var/datum/data/crime/c in sec_record.fields["crim"]) //SKYRAT EDIT CHANGE - EXAMINE RECORDS to_chat(usr, "Crime: [c.crimeName]") if (c.crimeDetails) to_chat(usr, "Details: [c.crimeDetails]") @@ -267,14 +274,24 @@ to_chat(usr, "Details: \[Add details]") to_chat(usr, "Added by [c.author] at [c.time]") to_chat(usr, "----------") - to_chat(usr, "Notes: [R.fields["notes"]]") + to_chat(usr, "Notes: [sec_record.fields["notes"]]") //SKYRAT EDIT CHANGE - EXAMINE RECORDS + to_chat(usr, "Security Record: [sec_record.fields["past_records"]]") //SKYRAT EDIT ADDITION - EXAMINE RECORDS return + //SKYRAT EDIT ADDITION BEGIN - EXAMINE RECORDS + if(href_list["genrecords"]) + if(!H.canUseHUD()) + return + if(!HAS_TRAIT(H, TRAIT_SECURITY_HUD)) + return + to_chat(usr, "General Record: [general_record.fields["past_records"]]") + //SKYRAT EDIT END + if(href_list["add_citation"]) var/maxFine = CONFIG_GET(number/maxfine) var/t1 = stripped_input("Please input citation crime:", "Security HUD", "", null) var/fine = FLOOR(input("Please input citation fine, up to [maxFine]:", "Security HUD", 50) as num|null, 1) - if(!R || !t1 || !fine || !allowed_access) + if(!sec_record || !t1 || !fine || !allowed_access) //SKYRAT EDIT CHANGE - EXAMINE RECORDS return if(!H.canUseHUD()) return @@ -287,7 +304,7 @@ var/datum/data/crime/crime = GLOB.data_core.createCrimeEntry(t1, "", allowed_access, station_time_timestamp(), fine) for (var/obj/item/pda/P in GLOB.PDAs) - if(P.owner == R.fields["name"]) + if(P.owner == sec_record.fields["name"]) //SKYRAT EDIT CHANGE - EXAMINE RECORDS var/message = "You have been fined [fine] credits for '[t1]'. Fines may be paid at security." var/datum/signal/subspace/messaging/pda/signal = new(src, list( "name" = "Security Citation", @@ -298,36 +315,36 @@ )) signal.send_to_receivers() usr.log_message("(PDA: Citation Server) sent \"[message]\" to [signal.format_target()]", LOG_PDA) - GLOB.data_core.addCitation(R.fields["id"], crime) - investigate_log("New Citation: [t1] Fine: [fine] | Added to [R.fields["name"]] by [key_name(usr)]", INVESTIGATE_RECORDS) - SSblackbox.ReportCitation(crime.dataId, usr.ckey, usr.real_name, R.fields["name"], t1, fine) + GLOB.data_core.addCitation(sec_record.fields["id"], crime) //SKYRAT EDIT CHANGE - EXAMINE RECORDS + investigate_log("New Citation: [t1] Fine: [fine] | Added to [sec_record.fields["name"]] by [key_name(usr)]", INVESTIGATE_RECORDS) //SKYRAT EDIT CHANGE - EXAMINE RECORDS + SSblackbox.ReportCitation(crime.dataId, usr.ckey, usr.real_name, sec_record.fields["name"], t1, fine) //SKYRAT EDIT CHANGE - EXAMINE RECORDS return if(href_list["add_crime"]) var/t1 = stripped_input("Please input crime name:", "Security HUD", "", null) - if(!R || !t1 || !allowed_access) + if(!sec_record || !t1 || !allowed_access) //SKYRAT EDIT CHANGE - EXAMINE RECORDS return if(!H.canUseHUD()) return if(!HAS_TRAIT(H, TRAIT_SECURITY_HUD)) return var/crime = GLOB.data_core.createCrimeEntry(t1, null, allowed_access, station_time_timestamp()) - GLOB.data_core.addCrime(R.fields["id"], crime) - investigate_log("New Crime: [t1] | Added to [R.fields["name"]] by [key_name(usr)]", INVESTIGATE_RECORDS) + GLOB.data_core.addCrime(sec_record.fields["id"], crime) //SKYRAT EDIT CHANGE - EXAMINE RECORDS + investigate_log("New Crime: [t1] | Added to [sec_record.fields["name"]] by [key_name(usr)]", INVESTIGATE_RECORDS) //SKYRAT EDIT CHANGE - EXAMINE RECORDS to_chat(usr, span_notice("Successfully added a crime.")) return if(href_list["add_details"]) var/t1 = stripped_input(usr, "Please input crime details:", "Secure. records", "", null) - if(!R || !t1 || !allowed_access) + if(!sec_record || !t1 || !allowed_access) //SKYRAT EDIT CHANGE - EXAMINE RECORDS return if(!H.canUseHUD()) return if(!HAS_TRAIT(H, TRAIT_SECURITY_HUD)) return if(href_list["cdataid"]) - GLOB.data_core.addCrimeDetails(R.fields["id"], href_list["cdataid"], t1) - investigate_log("New Crime details: [t1] | Added to [R.fields["name"]] by [key_name(usr)]", INVESTIGATE_RECORDS) + GLOB.data_core.addCrimeDetails(sec_record.fields["id"], href_list["cdataid"], t1) //SKYRAT EDIT CHANGE - EXAMINE RECORDS + investigate_log("New Crime details: [t1] | Added to [sec_record.fields["name"]] by [key_name(usr)]", INVESTIGATE_RECORDS) //SKYRAT EDIT CHANGE - EXAMINE RECORDS to_chat(usr, span_notice("Successfully added details.")) return @@ -338,29 +355,36 @@ return to_chat(usr, "Comments/Log:") var/counter = 1 - while(R.fields[text("com_[]", counter)]) - to_chat(usr, R.fields[text("com_[]", counter)]) + while(sec_record.fields[text("com_[]", counter)]) //SKYRAT EDIT CHANGE - EXAMINE RECORDS + to_chat(usr, sec_record.fields[text("com_[]", counter)]) //SKYRAT EDIT CHANGE - EXAMINE RECORDS to_chat(usr, "----------") counter++ return if(href_list["add_comment"]) var/t1 = stripped_multiline_input("Add Comment:", "Secure. records", null, null) - if (!R || !t1 || !allowed_access) + if (!sec_record || !t1 || !allowed_access) //SKYRAT EDIT CHANGE - EXAMINE RECORDS return if(!H.canUseHUD()) return if(!HAS_TRAIT(H, TRAIT_SECURITY_HUD)) return var/counter = 1 - while(R.fields[text("com_[]", counter)]) + while(sec_record.fields[text("com_[]", counter)]) //SKYRAT EDIT CHANGE - EXAMINE RECORDS counter++ - R.fields[text("com_[]", counter)] = text("Made by [] on [] [], []
[]", allowed_access, station_time_timestamp(), time2text(world.realtime, "MMM DD"), GLOB.year_integer+540, t1) + sec_record.fields[text("com_[]", counter)] = text("Made by [] on [] [], []
[]", allowed_access, station_time_timestamp(), time2text(world.realtime, "MMM DD"), GLOB.year_integer+540, t1) //SKYRAT EDIT CHANGE - EXAMINE RECORDS to_chat(usr, span_notice("Successfully added comment.")) return - ..() //end of this massive fucking chain. TODO: make the hud chain not spooky. - Yeah, great job doing that. + //SKYRAT EDIT ADDITION BEGIN - VIEW RECORDS + if (is_special_character(usr)) + var/perpname = get_face_name(get_id_name("")) + var/datum/data/record/EXP = find_record("name", perpname, GLOB.data_core.locked) + if(href_list["exprecords"]) + to_chat(usr, "Exploitable information: [EXP.fields["exp_records"]]") + //SKYRAT EDIT END + ..() //end of this massive fucking chain. TODO: make the hud chain not spooky. - Yeah, great job doing that. /mob/living/carbon/human/proc/canUseHUD() return (mobility_flags & MOBILITY_USE) @@ -433,9 +457,10 @@ //Check for arrest warrant if(judgement_criteria & JUDGE_RECORDCHECK) var/perpname = get_face_name(get_id_name()) - var/datum/data/record/R = find_record("name", perpname, GLOB.data_core.security) - if(R?.fields["criminal"]) - switch(R.fields["criminal"]) + var/datum/data/record/sec_record = find_record("name", perpname, GLOB.data_core.security) //SKYRAT EDIT CHANGE - EXAMINE RECORDS + + if(sec_record?.fields["criminal"]) //SKYRAT EDIT CHANGE - EXAMINE RECORDS + switch(sec_record.fields["criminal"]) //SKYRAT EDIT CHANGE - EXAMINE RECORDS if("*Arrest*") threatcount += 5 if("Incarcerated") @@ -695,9 +720,9 @@ /mob/living/carbon/human/replace_records_name(oldname,newname) // Only humans have records right now, move this up if changed. for(var/list/L in list(GLOB.data_core.general,GLOB.data_core.medical,GLOB.data_core.security,GLOB.data_core.locked)) - var/datum/data/record/R = find_record("name", oldname, L) - if(R) - R.fields["name"] = newname + var/datum/data/record/general_record = find_record("name", oldname, L) + if(general_record) + general_record.fields["name"] = newname /mob/living/carbon/human/get_total_tint() . = ..() diff --git a/modular_skyrat/master_files/code/modules/antagonists/_common/antag_datum.dm b/modular_skyrat/master_files/code/modules/antagonists/_common/antag_datum.dm new file mode 100644 index 00000000000..fbeb97bc687 --- /dev/null +++ b/modular_skyrat/master_files/code/modules/antagonists/_common/antag_datum.dm @@ -0,0 +1,30 @@ +/datum/antagonist + //Should this antagonist be allowed to view exploitable information? + var/view_exploitables = FALSE + +/datum/antagonist/heretic + view_exploitables = TRUE + +/datum/antagonist/changeling + view_exploitables = TRUE + +/datum/antagonist/obsessed + view_exploitables = TRUE + +/datum/antagonist/ninja + view_exploitables = TRUE + +/datum/antagonist/wizard + view_exploitables = TRUE + +/datum/antagonist/brother + view_exploitables = TRUE + +/datum/antagonist/malf_ai + view_exploitables = TRUE + +/datum/antagonist/revenant + view_exploitables = TRUE + +/datum/antagonist/traitor + view_exploitables = TRUE diff --git a/modular_skyrat/master_files/readme.md b/modular_skyrat/master_files/readme.md index 2e30e90fcf8..d568ac2ce57 100644 --- a/modular_skyrat/master_files/readme.md +++ b/modular_skyrat/master_files/readme.md @@ -26,6 +26,7 @@ MASTER CODE FILES - /master_files/code/modules/mob/living/emote_popup.dm - /master_files/code/game/machinery/doors/firedoor.dm - /master_files/code/modules/jobs/job_types/cyborg.dm +- /master_files/code/modules/antagonists/_common/antag_datum.dm MASTER GLOBAL VARS - modular_skyrat/master_files/code/_globalvars/configuration.dm > GLOBAL_VAR_INIT(looc_allowed, TRUE) diff --git a/modular_skyrat/modules/records_on_examine/readme.md b/modular_skyrat/modules/records_on_examine/readme.md new file mode 100644 index 00000000000..4455f285316 --- /dev/null +++ b/modular_skyrat/modules/records_on_examine/readme.md @@ -0,0 +1,36 @@ +https://github.com/Skyrat-SS13/Skyrat-tg/pull/7859 + +## Title: Enables sec/med huds to view records on examine, as well as antagonists being able to view exploitables. + +MODULE ID: records_on_examine + +### Description: + +This PR allows med/sec huds to view medical/security records on examine, respectively, as well as allowing you to view general records. It +also allows certain antags to view exploitables on examine as well. + +Originally I planned to add a PDA program to allow all crew to view general +records, and a OOC verb to allow antags to view exploitables of the entire crew, as well as a way for background info to be seen, however +I am not that good at coding and chickened out. + +### TG Proc/File Changes: + +EDIT: examine.dm, human.dm, datacore.dm. Modified the behavior of examining things while wearing HUDs, and the behavior of examining as +certain antagonists in examine.dm. Added a few variables that store records to human.dm, added the functionality to the new links +acquired by examining. Added a field for exploitables in the locked record section of datacore.dm. + +### Defines: + +- N/A + +### Master file additions + +- code/modules/antagonists/_common/antag_datum.dm + +### Included files that are not contained in this module: + +- N/A + +### Credits: + +Niko#7526, and #development_discuss for giving me the help I needed diff --git a/tgstation.dme b/tgstation.dme index be325ba602d..c86ff49749f 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -3894,6 +3894,7 @@ #include "modular_skyrat\master_files\code\game\objects\structures\tables_racks.dm" #include "modular_skyrat\master_files\code\game\objects\structures\trash_pile.dm" #include "modular_skyrat\master_files\code\modules\admin\admin.dm" +#include "modular_skyrat\master_files\code\modules\antagonists\_common\antag_datum.dm" #include "modular_skyrat\master_files\code\modules\antagonists\ert\ert.dm" #include "modular_skyrat\master_files\code\modules\antagonists\nukeop\equipment\nuclearbomb.dm" #include "modular_skyrat\master_files\code\modules\antagonists\wizard\equipment\spellbook.dm"