From 092417500187797baab12540d9cbf909849bee62 Mon Sep 17 00:00:00 2001 From: Darius <5933805+LeDrascol@users.noreply.github.com> Date: Thu, 8 Dec 2022 03:46:32 -0500 Subject: [PATCH 1/3] Remove maximum age Allows characters to be any age above the minimum. Does not remove or change AGE_MAX definition. --- code/modules/client/preferences.dm | 4 ++-- code/modules/client/preferences_savefile.dm | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index 622f789870..fdd769632c 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -1746,9 +1746,9 @@ GLOBAL_LIST_EMPTY(preferences_datums) 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(Minimum: [AGE_MIN])", "Character Preference") as num|null if(new_age) - age = max(min( round(text2num(new_age)), AGE_MAX),AGE_MIN) + age = max(min( round(text2num(new_age)), INFINITY),AGE_MIN) if("security_records") var/rec = stripped_multiline_input(usr, "Set your security record note section. This should be IC!", "Security Records", html_decode(security_records), MAX_FLAVOR_LEN, TRUE) diff --git a/code/modules/client/preferences_savefile.dm b/code/modules/client/preferences_savefile.dm index 714025e6e2..812723b8fe 100644 --- a/code/modules/client/preferences_savefile.dm +++ b/code/modules/client/preferences_savefile.dm @@ -905,7 +905,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car shirt_color = sanitize_hexcolor(shirt_color, 6, FALSE, initial(shirt_color)) socks = sanitize_inlist(socks, GLOB.socks_list) socks_color = sanitize_hexcolor(socks_color, 6, FALSE, initial(socks_color)) - age = sanitize_integer(age, AGE_MIN, AGE_MAX, initial(age)) + age = sanitize_integer(age, AGE_MIN, INFINITY, initial(age)) hair_color = sanitize_hexcolor(hair_color, 6, FALSE) facial_hair_color = sanitize_hexcolor(facial_hair_color, 6, FALSE) grad_style = sanitize_inlist(grad_style, GLOB.hair_gradients_list, "None") From 7321d42ea57a149c9d68c2f2192f2c83841fed24 Mon Sep 17 00:00:00 2001 From: Darius <5933805+LeDrascol@users.noreply.github.com> Date: Thu, 8 Dec 2022 05:38:47 -0500 Subject: [PATCH 2/3] Reduce max age from INFINITY to SHORT_REAL_LIMIT This effectively reduces the cap to 16777216. --- code/modules/client/preferences.dm | 2 +- code/modules/client/preferences_savefile.dm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index fdd769632c..e03b690313 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -1748,7 +1748,7 @@ GLOBAL_LIST_EMPTY(preferences_datums) if("age") var/new_age = input(user, "Choose your character's age:\n(Minimum: [AGE_MIN])", "Character Preference") as num|null if(new_age) - age = max(min( round(text2num(new_age)), INFINITY),AGE_MIN) + age = max(min( round(text2num(new_age)), SHORT_REAL_LIMIT),AGE_MIN) if("security_records") var/rec = stripped_multiline_input(usr, "Set your security record note section. This should be IC!", "Security Records", html_decode(security_records), MAX_FLAVOR_LEN, TRUE) diff --git a/code/modules/client/preferences_savefile.dm b/code/modules/client/preferences_savefile.dm index 812723b8fe..323398b595 100644 --- a/code/modules/client/preferences_savefile.dm +++ b/code/modules/client/preferences_savefile.dm @@ -905,7 +905,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car shirt_color = sanitize_hexcolor(shirt_color, 6, FALSE, initial(shirt_color)) socks = sanitize_inlist(socks, GLOB.socks_list) socks_color = sanitize_hexcolor(socks_color, 6, FALSE, initial(socks_color)) - age = sanitize_integer(age, AGE_MIN, INFINITY, initial(age)) + age = sanitize_integer(age, AGE_MIN, SHORT_REAL_LIMIT, initial(age)) hair_color = sanitize_hexcolor(hair_color, 6, FALSE) facial_hair_color = sanitize_hexcolor(facial_hair_color, 6, FALSE) grad_style = sanitize_inlist(grad_style, GLOB.hair_gradients_list, "None") From f5cf48532123dd798c66812fc58d633d405ed1b2 Mon Sep 17 00:00:00 2001 From: Darius <5933805+LeDrascol@users.noreply.github.com> Date: Fri, 9 Dec 2022 08:00:19 -0500 Subject: [PATCH 3/3] Separate max age from max age input The maximum character age a user can manually input is now defined by AGE_MAX_INPUT instead of AGE_MAX. These values are identical by default. Also reverts the change to dialog box text. --- code/__DEFINES/mobs.dm | 3 ++- code/modules/client/preferences.dm | 4 ++-- code/modules/client/preferences_savefile.dm | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/code/__DEFINES/mobs.dm b/code/__DEFINES/mobs.dm index 36f427a1bb..cd4e609e7a 100644 --- a/code/__DEFINES/mobs.dm +++ b/code/__DEFINES/mobs.dm @@ -289,7 +289,8 @@ // MINOR TWEAKS/MISC #define AGE_MIN 18 // youngest a character can be // CITADEL EDIT - 17 --> 18 -#define AGE_MAX 85 // oldest a character can be +#define AGE_MAX 85 // oldest a character can be randomly generated +#define AGE_MAX_INPUT 85 // oldest a character's age can be manually set #define WIZARD_AGE_MIN 30 // youngest a wizard can be #define APPRENTICE_AGE_MIN 29 // youngest an apprentice can be #define SHOES_SLOWDOWN 0 // How much shoes slow you down by default. Negative values speed you up diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index e03b690313..98ee55bc17 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -1746,9 +1746,9 @@ GLOBAL_LIST_EMPTY(preferences_datums) 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(Minimum: [AGE_MIN])", "Character Preference") as num|null + var/new_age = input(user, "Choose your character's age:\n([AGE_MIN]-[AGE_MAX_INPUT])", "Character Preference") as num|null if(new_age) - age = max(min( round(text2num(new_age)), SHORT_REAL_LIMIT),AGE_MIN) + age = max(min( round(text2num(new_age)), AGE_MAX_INPUT),AGE_MIN) if("security_records") var/rec = stripped_multiline_input(usr, "Set your security record note section. This should be IC!", "Security Records", html_decode(security_records), MAX_FLAVOR_LEN, TRUE) diff --git a/code/modules/client/preferences_savefile.dm b/code/modules/client/preferences_savefile.dm index 323398b595..3f95e699dc 100644 --- a/code/modules/client/preferences_savefile.dm +++ b/code/modules/client/preferences_savefile.dm @@ -905,7 +905,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car shirt_color = sanitize_hexcolor(shirt_color, 6, FALSE, initial(shirt_color)) socks = sanitize_inlist(socks, GLOB.socks_list) socks_color = sanitize_hexcolor(socks_color, 6, FALSE, initial(socks_color)) - age = sanitize_integer(age, AGE_MIN, SHORT_REAL_LIMIT, initial(age)) + age = sanitize_integer(age, AGE_MIN, AGE_MAX_INPUT, initial(age)) hair_color = sanitize_hexcolor(hair_color, 6, FALSE) facial_hair_color = sanitize_hexcolor(facial_hair_color, 6, FALSE) grad_style = sanitize_inlist(grad_style, GLOB.hair_gradients_list, "None")