diff --git a/code/__DEFINES/hud.dm b/code/__DEFINES/hud.dm index 4a1e4f20f98..f4d5b9f5b1c 100644 --- a/code/__DEFINES/hud.dm +++ b/code/__DEFINES/hud.dm @@ -61,3 +61,11 @@ #define NOTIFY_JUMP "jump" #define NOTIFY_ATTACK "attack" #define NOTIFY_FOLLOW "orbit" + + +// The kind of things granted by HUD items in game, that do not manifest as +// on-screen icons, but rather go to examine text. +#define EXAMINE_HUD_SECURITY_READ "security_read" +#define EXAMINE_HUD_SECURITY_WRITE "security_write" +#define EXAMINE_HUD_MEDICAL "medical" +#define EXAMINE_HUD_SKILLS "skills" diff --git a/code/game/data_huds.dm b/code/game/data_huds.dm index 6bd00d286fe..e21d2ed5b43 100644 --- a/code/game/data_huds.dm +++ b/code/game/data_huds.dm @@ -446,3 +446,37 @@ holder.icon_state = "" return holder.icon_state = "hudweed[RoundPlantBar(weedlevel/10)]" + +/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + I'll just put this somewhere near the end... +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ + +/// Helper function to add a "comment" to a data record. Used for medical or security records. +/mob/living/carbon/human/proc/add_comment(mob/commenter, comment_kind, comment_text) + var/perpname = get_visible_name(TRUE) //gets the name of the perp, works if they have an id or if their face is uncovered + if(!perpname) + return + var/datum/data/record/R + switch(comment_kind) + if("security") + R = find_record("name", perpname, GLOB.data_core.security) + if("medical") + R = find_record("name", perpname, GLOB.data_core.medical) + if(!R) + return + + var/commenter_display = "Something(???)" + if(ishuman(commenter)) + var/mob/living/carbon/human/U = commenter + commenter_display = "[U.get_authentification_name()] ([U.get_assignment()])" + else if(isrobot(commenter)) + var/mob/living/silicon/robot/U = commenter + commenter_display = "[U.name] ([U.modtype] [U.braintype])" + else if(isAI(commenter)) + var/mob/living/silicon/ai/U = commenter + commenter_display = "[U.name] (artificial intelligence)" + comment_text = "Made by [commenter_display] on [GLOB.current_date_string] [station_time_timestamp()]:
[comment_text]" + + if(!R.fields["comments"]) + R.fields["comments"] = list() + R.fields["comments"] += list(comment_text) diff --git a/code/modules/clothing/glasses/hud.dm b/code/modules/clothing/glasses/hud.dm index e52f5c303be..04d603631d4 100644 --- a/code/modules/clothing/glasses/hud.dm +++ b/code/modules/clothing/glasses/hud.dm @@ -3,9 +3,11 @@ desc = "A heads-up display that provides important info in (almost) real time." flags = null //doesn't protect eyes because it's a monocle, duh origin_tech = "magnets=3;biotech=2" - var/HUDType = null //Hudtype is defined on glasses.dm prescription_upgradable = 1 - var/list/icon/current = list() //the current hud icons + /// The visual icons granted by wearing these glasses. + var/HUDType = null + /// List of things added to examine text, like security or medical records. + var/list/examine_extensions = null /obj/item/clothing/glasses/hud/equipped(mob/living/carbon/human/user, slot) @@ -31,6 +33,7 @@ icon_state = "healthhud" origin_tech = "magnets=3;biotech=2" HUDType = DATA_HUD_MEDICAL_ADVANCED + examine_extensions = list(EXAMINE_HUD_MEDICAL) sprite_sheets = list( "Vox" = 'icons/mob/species/vox/eyes.dmi', @@ -94,7 +97,7 @@ origin_tech = "magnets=3;combat=2" var/global/list/jobs[0] HUDType = DATA_HUD_SECURITY_ADVANCED - var/read_only = FALSE + examine_extensions = list(EXAMINE_HUD_SECURITY_READ, EXAMINE_HUD_SECURITY_WRITE) sprite_sheets = list( "Vox" = 'icons/mob/species/vox/eyes.dmi', @@ -121,7 +124,7 @@ prescription_upgradable = 0 /obj/item/clothing/glasses/hud/security/sunglasses/read_only - read_only = TRUE + examine_extensions = list(EXAMINE_HUD_SECURITY_READ) /obj/item/clothing/glasses/hud/security/sunglasses name = "HUDSunglasses" @@ -202,6 +205,8 @@ desc = "A heads-up display capable of showing the employment history records of NT crew members." icon_state = "skill" item_state = "glasses" + HUDType = DATA_HUD_SECURITY_BASIC + examine_extensions = list(EXAMINE_HUD_SKILLS) sprite_sheets = list( "Drask" = 'icons/mob/species/drask/eyes.dmi', "Grey" = 'icons/mob/species/grey/eyes.dmi', diff --git a/code/modules/examine/examine.dm b/code/modules/examine/examine.dm index f39cb562ec8..3a45529958a 100644 --- a/code/modules/examine/examine.dm +++ b/code/modules/examine/examine.dm @@ -34,7 +34,7 @@ return ..() /mob/living/carbon/human/get_description_fluff() - return print_flavor_text(0) + return print_flavor_text() /* The examine panel itself */ diff --git a/code/modules/mob/living/carbon/human/examine.dm b/code/modules/mob/living/carbon/human/examine.dm index fbaaeb124b3..4e3bbfcabfd 100644 --- a/code/modules/mob/living/carbon/human/examine.dm +++ b/code/modules/mob/living/carbon/human/examine.dm @@ -347,7 +347,7 @@ if(decaylevel == 4) msg += "[p_they(TRUE)] [p_are()] mostly desiccated now, with only bones remaining of what used to be a person.\n" - if(hasHUD(user,"security")) + if(hasHUD(user, EXAMINE_HUD_SECURITY_READ)) var/perpname = get_visible_name(TRUE) var/criminal = "None" var/commentLatest = "ERROR: Unable to locate a data core entry for this person." //If there is no datacore present, give this @@ -364,12 +364,12 @@ else commentLatest = "No entries." //If present but without entries (=target is recognized crew) - var/criminal_status = hasHUD(user, "read_only_security") ? "\[[criminal]\]" : "\[[criminal]\]" + var/criminal_status = hasHUD(user, EXAMINE_HUD_SECURITY_WRITE) ? "\[[criminal]\]" : "\[[criminal]\]" msg += "Criminal status: [criminal_status]\n" msg += "Security records: \[View comment log\] \[Add comment\]\n" msg += "Latest entry: [commentLatest]\n" - if(hasHUD(user, "skills")) + if(hasHUD(user, EXAMINE_HUD_SKILLS)) var/perpname = get_visible_name(TRUE) var/skills @@ -378,9 +378,14 @@ if(E.fields["name"] == perpname) skills = E.fields["notes"] if(skills) - msg += "Employment records: [skills]\n" + var/char_limit = 40 + if(length(skills) <= char_limit) + msg += "Employment records: [skills]\n" + else + msg += "Employment records: [copytext_preserve_html(skills, 1, char_limit-3)]...More...\n" - if(hasHUD(user,"medical")) + + if(hasHUD(user,EXAMINE_HUD_MEDICAL)) var/perpname = get_visible_name(TRUE) var/medical = "None" @@ -408,45 +413,31 @@ . = list(msg) //Helper procedure. Called by /mob/living/carbon/human/examine() and /mob/living/carbon/human/Topic() to determine HUD access to security and medical records. -/proc/hasHUD(mob/M as mob, hudtype) +/proc/hasHUD(mob/M, hudtype) if(istype(M, /mob/living/carbon/human)) + var/have_hudtypes = list() var/mob/living/carbon/human/H = M + + if(istype(H.glasses, /obj/item/clothing/glasses/hud)) + var/obj/item/clothing/glasses/hud/hudglasses = H.glasses + if(hudglasses?.examine_extensions) + have_hudtypes += hudglasses.examine_extensions + var/obj/item/organ/internal/cyberimp/eyes/hud/CIH = H.get_int_organ(/obj/item/organ/internal/cyberimp/eyes/hud) - switch(hudtype) - if("security") - return istype(H.glasses, /obj/item/clothing/glasses/hud/security) || istype(CIH,/obj/item/organ/internal/cyberimp/eyes/hud/security) - if("read_only_security") - var/obj/item/clothing/glasses/hud/security/S - if(istype(H.glasses, /obj/item/clothing/glasses/hud/security)) - S = H.glasses - return !istype(CIH,/obj/item/organ/internal/cyberimp/eyes/hud/security) && S && S.read_only - if("medical") - return istype(H.glasses, /obj/item/clothing/glasses/hud/health) || istype(CIH,/obj/item/organ/internal/cyberimp/eyes/hud/medical) - if("skills") - return istype(H.glasses, /obj/item/clothing/glasses/hud/skills) - else - return FALSE + if(CIH?.examine_extensions) + have_hudtypes += CIH.examine_extensions + + return (hudtype in have_hudtypes) else if(isrobot(M) || isAI(M)) //Stand-in/Stopgap to prevent pAIs from freely altering records, pending a more advanced Records system - switch(hudtype) - if("security") - return TRUE - if("medical") - return TRUE - else - return FALSE + return (hudtype in list(EXAMINE_HUD_SECURITY_READ, EXAMINE_HUD_SECURITY_WRITE, EXAMINE_HUD_MEDICAL)) + else if(isobserver(M)) var/mob/dead/observer/O = M if(O.data_hud_seen == DATA_HUD_SECURITY_ADVANCED || O.data_hud_seen == DATA_HUD_DIAGNOSTIC + DATA_HUD_SECURITY_ADVANCED + DATA_HUD_MEDICAL_ADVANCED) - switch(hudtype) - if("security") - return TRUE - if("skills") - return TRUE - else - return FALSE - else - return FALSE + return (hudtype in list(EXAMINE_HUD_SECURITY_READ, EXAMINE_HUD_SKILLS)) + + return FALSE // Ignores robotic limb branding prefixes like "Morpheus Cybernetics" /proc/ignore_limb_branding(limb_name) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 2f2c4da0f11..7972edcb69d 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -730,7 +730,7 @@ update_inv_w_uniform() if(href_list["criminal"]) - if(hasHUD(usr,"security")) + if(hasHUD(usr, EXAMINE_HUD_SECURITY_WRITE)) if(usr.incapacitated()) return var/found_record = 0 @@ -747,7 +747,7 @@ if(!t1) t1 = "(none)" - if(hasHUD(usr, "security") && setcriminal != "Cancel") + if(hasHUD(usr, EXAMINE_HUD_SECURITY_WRITE) && setcriminal != "Cancel") found_record = 1 if(R.fields["criminal"] == SEC_RECORD_STATUS_EXECUTE) to_chat(usr, "Unable to modify the sec status of a person with an active Execution order. Use a security computer instead.") @@ -770,7 +770,7 @@ to_chat(usr, "Unable to locate a data core entry for this person.") if(href_list["secrecord"]) - if(hasHUD(usr,"security")) + if(hasHUD(usr, EXAMINE_HUD_SECURITY_READ)) if(usr.incapacitated()) return var/perpname = get_visible_name(TRUE) @@ -780,7 +780,7 @@ if(E.fields["name"] == perpname) for(var/datum/data/record/R in GLOB.data_core.security) if(R.fields["id"] == E.fields["id"]) - if(hasHUD(usr,"security")) + if(hasHUD(usr, EXAMINE_HUD_SECURITY_READ)) to_chat(usr, "Name: [R.fields["name"]] Criminal Status: [R.fields["criminal"]]") to_chat(usr, "Minor Crimes: [R.fields["mi_crim"]]") to_chat(usr, "Details: [R.fields["mi_crim_d"]]") @@ -794,7 +794,7 @@ to_chat(usr, "Unable to locate a data core entry for this person.") if(href_list["secrecordComment"]) - if(hasHUD(usr,"security")) + if(hasHUD(usr, EXAMINE_HUD_SECURITY_READ)) if(usr.incapacitated() && !isobserver(usr)) //give the ghosts access to "View Comment Log" while they can't manipulate it return var/perpname = get_visible_name(TRUE) @@ -804,44 +804,30 @@ if(E.fields["name"] == perpname) for(var/datum/data/record/R in GLOB.data_core.security) if(R.fields["id"] == E.fields["id"]) - if(hasHUD(usr,"security")) + if(hasHUD(usr, EXAMINE_HUD_SECURITY_READ)) read = 1 if(LAZYLEN(R.fields["comments"])) for(var/c in R.fields["comments"]) to_chat(usr, c) else to_chat(usr, "No comments found") - to_chat(usr, "\[Add comment\]") + if(hasHUD(usr, EXAMINE_HUD_SECURITY_WRITE)) + to_chat(usr, "\[Add comment\]") if(!read) to_chat(usr, "Unable to locate a data core entry for this person.") if(href_list["secrecordadd"]) - if(hasHUD(usr,"security")) - if(usr.incapacitated()) - return - var/perpname = get_visible_name(TRUE) - - for(var/datum/data/record/E in GLOB.data_core.general) - if(E.fields["name"] == perpname) - for(var/datum/data/record/R in GLOB.data_core.security) - if(R.fields["id"] == E.fields["id"]) - if(hasHUD(usr,"security")) - var/t1 = copytext(trim(sanitize(input("Add Comment:", "Sec. records", null, null) as message)), 1, MAX_MESSAGE_LEN) - if(!t1 || usr.stat || usr.restrained() || !hasHUD(usr, "security")) - return - if(ishuman(usr)) - var/mob/living/carbon/human/U = usr - R.fields["comments"] += "Made by [U.get_authentification_name()] ([U.get_assignment()]) on [GLOB.current_date_string] [station_time_timestamp()]
[t1]" - if(isrobot(usr)) - var/mob/living/silicon/robot/U = usr - R.fields["comments"] += "Made by [U.name] ([U.modtype] [U.braintype]) on [GLOB.current_date_string] [station_time_timestamp()]
[t1]" - if(isAI(usr)) - var/mob/living/silicon/ai/U = usr - R.fields["comments"] += "Made by [U.name] (artificial intelligence) on [GLOB.current_date_string] [station_time_timestamp()]
[t1]" + if(usr.incapacitated() || !hasHUD(usr, EXAMINE_HUD_SECURITY_WRITE)) + return + var/raw_input = input("Add Comment:", "Security records", null, null) as message + var/sanitized = copytext(trim(sanitize(raw_input)), 1, MAX_MESSAGE_LEN) + if(!sanitized || usr.stat || usr.restrained() || !hasHUD(usr, EXAMINE_HUD_SECURITY_WRITE)) + return + add_comment(usr, "security", sanitized) if(href_list["medical"]) - if(hasHUD(usr,"medical")) + if(hasHUD(usr, EXAMINE_HUD_MEDICAL)) if(usr.incapacitated()) return var/modified = 0 @@ -853,7 +839,7 @@ if(R.fields["id"] == E.fields["id"]) var/setmedical = input(usr, "Specify a new medical status for this person.", "Medical HUD", R.fields["p_stat"]) in list("*SSD*", "*Deceased*", "Physically Unfit", "Active", "Disabled", "Cancel") - if(hasHUD(usr,"medical")) + if(hasHUD(usr, EXAMINE_HUD_MEDICAL)) if(setmedical != "Cancel") R.fields["p_stat"] = setmedical modified = 1 @@ -867,7 +853,7 @@ to_chat(usr, "Unable to locate a data core entry for this person.") if(href_list["medrecord"]) - if(hasHUD(usr,"medical")) + if(hasHUD(usr, EXAMINE_HUD_MEDICAL)) if(usr.incapacitated()) return var/read = 0 @@ -877,7 +863,7 @@ if(E.fields["name"] == perpname) for(var/datum/data/record/R in GLOB.data_core.medical) if(R.fields["id"] == E.fields["id"]) - if(hasHUD(usr,"medical")) + if(hasHUD(usr, EXAMINE_HUD_MEDICAL)) to_chat(usr, "Name: [R.fields["name"]] Blood Type: [R.fields["b_type"]]") to_chat(usr, "DNA: [R.fields["b_dna"]]") to_chat(usr, "Minor Disabilities: [R.fields["mi_dis"]]") @@ -892,18 +878,18 @@ to_chat(usr, "Unable to locate a data core entry for this person.") if(href_list["medrecordComment"]) - if(hasHUD(usr,"medical")) + if(hasHUD(usr, EXAMINE_HUD_MEDICAL)) if(usr.incapacitated()) return var/perpname = get_visible_name(TRUE) - var/read = 0 + var/read = FALSE for(var/datum/data/record/E in GLOB.data_core.general) if(E.fields["name"] == perpname) for(var/datum/data/record/R in GLOB.data_core.medical) if(R.fields["id"] == E.fields["id"]) - if(hasHUD(usr,"medical")) - read = 1 + if(hasHUD(usr, EXAMINE_HUD_MEDICAL)) + read = TRUE if(LAZYLEN(R.fields["comments"])) for(var/c in R.fields["comments"]) to_chat(usr, c) @@ -915,27 +901,28 @@ to_chat(usr, "Unable to locate a data core entry for this person.") if(href_list["medrecordadd"]) - if(hasHUD(usr,"medical")) + if(usr.incapacitated() || !hasHUD(usr, EXAMINE_HUD_MEDICAL)) + return + var/raw_input = input("Add Comment:", "Medical records", null, null) as message + var/sanitized = copytext(trim(sanitize(raw_input)), 1, MAX_MESSAGE_LEN) + if(!sanitized || usr.stat || usr.restrained() || !hasHUD(usr, EXAMINE_HUD_MEDICAL)) + return + add_comment(usr, "medical", sanitized) + + if(href_list["employment_more"]) + if(hasHUD(usr, EXAMINE_HUD_SKILLS)) if(usr.incapacitated()) return + + var/skills var/perpname = get_visible_name(TRUE) - for(var/datum/data/record/E in GLOB.data_core.general) - if(E.fields["name"] == perpname) - for(var/datum/data/record/R in GLOB.data_core.medical) - if(R.fields["id"] == E.fields["id"]) - if(hasHUD(usr,"medical")) - var/t1 = copytext(trim(sanitize(input("Add Comment:", "Med. records", null, null) as message)), 1, MAX_MESSAGE_LEN) - if(!t1 || usr.stat || usr.restrained() || !hasHUD(usr, "medical")) - return - if(ishuman(usr)) - var/mob/living/carbon/human/U = usr - R.fields["comments"] += "Made by [U.get_authentification_name()] ([U.get_assignment()]) on [GLOB.current_date_string] [station_time_timestamp()]
[t1]" - if(isrobot(usr)) - var/mob/living/silicon/robot/U = usr - R.fields["comments"] += "Made by [U.name] ([U.modtype] [U.braintype]) on [GLOB.current_date_string] [station_time_timestamp()]
[t1]" - if(isAI(usr)) - var/mob/living/silicon/ai/U = usr - R.fields["comments"] += "Made by [U.name] (artificial intelligence) on [GLOB.current_date_string] [station_time_timestamp()]
[t1]" + if(perpname) + for(var/datum/data/record/E in GLOB.data_core.general) + if(E.fields["name"] == perpname) + skills = E.fields["notes"] + break + if(skills) + to_chat(usr, "Employment records: [skills]\n") if(href_list["lookitem"]) var/obj/item/I = locate(href_list["lookitem"]) diff --git a/code/modules/mob/living/silicon/pai/pai.dm b/code/modules/mob/living/silicon/pai/pai.dm index a0edbc01c07..aaa62690fb5 100644 --- a/code/modules/mob/living/silicon/pai/pai.dm +++ b/code/modules/mob/living/silicon/pai/pai.dm @@ -441,11 +441,15 @@ switch(stat) if(CONSCIOUS) - if(!client) msg += "\nIt appears to be in stand-by mode." //afk - if(UNCONSCIOUS) msg += "\nIt doesn't seem to be responding." - if(DEAD) msg += "\nIt looks completely unsalvageable." + if(!client) + msg += "\nIt appears to be in stand-by mode." //afk + if(UNCONSCIOUS) + msg += "\nIt doesn't seem to be responding." + if(DEAD) + msg += "\nIt looks completely unsalvageable." - if(print_flavor_text()) msg += "\n[print_flavor_text()]" + if(print_flavor_text()) + msg += "\n[print_flavor_text()]" if(pose) if( findtext(pose,".",length(pose)) == 0 && findtext(pose,"!",length(pose)) == 0 && findtext(pose,"?",length(pose)) == 0 ) diff --git a/code/modules/mob/living/silicon/robot/examine.dm b/code/modules/mob/living/silicon/robot/examine.dm index 69cb398df63..e0c3f7d95a7 100644 --- a/code/modules/mob/living/silicon/robot/examine.dm +++ b/code/modules/mob/living/silicon/robot/examine.dm @@ -47,7 +47,8 @@ msg += "It looks like its system is corrupted beyond repair. There is no hope of recovery.\n" msg += "*---------*" - if(print_flavor_text()) msg += "\n[print_flavor_text()]\n" + if(print_flavor_text()) + msg += "\n[print_flavor_text()]\n" if(pose) if( findtext(pose,".",length(pose)) == 0 && findtext(pose,"!",length(pose)) == 0 && findtext(pose,"?",length(pose)) == 0 ) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index acdd8e4b6f5..193ee62edd0 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -732,7 +732,7 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( \ flavor_text = msg -/mob/proc/print_flavor_text(var/shrink = 1) +/mob/proc/print_flavor_text(var/shrink = TRUE) if(flavor_text && flavor_text != "") var/msg = replacetext(flavor_text, "\n", " ") if(length(msg) <= 40 || !shrink) diff --git a/code/modules/surgery/organs/augments_eyes.dm b/code/modules/surgery/organs/augments_eyes.dm index 042e911fae9..6dee1763aad 100644 --- a/code/modules/surgery/organs/augments_eyes.dm +++ b/code/modules/surgery/organs/augments_eyes.dm @@ -84,6 +84,8 @@ desc = "These cybernetic eyes will display a HUD over everything you see. Maybe." slot = "eye_hud" var/HUD_type = 0 + /// A list of extension kinds added to the examine text. Things like medical or security records. + var/list/examine_extensions = null /obj/item/organ/internal/cyberimp/eyes/hud/insert(var/mob/living/carbon/M, var/special = 0) ..() @@ -107,6 +109,7 @@ origin_tech = "materials=4;programming=4;biotech=4" aug_message = "You suddenly see health bars floating above people's heads..." HUD_type = DATA_HUD_MEDICAL_ADVANCED + examine_extensions = list(EXAMINE_HUD_MEDICAL) /obj/item/organ/internal/cyberimp/eyes/hud/diagnostic name = "Diagnostic HUD implant" @@ -125,6 +128,7 @@ origin_tech = "materials=4;programming=4;biotech=3;combat=3" aug_message = "Job indicator icons pop up in your vision. That is not a certified surgeon..." HUD_type = DATA_HUD_SECURITY_ADVANCED + examine_extensions = list(EXAMINE_HUD_SECURITY_READ, EXAMINE_HUD_SECURITY_WRITE) // Welding shield implant /obj/item/organ/internal/cyberimp/eyes/shield