From 73172f883652533c1d582b75bebb02b554b0986a Mon Sep 17 00:00:00 2001
From: Antonio Tosti <5588048+atosti@users.noreply.github.com>
Date: Mon, 13 Mar 2023 18:21:55 -0700
Subject: [PATCH] Re-implements Physical and Mental statuses in crewmember
Medical Records (#73882)
## About The Pull Request
These changes re-implement the functionality for Physical and Mental
Statuses, which used to be present in Medical Records (visible via
medical filing cabinents, medical records consoles, and MED-HUDs). These
Physical/Mental statuses can once again be updated through examining a
crewmember (while wearing a Med-HUD), or through the new TGUI interface
for medical records consoles.
## Why It's Good For The Game
Primarily, this resolves the bugs mentioned in [Issue
#73477](https://github.com/tgstation/tgstation/issues/73477), and
restores functionality which appears to have been accidentally removed
via [PR #72725](https://github.com/tgstation/tgstation/pull/72725).
Additionally, the re-implementation of these statuses allows for more
in-depth medical RP (and bureaucracy), especially in regards to the
Psychiatrist role and managing crewmember sanity.
## Changelog
:cl:
fix: Re-implements physical and mental statuses in crewmember medical
records.
fix: Re-implements changing a crewmember's physical/mental status via a
Med-HUD.
/:cl:
Edit: Image of the new TGUI buttons which now handle Physical/Mental
statuses.

Closes #73477
---
code/__DEFINES/medical.dm | 27 ++++++++
code/datums/records/record.dm | 8 +++
.../machinery/computer/records/medical.dm | 24 ++++++++
.../mob/living/carbon/human/examine.dm | 5 ++
code/modules/mob/living/carbon/human/human.dm | 17 ++++++
.../file_system/programs/records.dm | 2 +
code/modules/paperwork/filingcabinet.dm | 2 +-
tgstation.dme | 1 +
.../interfaces/MedicalRecords/RecordView.tsx | 61 ++++++++++++++++++-
.../interfaces/MedicalRecords/constants.ts | 42 +++++++++++++
.../tgui/interfaces/MedicalRecords/types.ts | 4 ++
tgui/packages/tgui/interfaces/NtosRecords.js | 4 +-
12 files changed, 193 insertions(+), 4 deletions(-)
create mode 100644 code/__DEFINES/medical.dm
create mode 100644 tgui/packages/tgui/interfaces/MedicalRecords/constants.ts
diff --git a/code/__DEFINES/medical.dm b/code/__DEFINES/medical.dm
new file mode 100644
index 00000000000..899de5c273f
--- /dev/null
+++ b/code/__DEFINES/medical.dm
@@ -0,0 +1,27 @@
+/// Physical statuses
+#define PHYSICAL_ACTIVE "Active"
+#define PHYSICAL_DEBILITATED "Debilitated"
+#define PHYSICAL_UNCONSCIOUS "Unconscious"
+#define PHYSICAL_DECEASED "Deceased"
+
+/// List of available physical statuses
+#define PHYSICAL_STATUSES list(\
+ PHYSICAL_ACTIVE, \
+ PHYSICAL_DEBILITATED, \
+ PHYSICAL_UNCONSCIOUS, \
+ PHYSICAL_DECEASED, \
+)
+
+/// Mental statuses
+#define MENTAL_STABLE "Stable"
+#define MENTAL_WATCH "Watch"
+#define MENTAL_UNSTABLE "Unstable"
+#define MENTAL_INSANE "Insane"
+
+/// List of available mental statuses
+#define MENTAL_STATUSES list(\
+ MENTAL_STABLE, \
+ MENTAL_WATCH, \
+ MENTAL_UNSTABLE, \
+ MENTAL_INSANE, \
+)
diff --git a/code/datums/records/record.dm b/code/datums/records/record.dm
index dda5c178cd7..e491228269f 100644
--- a/code/datums/records/record.dm
+++ b/code/datums/records/record.dm
@@ -70,6 +70,10 @@
var/minor_disabilities
/// Fancy description of minor disabilities
var/minor_disabilities_desc
+ /// Physical status of this person in medical records.
+ var/physical_status
+ /// Mental status of this person in medical records.
+ var/mental_status
/// Positive and neutral quirk strings
var/quirk_notes
/// Security note
@@ -95,6 +99,8 @@
major_disabilities_desc = "No disabilities have been diagnosed at the moment.",
minor_disabilities = "None",
minor_disabilities_desc = "No disabilities have been diagnosed at the moment.",
+ physical_status = PHYSICAL_ACTIVE,
+ mental_status = MENTAL_STABLE,
quirk_notes,
)
. = ..()
@@ -103,6 +109,8 @@
src.major_disabilities_desc = major_disabilities_desc
src.minor_disabilities = minor_disabilities
src.minor_disabilities_desc = minor_disabilities_desc
+ src.physical_status = physical_status
+ src.mental_status = mental_status
src.quirk_notes = quirk_notes
GLOB.manifest.general += src
diff --git a/code/game/machinery/computer/records/medical.dm b/code/game/machinery/computer/records/medical.dm
index 2734e41925f..362c8468aa6 100644
--- a/code/game/machinery/computer/records/medical.dm
+++ b/code/game/machinery/computer/records/medical.dm
@@ -58,6 +58,8 @@
gender = target.gender,
major_disabilities = target.major_disabilities_desc,
minor_disabilities = target.minor_disabilities_desc,
+ physical_status = target.physical_status,
+ mental_status = target.mental_status,
name = target.name,
notes = notes,
quirk_notes = target.quirk_notes,
@@ -73,6 +75,8 @@
var/list/data = list()
data["min_age"] = AGE_MIN
data["max_age"] = AGE_MAX
+ data["physical_statuses"] = PHYSICAL_STATUSES
+ data["mental_statuses"] = MENTAL_STATUSES
return data
/obj/machinery/computer/records/medical/ui_act(action, list/params, datum/tgui/ui)
@@ -110,6 +114,24 @@
return TRUE
+ if("set_physical_status")
+ var/physical_status = params["physical_status"]
+ if(!physical_status || !(physical_status in PHYSICAL_STATUSES))
+ return FALSE
+
+ target.physical_status = physical_status
+
+ return TRUE
+
+ if("set_mental_status")
+ var/mental_status = params["mental_status"]
+ if(!mental_status || !(mental_status in MENTAL_STATUSES))
+ return FALSE
+
+ target.mental_status = mental_status
+
+ return TRUE
+
return FALSE
/// Deletes medical information from a record.
@@ -126,6 +148,8 @@
target.medical_notes.Cut()
target.minor_disabilities = ""
target.minor_disabilities_desc = ""
+ target.physical_status = ""
+ target.mental_status = ""
target.name = "Unknown"
target.quirk_notes = ""
target.rank = "Unknown"
diff --git a/code/modules/mob/living/carbon/human/examine.dm b/code/modules/mob/living/carbon/human/examine.dm
index 98d80764f4a..f65d54beefa 100644
--- a/code/modules/mob/living/carbon/human/examine.dm
+++ b/code/modules/mob/living/carbon/human/examine.dm
@@ -378,6 +378,11 @@
if(cyberimp_detect)
. += "Detected cybernetic modifications:"
. += "[cyberimp_detect]"
+ if(target_record)
+ var/health_record = target_record.physical_status
+ . += "\[[health_record]\]"
+ health_record = target_record.mental_status
+ . += "\[[health_record]\]"
target_record = find_record(perpname)
if(target_record)
. += "\[Medical evaluation\]
"
diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm
index 0b857319587..2cf75be3384 100644
--- a/code/modules/mob/living/carbon/human/human.dm
+++ b/code/modules/mob/living/carbon/human/human.dm
@@ -173,6 +173,23 @@
if(!(ACCESS_MEDICAL in access))
to_chat(human_user, span_warning("ERROR: Invalid access"))
return
+
+ if(href_list["physical_status"])
+ var/health_status = tgui_input_list(human_user, "Specify a new physical status for this person.", "Medical HUD", PHYSICAL_STATUSES, target_record.physical_status)
+ if(!health_status || !target_record || !human_user.canUseHUD() || !HAS_TRAIT(human_user, TRAIT_MEDICAL_HUD))
+ return
+
+ target_record.physical_status = health_status
+ return
+
+ if(href_list["mental_status"])
+ var/health_status = tgui_input_list(human_user, "Specify a new mental status for this person.", "Medical HUD", MENTAL_STATUSES, target_record.mental_status)
+ if(!health_status || !target_record || !human_user.canUseHUD() || !HAS_TRAIT(human_user, TRAIT_MEDICAL_HUD))
+ return
+
+ target_record.mental_status = health_status
+ return
+
if(href_list["quirk"])
var/quirkstring = get_quirk_string(TRUE, CAT_QUIRK_ALL)
if(quirkstring)
diff --git a/code/modules/modular_computers/file_system/programs/records.dm b/code/modules/modular_computers/file_system/programs/records.dm
index 7f3d099b719..0d8cec96378 100644
--- a/code/modules/modular_computers/file_system/programs/records.dm
+++ b/code/modules/modular_computers/file_system/programs/records.dm
@@ -54,6 +54,8 @@
current_record["bloodtype"] = person.blood_type
current_record["ma_dis"] = person.major_disabilities_desc
current_record["mi_dis"] = person.minor_disabilities_desc
+ current_record["physical_status"] = person.physical_status
+ current_record["mental_status"] = person.mental_status
current_record["name"] = person.name
current_record["notes"] = person.medical_notes
diff --git a/code/modules/paperwork/filingcabinet.dm b/code/modules/paperwork/filingcabinet.dm
index 0c49a6b1cad..429050d1825 100644
--- a/code/modules/paperwork/filingcabinet.dm
+++ b/code/modules/paperwork/filingcabinet.dm
@@ -154,7 +154,7 @@
var/obj/item/paper/med_record_paper = new /obj/item/paper(src)
var/med_record_text = "