From 5c2228de56aa3eae07a4e755b1346c471b8c05c0 Mon Sep 17 00:00:00 2001
From: Cursor <102828457+theselfish@users.noreply.github.com>
Date: Sun, 9 Jun 2024 20:57:22 +0100
Subject: [PATCH] [PORT][NON-MODULAR] Physical Age & Chronological Age (#27928)
* [PORT][NON-MODULAR] Physical Age & Chronological Age
* Whoopsy
* Update RecordView.tsx
* Update RecordView.tsx
* Fixes a toggle with the star wars helmet
* Revert "Fixes a toggle with the star wars helmet"
This reverts commit 0b17d52a2be7a5fbd27c443eef5ba40d579763ef.
* Update code/game/machinery/computer/records/medical.dm
---
code/__DEFINES/mobs.dm | 3 ++-
code/datums/records/manifest.dm | 2 ++
code/datums/records/record.dm | 5 ++++
.../machinery/computer/records/medical.dm | 3 +++
.../machinery/computer/records/security.dm | 2 ++
.../mob/living/carbon/human/human_defines.dm | 1 +
.../file_system/programs/records.dm | 3 +++
.../code/datums/records/record.dm | 4 +++
.../client/preferences/chronological_age.dm | 14 +++++++++++
.../modules/client/preferences_savefile.dm | 6 ++++-
tgstation.dme | 1 +
.../interfaces/MedicalRecords/RecordView.tsx | 25 +++++++++++++++++--
.../tgui/interfaces/MedicalRecords/types.ts | 2 ++
tgui/packages/tgui/interfaces/NtosRecords.jsx | 18 ++++++++++++-
.../features/character_preferences/age.tsx | 9 ++++++-
.../skyrat/chronological_age.tsx | 10 ++++++++
.../interfaces/SecurityRecords/RecordView.tsx | 25 +++++++++++++++++--
.../tgui/interfaces/SecurityRecords/types.ts | 2 ++
18 files changed, 127 insertions(+), 8 deletions(-)
create mode 100644 modular_skyrat/master_files/code/modules/client/preferences/chronological_age.dm
create mode 100644 tgui/packages/tgui/interfaces/PreferencesMenu/preferences/features/character_preferences/skyrat/chronological_age.tsx
diff --git a/code/__DEFINES/mobs.dm b/code/__DEFINES/mobs.dm
index a5259ab2255..2b8293a7610 100644
--- a/code/__DEFINES/mobs.dm
+++ b/code/__DEFINES/mobs.dm
@@ -440,7 +440,8 @@
//MINOR TWEAKS/MISC
//#define AGE_MIN 17 //youngest a character can be //ORIGINAL
#define AGE_MIN 18 //youngest a character can be //SKYRAT EDIT CHANGE - age
-#define AGE_MAX 85 //oldest a character can be
+#define AGE_MAX 100 //oldest a character can be //SKYRAT EDIT CHANGE - Increase max character age to 100 - ORIGINAL: #define AGE_MAX 85 //oldest a character can be
+#define AGE_CHRONO_MAX 9999 //SKYRAT EDIT ADDITION - Chronological age
#define AGE_MINOR 20 //legal age of space drinking and smoking
#define WIZARD_AGE_MIN 30 //youngest a wizard can be
#define APPRENTICE_AGE_MIN 29 //youngest an apprentice can be
diff --git a/code/datums/records/manifest.dm b/code/datums/records/manifest.dm
index f1f81b521f8..ddb92ea7629 100644
--- a/code/datums/records/manifest.dm
+++ b/code/datums/records/manifest.dm
@@ -123,6 +123,7 @@ GLOBAL_DATUM_INIT(manifest, /datum/manifest, new)
var/datum/record/locked/lockfile = new(
age = person.age,
+ chrono_age = person.chrono_age, // SKYRAT EDIT ADDITION - Chronological age
blood_type = record_dna.blood_type,
character_appearance = character_appearance,
dna_string = record_dna.unique_enzymes,
@@ -140,6 +141,7 @@ GLOBAL_DATUM_INIT(manifest, /datum/manifest, new)
new /datum/record/crew(
age = person.age,
+ chrono_age = person.chrono_age, // SKYRAT EDIT ADDITION - Chronological age
blood_type = record_dna.blood_type,
character_appearance = character_appearance,
dna_string = record_dna.unique_enzymes,
diff --git a/code/datums/records/record.dm b/code/datums/records/record.dm
index cf10e62bdcd..7c1e6be5568 100644
--- a/code/datums/records/record.dm
+++ b/code/datums/records/record.dm
@@ -29,6 +29,7 @@
/datum/record/New(
age = 18,
+ chrono_age = 18, // SKYRAT EDIT ADDITION - Chronological age
blood_type = "?",
character_appearance,
dna_string = "Unknown",
@@ -42,6 +43,7 @@
voice = "?????",
)
src.age = age
+ src.chrono_age = chrono_age // SKYRAT EDIT ADDITION - Chronological age
src.blood_type = blood_type
src.character_appearance = character_appearance
src.dna_string = dna_string
@@ -89,6 +91,7 @@
/datum/record/crew/New(
age = 18,
+ chrono_age = 18, // SKYRAT EDIT ADDITION - Chronological age
blood_type = "?",
character_appearance,
dna_string = "Unknown",
@@ -153,6 +156,7 @@
/datum/record/locked/New(
age = 18,
+ chrono_age = 18, // SKYRAT EDIT ADDITION - Chronological age
blood_type = "?",
character_appearance,
dna_string = "Unknown",
@@ -264,6 +268,7 @@
var/final_paper_text = "
SR-[print_count]: [header]
"
final_paper_text += "Name: [name]
Gender: [gender]
Age: [age]
"
+ final_paper_text += "Chronological Age: [chrono_age]
" // SKYRAT EDIT ADDITION - Chronological age
if(alias != name)
final_paper_text += "Alias: [alias]
"
diff --git a/code/game/machinery/computer/records/medical.dm b/code/game/machinery/computer/records/medical.dm
index 6fcef6726e4..2043e129da3 100644
--- a/code/game/machinery/computer/records/medical.dm
+++ b/code/game/machinery/computer/records/medical.dm
@@ -52,6 +52,7 @@
records += list(list(
age = target.age,
+ chrono_age = target.chrono_age, // SKYRAT EDIT ADDITION - Chronological age
blood_type = target.blood_type,
crew_ref = REF(target),
dna = target.dna_string,
@@ -80,6 +81,7 @@
var/list/data = list()
data["min_age"] = AGE_MIN
data["max_age"] = AGE_MAX
+ data["max_chrono_age"] = AGE_CHRONO_MAX // SKYRAT EDIT ADDITION - Chronological age
data["physical_statuses"] = PHYSICAL_STATUSES
data["mental_statuses"] = MENTAL_STATUSES
return data
@@ -145,6 +147,7 @@
return FALSE
target.age = 18
+ target.chrono_age = 18 // SKYRAT EDIT ADDITION - Chronological age
target.blood_type = pick(list("A+", "A-", "B+", "B-", "O+", "O-", "AB+", "AB-"))
target.dna_string = "Unknown"
target.gender = "Unknown"
diff --git a/code/game/machinery/computer/records/security.dm b/code/game/machinery/computer/records/security.dm
index 350e54db126..86ea1a61318 100644
--- a/code/game/machinery/computer/records/security.dm
+++ b/code/game/machinery/computer/records/security.dm
@@ -117,6 +117,7 @@
records += list(list(
age = target.age,
+ chrono_age = target.chrono_age, // SKYRAT EDIT ADDITION - Chronological age
citations = citations,
crew_ref = REF(target),
crimes = crimes,
@@ -142,6 +143,7 @@
var/list/data = list()
data["min_age"] = AGE_MIN
data["max_age"] = AGE_MAX
+ data["max_chrono_age"] = AGE_CHRONO_MAX // SKYRAT EDIT ADDITION - Chronological age
return data
/obj/machinery/computer/records/security/ui_act(action, list/params, datum/tgui/ui)
diff --git a/code/modules/mob/living/carbon/human/human_defines.dm b/code/modules/mob/living/carbon/human/human_defines.dm
index 52fe6d7b684..9c57c8776d1 100644
--- a/code/modules/mob/living/carbon/human/human_defines.dm
+++ b/code/modules/mob/living/carbon/human/human_defines.dm
@@ -44,6 +44,7 @@
var/lip_color = COLOR_WHITE
var/age = 30 //Player's age
+ var/chrono_age = 30 // SKYRAT EDIT ADDITION - Chronological age
/// Which body type to use
var/physique = MALE
diff --git a/code/modules/modular_computers/file_system/programs/records.dm b/code/modules/modular_computers/file_system/programs/records.dm
index 063c19d35e1..3effdbd5b80 100644
--- a/code/modules/modular_computers/file_system/programs/records.dm
+++ b/code/modules/modular_computers/file_system/programs/records.dm
@@ -39,6 +39,7 @@
var/list/current_record = list()
current_record["age"] = person.age
+ current_record["chrono_age"] = person.chrono_age // SKYRAT EDIT ADDITION - Chronological age
current_record["fingerprint"] = person.fingerprint
current_record["gender"] = person.gender
current_record["name"] = person.name
@@ -52,6 +53,8 @@
for(var/datum/record/crew/person in GLOB.manifest.general)
var/list/current_record = list()
+ current_record["age"] = person.age // SKYRAT EDIT ADDITION - Chronological age
+ current_record["chrono_age"] = person.chrono_age // SKYRAT EDIT ADDITION - Chronological age
current_record["bloodtype"] = person.blood_type
current_record["ma_dis"] = person.major_disabilities_desc
current_record["mi_dis"] = person.minor_disabilities_desc
diff --git a/modular_skyrat/master_files/code/datums/records/record.dm b/modular_skyrat/master_files/code/datums/records/record.dm
index 2b4897d86a5..4b42585df8c 100644
--- a/modular_skyrat/master_files/code/datums/records/record.dm
+++ b/modular_skyrat/master_files/code/datums/records/record.dm
@@ -1,3 +1,7 @@
+/datum/record
+ /// Chronological age of the character.
+ var/chrono_age
+
/datum/record/crew
/// Contains their background information.
var/background_information
diff --git a/modular_skyrat/master_files/code/modules/client/preferences/chronological_age.dm b/modular_skyrat/master_files/code/modules/client/preferences/chronological_age.dm
new file mode 100644
index 00000000000..fa017c0cac7
--- /dev/null
+++ b/modular_skyrat/master_files/code/modules/client/preferences/chronological_age.dm
@@ -0,0 +1,14 @@
+// Chronological age
+/datum/preference/numeric/chronological_age
+ category = PREFERENCE_CATEGORY_NON_CONTEXTUAL
+ savefile_key = "chrono_age"
+ savefile_identifier = PREFERENCE_CHARACTER
+
+ minimum = AGE_MIN
+ maximum = AGE_CHRONO_MAX
+
+/datum/preference/numeric/chronological_age/create_informed_default_value(datum/preferences/preferences)
+ return preferences.read_preference(/datum/preference/numeric/age)
+
+/datum/preference/numeric/chronological_age/apply_to_human(mob/living/carbon/human/target, value)
+ target.chrono_age = value
diff --git a/modular_skyrat/master_files/code/modules/client/preferences_savefile.dm b/modular_skyrat/master_files/code/modules/client/preferences_savefile.dm
index 791bfcd39bd..d2cb359c89f 100644
--- a/modular_skyrat/master_files/code/modules/client/preferences_savefile.dm
+++ b/modular_skyrat/master_files/code/modules/client/preferences_savefile.dm
@@ -3,7 +3,7 @@
* You can't really use the non-modular version, least you eventually want asinine merge
* conflicts and/or potentially disastrous issues to arise, so here's your own.
*/
-#define MODULAR_SAVEFILE_VERSION_MAX 4
+#define MODULAR_SAVEFILE_VERSION_MAX 5
#define MODULAR_SAVEFILE_UP_TO_DATE -1
@@ -11,6 +11,7 @@
#define VERSION_BREAST_SIZE_CHANGE 2
#define VERSION_SYNTH_REFACTOR 3
#define VERSION_UNDERSHIRT_BRA_SPLIT 4
+#define VERSION_CHRONOLOGICAL_AGE 5
#define INDEX_UNDERWEAR 1
#define INDEX_BRA 2
@@ -254,6 +255,9 @@
write_preference(GLOB.preference_entries[/datum/preference/color/bra_color], migrated_color)
write_preference(GLOB.preference_entries[/datum/preference/choiced/undershirt], "Nude")
+ // Resets Chronological Age field to default.
+ if(current_version < VERSION_CHRONOLOGICAL_AGE)
+ write_preference(GLOB.preference_entries[/datum/preference/numeric/chronological_age], read_preference(/datum/preference/numeric/age))
/datum/preferences/proc/check_migration()
if(!tgui_prefs_migration)
diff --git a/tgstation.dme b/tgstation.dme
index a9117593687..c3d28d6ba83 100644
--- a/tgstation.dme
+++ b/tgstation.dme
@@ -6488,6 +6488,7 @@
#include "modular_skyrat\master_files\code\modules\client\preferences\be_antag.dm"
#include "modular_skyrat\master_files\code\modules\client\preferences\body_size.dm"
#include "modular_skyrat\master_files\code\modules\client\preferences\brain.dm"
+#include "modular_skyrat\master_files\code\modules\client\preferences\chronological_age.dm"
#include "modular_skyrat\master_files\code\modules\client\preferences\clothing.dm"
#include "modular_skyrat\master_files\code\modules\client\preferences\delete_sparks.dm"
#include "modular_skyrat\master_files\code\modules\client\preferences\emote_overlay.dm"
diff --git a/tgui/packages/tgui/interfaces/MedicalRecords/RecordView.tsx b/tgui/packages/tgui/interfaces/MedicalRecords/RecordView.tsx
index 3e75d1eb332..181e2cff6ee 100644
--- a/tgui/packages/tgui/interfaces/MedicalRecords/RecordView.tsx
+++ b/tgui/packages/tgui/interfaces/MedicalRecords/RecordView.tsx
@@ -31,10 +31,12 @@ export const MedicalRecordView = (props) => {
const { act, data } = useBackend();
const { assigned_view, physical_statuses, mental_statuses, station_z } = data;
- const { min_age, max_age } = data;
+ // const { min_age, max_age } = data; // ORIGINAL
+ const { min_age, max_age, max_chrono_age } = data; // SKYRAT EDIT CHANGE - Chronological age
const {
age,
+ chrono_age, // SKYRAT EDIT ADDITION - Chronological age
blood_type,
crew_ref,
dna,
@@ -91,7 +93,10 @@ export const MedicalRecordView = (props) => {
-
+ {/* // ORIGINAL */}
+ {/* SKYRAT EDIT CHANGE BEGIN - Chronological age */}
+
+ {/* SKYRAT EDIT CHANGE END */}
{
value={age}
/>
+ {/* SKYRAT EDIT ADDITION BEGIN - Chronological age */}
+
+
+ act('edit_field', {
+ field: 'chrono_age',
+ ref: crew_ref,
+ value: value,
+ })
+ }
+ value={chrono_age}
+ />
+
+ {/* SKYRAT EDIT ADDITION END */}
{
' ' +
record.age +
' ' +
+ /* SKYRAT EDIT ADDITION BEGIN - Chronological age */
+ record.chrono_age +
+ ' ' +
+ /* SKYRAT EDIT ADDITION END */
record.fingerprint,
)
)
@@ -61,8 +65,14 @@ export const NtosRecords = (props) => {
Gender: {record.gender}
- Age: {record.age}
+ {/* SKYRAT EDIT CHANGE - Chronological age, ORIGINAL: Age: {record.age} */}
+ Physical Age: {record.age}
+ {/* SKYRAT EDIT CHANGE END */}
+ {/* SKYRAT EDIT ADDITION BEGIN - Chronological age */}
+ Chronological Age: {record.chrono_age}
+
+ {/* SKYRAT EDIT ADDITION END */}
Fingerprint Hash: {record.fingerprint}
@@ -93,6 +103,12 @@ export const NtosRecords = (props) => {
{record.name}
+ {/* SKYRAT EDIT ADDITION BEGIN - Chronological age */}
+ Physical Age: {record.age}
+
+ Chronological Age: {record.chrono_age}
+
+ {/* SKYRAT EDIT ADDITION END */}
Bloodtype: {record.bloodtype}
Minor Disabilities: {record.mi_dis}
diff --git a/tgui/packages/tgui/interfaces/PreferencesMenu/preferences/features/character_preferences/age.tsx b/tgui/packages/tgui/interfaces/PreferencesMenu/preferences/features/character_preferences/age.tsx
index 3b0dc68158f..109f5edfa76 100644
--- a/tgui/packages/tgui/interfaces/PreferencesMenu/preferences/features/character_preferences/age.tsx
+++ b/tgui/packages/tgui/interfaces/PreferencesMenu/preferences/features/character_preferences/age.tsx
@@ -1,6 +1,13 @@
import { Feature, FeatureNumberInput } from '../base';
export const age: Feature = {
- name: 'Age',
+ // name: 'Age', // ORIGINAL
+ name: 'Age (Physical)', // SKYRAT EDIT CHANGE - Chronological age
+ // SKYRAT EDIT ADDITION BEGIN - Chronological age
+ description:
+ "Physical age represents how far your character has grown physically and mentally.\
+ Includes 'normal' aging, such as experiences which physically age the body, and 'anti-aging' medical procedures.\
+ Does not include time spent in cryo-sleep.",
+ // SKYRAT EDIT ADDITION END
component: FeatureNumberInput,
};
diff --git a/tgui/packages/tgui/interfaces/PreferencesMenu/preferences/features/character_preferences/skyrat/chronological_age.tsx b/tgui/packages/tgui/interfaces/PreferencesMenu/preferences/features/character_preferences/skyrat/chronological_age.tsx
new file mode 100644
index 00000000000..f63bb351380
--- /dev/null
+++ b/tgui/packages/tgui/interfaces/PreferencesMenu/preferences/features/character_preferences/skyrat/chronological_age.tsx
@@ -0,0 +1,10 @@
+// THIS IS A SKYRAT SECTOR UI FILE
+import { Feature, FeatureNumberInput } from '../../base';
+
+export const chrono_age: Feature = {
+ name: 'Age (Chronological)',
+ description:
+ 'Chronological age represents how long your character has actually existed in the universe since birth.\
+ Includes time spent in cryo-sleep and/or in areas of gravity/speed-induced time dilation.',
+ component: FeatureNumberInput,
+};
diff --git a/tgui/packages/tgui/interfaces/SecurityRecords/RecordView.tsx b/tgui/packages/tgui/interfaces/SecurityRecords/RecordView.tsx
index 43a38182b45..dcf9d664996 100644
--- a/tgui/packages/tgui/interfaces/SecurityRecords/RecordView.tsx
+++ b/tgui/packages/tgui/interfaces/SecurityRecords/RecordView.tsx
@@ -53,10 +53,12 @@ const RecordInfo = (props) => {
const { available_statuses } = data;
const [open, setOpen] = useLocalState('printOpen', false);
- const { min_age, max_age } = data;
+ // const { min_age, max_age } = data; // ORIGINAL
+ const { min_age, max_age, max_chrono_age } = data; // SKYRAT EDIT CHANGE - Chronological age
const {
age,
+ chrono_age, // SKYRAT EDIT ADDITION - Chronological age
crew_ref,
crimes,
fingerprint,
@@ -150,7 +152,10 @@ const RecordInfo = (props) => {
-
+ {/* // ORIGINAL */}
+ {/* SKYRAT EDIT CHANGE BEGIN - Chronological age */}
+
+ {/* SKYRAT EDIT CHANGE END */}
{
value={age}
/>
+ {/* SKYRAT EDIT ADDITION BEGIN - Chronological age */}
+
+
+ act('edit_field', {
+ crew_ref: crew_ref,
+ field: 'chrono_age',
+ value: value,
+ })
+ }
+ value={chrono_age}
+ />
+
+ {/* SKYRAT EDIT ADDITION END */}