From 764aed10c53064fba2ec5295d3ecb32b391f6866 Mon Sep 17 00:00:00 2001
From: Henri215 <77684085+Henri215@users.noreply.github.com>
Date: Mon, 22 May 2023 17:04:42 -0300
Subject: [PATCH] Adds custom age limits to each species (#20878)
* Custom min/max ages for species
* fixing the pitch
* tweaking AGE_MAX
* Revert "tweaking AGE_MAX"
This reverts commit 0270ba6840d91f19a43538d94b254d1bc85cec3c.
* max_age decreased roughly by 10%
* Update code/__DEFINES/mob_defines.dm
Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>
* machine minimum age
* clamp
* Adjustments to ages
* age max
* Update code/modules/mob/living/carbon/human/species/_species.dm
Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>
* clamp and age pitch tweaks
* finally found plasmaman lifespan1
---------
Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>
---
code/__DEFINES/mob_defines.dm | 2 +-
code/datums/emote.dm | 2 +-
code/game/machinery/computer/medical_records.dm | 2 +-
code/game/machinery/computer/security_records.dm | 2 +-
code/modules/client/preference/character.dm | 4 ++--
code/modules/client/preference/link_processing.dm | 7 ++++---
code/modules/mob/living/carbon/human/human_emote.dm | 2 +-
code/modules/mob/living/carbon/human/human_mob.dm | 4 ++--
code/modules/mob/living/carbon/human/human_say.dm | 2 +-
code/modules/mob/living/carbon/human/species/_species.dm | 5 +++++
.../mob/living/carbon/human/species/diona_species.dm | 1 +
code/modules/mob/living/carbon/human/species/drask.dm | 1 +
code/modules/mob/living/carbon/human/species/golem.dm | 1 +
code/modules/mob/living/carbon/human/species/grey.dm | 1 +
code/modules/mob/living/carbon/human/species/kidan.dm | 1 +
code/modules/mob/living/carbon/human/species/machine.dm | 1 +
code/modules/mob/living/carbon/human/species/moth.dm | 1 +
code/modules/mob/living/carbon/human/species/plasmaman.dm | 1 +
code/modules/mob/living/carbon/human/species/skrell.dm | 1 +
.../modules/mob/living/carbon/human/species/slimepeople.dm | 1 +
code/modules/mob/living/carbon/human/species/unathi.dm | 1 +
code/modules/mob/living/carbon/human/species/vox.dm | 1 +
code/modules/mob/living/carbon/human/species/vulpkanin.dm | 1 +
code/modules/mob/living/living_emote.dm | 2 +-
24 files changed, 33 insertions(+), 14 deletions(-)
diff --git a/code/__DEFINES/mob_defines.dm b/code/__DEFINES/mob_defines.dm
index e187c490981..b2241722f12 100644
--- a/code/__DEFINES/mob_defines.dm
+++ b/code/__DEFINES/mob_defines.dm
@@ -36,7 +36,7 @@
#define MOB_PLANT (1 << 10)
#define AGE_MIN 17 //youngest a character can be
-#define AGE_MAX 85 //oldest a character can be
+#define AGE_MAX 500 //oldest a character can be
/// Mob is standing up, usually associated with lying_angle value of 0.
#define STANDING_UP 0
diff --git a/code/datums/emote.dm b/code/datums/emote.dm
index 0ee5a322992..8e15c6f29e0 100644
--- a/code/datums/emote.dm
+++ b/code/datums/emote.dm
@@ -267,7 +267,7 @@
if(age_based && ishuman(user))
var/mob/living/carbon/human/H = user
// Vary needs to be true as otherwise frequency changes get ignored deep within playsound_local :(
- playsound(user.loc, sound_path, sound_volume, TRUE, frequency = H.get_age_pitch())
+ playsound(user.loc, sound_path, sound_volume, TRUE, frequency = H.get_age_pitch(H.dna.species.max_age))
else
playsound(user.loc, sound_path, sound_volume, vary)
diff --git a/code/game/machinery/computer/medical_records.dm b/code/game/machinery/computer/medical_records.dm
index d88ade4ad15..fe4bd70aeba 100644
--- a/code/game/machinery/computer/medical_records.dm
+++ b/code/game/machinery/computer/medical_records.dm
@@ -429,7 +429,7 @@
if(2)
R.fields["sex"] = pick("Male", "Female")
if(3)
- R.fields["age"] = rand(5, 85)
+ R.fields["age"] = rand(AGE_MIN, AGE_MAX)
if(4)
R.fields["blood_type"] = pick("A-", "B-", "AB-", "O-", "A+", "B+", "AB+", "O+")
if(5)
diff --git a/code/game/machinery/computer/security_records.dm b/code/game/machinery/computer/security_records.dm
index ec063dd3127..4d14336ef5c 100644
--- a/code/game/machinery/computer/security_records.dm
+++ b/code/game/machinery/computer/security_records.dm
@@ -441,7 +441,7 @@
if(2)
R.fields["sex"] = pick("Male", "Female")
if(3)
- R.fields["age"] = rand(5, 85)
+ R.fields["age"] = rand(AGE_MIN, AGE_MAX)
if(4)
R.fields["criminal"] = pick(SEC_RECORD_STATUS_NONE, SEC_RECORD_STATUS_ARREST, SEC_RECORD_STATUS_SEARCH, SEC_RECORD_STATUS_MONITOR, SEC_RECORD_STATUS_DEMOTE, SEC_RECORD_STATUS_INCARCERATED, SEC_RECORD_STATUS_PAROLLED, SEC_RECORD_STATUS_RELEASED)
if(5)
diff --git a/code/modules/client/preference/character.dm b/code/modules/client/preference/character.dm
index 013e3404ddc..00afc39944f 100644
--- a/code/modules/client/preference/character.dm
+++ b/code/modules/client/preference/character.dm
@@ -481,7 +481,7 @@
be_random_name = sanitize_integer(be_random_name, 0, 1, initial(be_random_name))
gender = sanitize_gender(gender, FALSE, !SP.has_gender)
- age = sanitize_integer(age, AGE_MIN, AGE_MAX, initial(age))
+ age = sanitize_integer(age, SP.min_age, SP.max_age, initial(age))
h_colour = sanitize_hexcolor(h_colour)
h_sec_colour = sanitize_hexcolor(h_sec_colour)
f_colour = sanitize_hexcolor(f_colour)
@@ -596,7 +596,7 @@
if(S.bodyflags & HAS_SKIN_COLOR)
randomize_skin_color()
backbag = 2
- age = rand(AGE_MIN, AGE_MAX)
+ age = rand(S.min_age, S.max_age)
/datum/character_save/proc/randomize_hair_color(target = "hair")
diff --git a/code/modules/client/preference/link_processing.dm b/code/modules/client/preference/link_processing.dm
index 2326416ad12..6d7e18e5ffc 100644
--- a/code/modules/client/preference/link_processing.dm
+++ b/code/modules/client/preference/link_processing.dm
@@ -135,7 +135,7 @@
var/mob/new_player/N = user
N.new_player_panel_proc()
if("age")
- active_character.age = rand(AGE_MIN, AGE_MAX)
+ active_character.age = rand(S.min_age , S.max_age)
if("hair")
if(!(S.bodyflags & BALD))
active_character.h_colour = rand_hex_color()
@@ -212,9 +212,9 @@
to_chat(user, "Invalid name. Your name should be at least 2 and at most [MAX_NAME_LEN] characters long. It may only contain the characters A-Z, a-z, -, ' and .")
if("age")
- var/new_age = input(user, "Choose your character's age:\n([AGE_MIN]-[AGE_MAX])", "Character Preference") as num|null
+ var/new_age = input(user, "Choose your character's age:\n([S.min_age]-[S.max_age])", "Character Preference") as num|null
if(new_age)
- active_character.age = max(min(round(text2num(new_age)), AGE_MAX),AGE_MIN)
+ active_character.age = max(min(round(text2num(new_age)), S.max_age), S.min_age)
if("species")
var/list/new_species = list()
var/prev_species = active_character.species
@@ -230,6 +230,7 @@
to_chat(user, "Invalid species, please pick something else.")
return
if(prev_species != active_character.species)
+ active_character.age = clamp(active_character.age, NS.min_age, NS.max_age)
if(NS.has_gender && active_character.gender == PLURAL)
active_character.gender = pick(MALE,FEMALE)
var/datum/robolimb/robohead
diff --git a/code/modules/mob/living/carbon/human/human_emote.dm b/code/modules/mob/living/carbon/human/human_emote.dm
index 54aec1862e7..9480ed5a5d3 100644
--- a/code/modules/mob/living/carbon/human/human_emote.dm
+++ b/code/modules/mob/living/carbon/human/human_emote.dm
@@ -167,7 +167,7 @@
volume_decrease = 95
sound_volume -= volume_decrease
// special handling here: we don't want monkeys' gasps to sound through walls so you can actually walk past xenobio
- playsound(user.loc, sound_path, sound_volume, TRUE, -10, frequency = H.get_age_pitch(), ignore_walls = !isnull(user.mind))
+ playsound(user.loc, sound_path, sound_volume, TRUE, -10, frequency = H.get_age_pitch(H.dna.species.max_age), ignore_walls = !isnull(user.mind))
/datum/emote/living/carbon/human/shake
key = "shake"
diff --git a/code/modules/mob/living/carbon/human/human_mob.dm b/code/modules/mob/living/carbon/human/human_mob.dm
index 84e145521e2..dce5539fcd1 100644
--- a/code/modules/mob/living/carbon/human/human_mob.dm
+++ b/code/modules/mob/living/carbon/human/human_mob.dm
@@ -1817,8 +1817,8 @@ Eyes need to have significantly high darksight to shine unless the mob has the X
return ..()
-/mob/living/carbon/human/proc/get_age_pitch()
- return 1.0 + 0.5*(30 - age)/80
+/mob/living/carbon/human/proc/get_age_pitch(species_pitch = 85)
+ return 1.0 + 0.5 * ((species_pitch * 0.35) - age) / (0.94 * species_pitch)
/mob/living/carbon/human/get_access()
. = ..()
diff --git a/code/modules/mob/living/carbon/human/human_say.dm b/code/modules/mob/living/carbon/human/human_say.dm
index 4b727944929..39158d342de 100644
--- a/code/modules/mob/living/carbon/human/human_say.dm
+++ b/code/modules/mob/living/carbon/human/human_say.dm
@@ -238,7 +238,7 @@ GLOBAL_LIST_INIT(soapy_words, list(
if(dna.species.speech_sounds && prob(dna.species.speech_chance))
returns[1] = sound(pick(dna.species.speech_sounds))
returns[2] = 50
- returns[3] = get_age_pitch()
+ returns[3] = get_age_pitch(dna.species.max_age)
return returns
/mob/living/carbon/human/binarycheck()
diff --git a/code/modules/mob/living/carbon/human/species/_species.dm b/code/modules/mob/living/carbon/human/species/_species.dm
index c9cb9864a62..86f1f6f0841 100644
--- a/code/modules/mob/living/carbon/human/species/_species.dm
+++ b/code/modules/mob/living/carbon/human/species/_species.dm
@@ -3,6 +3,11 @@
var/name_plural // Pluralized name (since "[name]s" is not always valid)
var/icobase = 'icons/mob/human_races/r_human.dmi' // Normal icon set.
+ /// Minimum age this species can have
+ var/min_age = AGE_MIN
+ /// Maximum age this species can have
+ var/max_age = 85
+
// Damage overlay and masks.
var/damage_overlays = 'icons/mob/human_races/masks/dam_human.dmi'
var/damage_mask = 'icons/mob/human_races/masks/dam_mask_human.dmi'
diff --git a/code/modules/mob/living/carbon/human/species/diona_species.dm b/code/modules/mob/living/carbon/human/species/diona_species.dm
index cb7a2f5fc8b..be19ad244d7 100644
--- a/code/modules/mob/living/carbon/human/species/diona_species.dm
+++ b/code/modules/mob/living/carbon/human/species/diona_species.dm
@@ -1,6 +1,7 @@
/datum/species/diona
name = "Diona"
name_plural = "Dionaea"
+ max_age = 300
icobase = 'icons/mob/human_races/r_diona.dmi'
language = "Rootspeak"
speech_sounds = list('sound/voice/dionatalk1.ogg') //Credit https://www.youtube.com/watch?v=ufnvlRjsOTI [0:13 - 0:16]
diff --git a/code/modules/mob/living/carbon/human/species/drask.dm b/code/modules/mob/living/carbon/human/species/drask.dm
index 876d7766407..5a02dd6f2c8 100644
--- a/code/modules/mob/living/carbon/human/species/drask.dm
+++ b/code/modules/mob/living/carbon/human/species/drask.dm
@@ -1,6 +1,7 @@
/datum/species/drask
name = "Drask"
name_plural = "Drask"
+ max_age = 500
icobase = 'icons/mob/human_races/r_drask.dmi'
language = "Orluum"
eyes = "drask_eyes_s"
diff --git a/code/modules/mob/living/carbon/human/species/golem.dm b/code/modules/mob/living/carbon/human/species/golem.dm
index 5b11d3d773a..f6af90ce553 100644
--- a/code/modules/mob/living/carbon/human/species/golem.dm
+++ b/code/modules/mob/living/carbon/human/species/golem.dm
@@ -1,6 +1,7 @@
/datum/species/golem
name = "Golem"
name_plural = "Golems"
+ max_age = 300
icobase = 'icons/mob/human_races/r_golem.dmi'
diff --git a/code/modules/mob/living/carbon/human/species/grey.dm b/code/modules/mob/living/carbon/human/species/grey.dm
index 9c38ee94acc..508104ba422 100644
--- a/code/modules/mob/living/carbon/human/species/grey.dm
+++ b/code/modules/mob/living/carbon/human/species/grey.dm
@@ -1,6 +1,7 @@
/datum/species/grey
name = "Grey"
name_plural = "Greys"
+ max_age = 50
icobase = 'icons/mob/human_races/r_grey.dmi'
language = "Psionic Communication"
eyes = "grey_eyes_s"
diff --git a/code/modules/mob/living/carbon/human/species/kidan.dm b/code/modules/mob/living/carbon/human/species/kidan.dm
index faf246243ab..0cdc471f598 100644
--- a/code/modules/mob/living/carbon/human/species/kidan.dm
+++ b/code/modules/mob/living/carbon/human/species/kidan.dm
@@ -1,6 +1,7 @@
/datum/species/kidan
name = "Kidan"
name_plural = "Kidan"
+ max_age = 55
icobase = 'icons/mob/human_races/r_kidan.dmi'
language = "Chittin"
unarmed_type = /datum/unarmed_attack/claws
diff --git a/code/modules/mob/living/carbon/human/species/machine.dm b/code/modules/mob/living/carbon/human/species/machine.dm
index 299e0d42876..7c0aa0a0de0 100644
--- a/code/modules/mob/living/carbon/human/species/machine.dm
+++ b/code/modules/mob/living/carbon/human/species/machine.dm
@@ -1,6 +1,7 @@
/datum/species/machine
name = "Machine"
name_plural = "Machines"
+ max_age = 60
blurb = "Positronic intelligence really took off in the 26th century, and it is not uncommon to see independent, free-willed \
robots on many human stations, particularly in fringe systems where standards are slightly lax and public opinion less relevant \
diff --git a/code/modules/mob/living/carbon/human/species/moth.dm b/code/modules/mob/living/carbon/human/species/moth.dm
index d2f63a61eb0..1b8c646eabc 100644
--- a/code/modules/mob/living/carbon/human/species/moth.dm
+++ b/code/modules/mob/living/carbon/human/species/moth.dm
@@ -7,6 +7,7 @@
/datum/species/moth
name = "Nian"
name_plural = "Nianae"
+ max_age = 64
language = "Tkachi"
icobase = 'icons/mob/human_races/r_moth.dmi'
inherent_factions = list("nian")
diff --git a/code/modules/mob/living/carbon/human/species/plasmaman.dm b/code/modules/mob/living/carbon/human/species/plasmaman.dm
index 34c88ca6459..92380e9a7bd 100644
--- a/code/modules/mob/living/carbon/human/species/plasmaman.dm
+++ b/code/modules/mob/living/carbon/human/species/plasmaman.dm
@@ -1,6 +1,7 @@
/datum/species/plasmaman
name = "Plasmaman"
name_plural = "Plasmamen"
+ max_age = 150
icobase = 'icons/mob/human_races/r_plasmaman_sb.dmi'
dangerous_existence = TRUE //So so much
//language = "Clatter"
diff --git a/code/modules/mob/living/carbon/human/species/skrell.dm b/code/modules/mob/living/carbon/human/species/skrell.dm
index 6ad25035d04..1a9fcc3510d 100644
--- a/code/modules/mob/living/carbon/human/species/skrell.dm
+++ b/code/modules/mob/living/carbon/human/species/skrell.dm
@@ -1,6 +1,7 @@
/datum/species/skrell
name = "Skrell"
name_plural = "Skrell"
+ max_age = 70
icobase = 'icons/mob/human_races/r_skrell.dmi'
language = "Skrellian"
primitive_form = /datum/species/monkey/skrell
diff --git a/code/modules/mob/living/carbon/human/species/slimepeople.dm b/code/modules/mob/living/carbon/human/species/slimepeople.dm
index e427354ca2d..de168eb04aa 100644
--- a/code/modules/mob/living/carbon/human/species/slimepeople.dm
+++ b/code/modules/mob/living/carbon/human/species/slimepeople.dm
@@ -9,6 +9,7 @@
/datum/species/slime
name = "Slime People"
name_plural = "Slime People"
+ max_age = 130
language = "Bubblish"
icobase = 'icons/mob/human_races/r_slime.dmi'
remains_type = /obj/effect/decal/remains/slime
diff --git a/code/modules/mob/living/carbon/human/species/unathi.dm b/code/modules/mob/living/carbon/human/species/unathi.dm
index d8741bc731a..ec2c3cba06f 100644
--- a/code/modules/mob/living/carbon/human/species/unathi.dm
+++ b/code/modules/mob/living/carbon/human/species/unathi.dm
@@ -1,6 +1,7 @@
/datum/species/unathi
name = "Unathi"
name_plural = "Unathi"
+ max_age = 45
icobase = 'icons/mob/human_races/r_lizard.dmi'
language = "Sinta'unathi"
tail = "sogtail"
diff --git a/code/modules/mob/living/carbon/human/species/vox.dm b/code/modules/mob/living/carbon/human/species/vox.dm
index 7c680bd4d60..06ab94506ba 100644
--- a/code/modules/mob/living/carbon/human/species/vox.dm
+++ b/code/modules/mob/living/carbon/human/species/vox.dm
@@ -1,6 +1,7 @@
/datum/species/vox
name = "Vox"
name_plural = "Vox"
+ max_age = 54
icobase = 'icons/mob/human_races/vox/r_vox.dmi'
dangerous_existence = TRUE
language = "Vox-pidgin"
diff --git a/code/modules/mob/living/carbon/human/species/vulpkanin.dm b/code/modules/mob/living/carbon/human/species/vulpkanin.dm
index a02de90a0fb..2e9380e0098 100644
--- a/code/modules/mob/living/carbon/human/species/vulpkanin.dm
+++ b/code/modules/mob/living/carbon/human/species/vulpkanin.dm
@@ -1,6 +1,7 @@
/datum/species/vulpkanin
name = "Vulpkanin"
name_plural = "Vulpkanin"
+ max_age = 80
icobase = 'icons/mob/human_races/r_vulpkanin.dmi'
language = "Canilunzt"
primitive_form = /datum/species/monkey/vulpkanin
diff --git a/code/modules/mob/living/living_emote.dm b/code/modules/mob/living/living_emote.dm
index 61540fb7601..f0f497a4937 100644
--- a/code/modules/mob/living/living_emote.dm
+++ b/code/modules/mob/living/living_emote.dm
@@ -120,7 +120,7 @@
if(!istype(H))
return ..()
// special handling here: we don't want monkeys' gasps to sound through walls so you can actually walk past xenobio
- playsound(user.loc, sound_path, sound_volume, TRUE, -8, frequency = H.get_age_pitch(), ignore_walls = !isnull(user.mind))
+ playsound(user.loc, sound_path, sound_volume, TRUE, -8, frequency = H.get_age_pitch(H.dna.species.max_age), ignore_walls = !isnull(user.mind))
/datum/emote/living/drool
key = "drool"