Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIRROR] Add rough age estimations to examine text #3011

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions baystation12.dme
Original file line number Diff line number Diff line change
Expand Up @@ -3032,6 +3032,7 @@
#include "code\modules\shuttles\shuttles_multi.dm"
#include "code\modules\skrell\skrell_rigs.dm"
#include "code\modules\species\species.dm"
#include "code\modules\species\species_age_comparison.dm"
#include "code\modules\species\species_attack.dm"
#include "code\modules\species\species_getters.dm"
#include "code\modules\species\species_grab.dm"
Expand Down
5 changes: 5 additions & 0 deletions code/modules/mob/living/carbon/human/examine.dm
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,11 @@
var/show_descs = show_descriptors_to(user)
if(show_descs)
msg += SPAN_NOTICE("[jointext(show_descs, "<br>")]")

var/age_diff = species.get_age_comparison_string(src, user)
if (age_diff)
msg += "<br />[SPAN_NOTICE(age_diff)]"

to_chat(user, SPAN_INFO(jointext(msg, null)))

//Helper procedure. Called by /mob/living/carbon/human/examine() and /mob/living/carbon/human/Topic() to determine HUD access to security and medical records.
Expand Down
63 changes: 63 additions & 0 deletions code/modules/species/species_age_comparison.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/// List (string => integer). Map of descriptive words to the age threshhold to display these words. Age threshhold is the _highest_ age that can use this descriptor. Descriptors should make grammatical sense when used in the following sentence: "They are of [X] age for a [species]."
/datum/species/var/list/age_descriptors = list(
"very young" = 20,
"young" = 40,
"moderate" = 60,
"old" = 80,
"very old" = 100,
"ancient" = INFINITY
)


/// List (string => integer). Map of descriptive words to the age different threshhold to display these words. Age difference threshhold is the _highest_ number that can use this descriptor. Descriptors should make grammatical sence when used in the following sentence: "They are [X] you."
/datum/species/var/list/age_diff_descriptors = list(
"much younger than" = -15,
"younger than" = -10,
"slightly younger than" = -5,
"around the same age as" = 5,
"slightly older than" = 10,
"older than" = 15,
"much older than" = INFINITY
)


/// Boolean. If set, allows other species to see age descriptions.
/datum/species/var/show_age_to_other_species = FALSE


/datum/species/proc/get_age_comparison_string(mob/living/carbon/human/observed, mob/living/carbon/human/observer)
if (!age_descriptors || !age_diff_descriptors || !istype(observed) || observed.isSynthetic())
return
if (!show_age_to_other_species && name != observer.get_species())
return

var/observed_real_age = observed.age + observed.changed_age
var/observer_real_age = observer.age + observer.changed_age
var/age_diff
var/age_percentile = round((observed_real_age / max_age) * 100)
var/age_descriptor
var/age_diff_descriptor

for (var/descriptor in age_descriptors)
if (age_percentile > age_descriptors[descriptor])
continue
age_descriptor = descriptor
break
if (!age_descriptor)
age_descriptor = age_descriptors[length(age_descriptors)]

if (istype(observer) && observed.get_species() == observer.get_species() && !observer.isSynthetic())
age_diff = observed_real_age - observer_real_age
for (var/descriptor in age_diff_descriptors)
if (age_diff > age_diff_descriptors[descriptor])
continue
age_diff_descriptor = descriptor
break
if (!age_diff_descriptor)
age_diff_descriptor = age_diff_descriptors[length(age_diff_descriptors)]

var/datum/pronouns/pronouns = observed.choose_from_pronouns()
if (age_diff_descriptor)
return "[pronouns.He] [pronouns.is] of [age_descriptor] age for a [name], [age_diff_descriptor] you."
else if (age_descriptor)
return "[pronouns.He] [pronouns.is] of [age_descriptor] age for a [name]."
2 changes: 2 additions & 0 deletions code/modules/species/station/lizard.dm
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@
/obj/item/clothing = /obj/decal/cleanable/blood/tracks/claw // Needs to apply to both shoes and space suits.
)

show_age_to_other_species = TRUE

/datum/species/unathi/equip_survival_gear(mob/living/carbon/human/H)
..()
H.equip_to_slot_or_del(new /obj/item/clothing/shoes/sandal(H),slot_shoes)
Expand Down
2 changes: 2 additions & 0 deletions code/modules/species/station/monkey.dm
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@

ingest_amount = 6

show_age_to_other_species = TRUE

/datum/species/monkey/New()
equip_adjust = list(
slot_l_hand_str = list("[NORTH]" = list("x" = 1, "y" = 3), "[EAST]" = list("x" = -3, "y" = 2), "[SOUTH]" = list("x" = -1, "y" = 3), "[WEST]" = list("x" = 3, "y" = 2)),
Expand Down
2 changes: 2 additions & 0 deletions code/modules/species/station/station.dm
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@
/singleton/emote/exertion/synthetic/creak
)

show_age_to_other_species = TRUE

/datum/species/human/get_bodytype(mob/living/carbon/human/H)
return SPECIES_HUMAN

Expand Down
Loading