diff --git a/code/modules/client/preferences/_preference.dm b/code/modules/client/preferences/_preference.dm index 26867462dfa..a68a74916eb 100644 --- a/code/modules/client/preferences/_preference.dm +++ b/code/modules/client/preferences/_preference.dm @@ -9,7 +9,7 @@ #define PREFERENCE_PRIORITY_GENDER 3 /// The priority at which body type is decided, applied after gender so we can -/// make sure they're non-binary. +/// support the "use gender" option. #define PREFERENCE_PRIORITY_BODY_TYPE 4 /// The priority at which names are decided, needed for proper randomization. diff --git a/code/modules/client/preferences/body_type.dm b/code/modules/client/preferences/body_type.dm index 37afcd3c4f2..6f5fc7f8301 100644 --- a/code/modules/client/preferences/body_type.dm +++ b/code/modules/client/preferences/body_type.dm @@ -1,23 +1,30 @@ /* SKYRAT EDIT REMOVAL +#define USE_GENDER "Use gender" + /datum/preference/choiced/body_type - category = PREFERENCE_CATEGORY_NON_CONTEXTUAL + category = PREFERENCE_CATEGORY_SECONDARY_FEATURES priority = PREFERENCE_PRIORITY_BODY_TYPE savefile_key = "body_type" savefile_identifier = PREFERENCE_CHARACTER /datum/preference/choiced/body_type/init_possible_values() - return list(MALE, FEMALE) + return list(USE_GENDER, MALE, FEMALE) + +/datum/preference/choiced/body_type/create_default_value() + return USE_GENDER /datum/preference/choiced/body_type/apply_to_human(mob/living/carbon/human/target, value) - if (target.gender != MALE && target.gender != FEMALE) - target.body_type = value - else + if (value == USE_GENDER) target.body_type = target.gender + else + target.body_type = value /datum/preference/choiced/body_type/is_accessible(datum/preferences/preferences) if (!..(preferences)) return FALSE - var/gender = preferences.read_preference(/datum/preference/choiced/gender) - return gender != MALE && gender != FEMALE + var/datum/species/species = preferences.read_preference(/datum/preference/choiced/species) + return initial(species.sexes) + +#undef USE_GENDER */ diff --git a/code/modules/client/preferences/migrations/body_type_migration.dm b/code/modules/client/preferences/migrations/body_type_migration.dm new file mode 100644 index 00000000000..df599fd9aea --- /dev/null +++ b/code/modules/client/preferences/migrations/body_type_migration.dm @@ -0,0 +1,10 @@ +/// Previously, body types could only be used on non-binary characters. +/// PR #62733 changed this to allow all characters to use body type. +/// This migration moves binary-gendered characters over to the "use gender" body type +/// so that old characters are preserved. +/datum/preferences/proc/migrate_body_types(savefile/savefile) + var/current_gender + + READ_FILE(savefile["gender"], current_gender) + if (current_gender == MALE || current_gender == FEMALE) + WRITE_FILE(savefile["body_type"], "Use gender") diff --git a/code/modules/client/preferences/tgui_prefs_migration.dm b/code/modules/client/preferences/migrations/tgui_prefs_migration.dm similarity index 100% rename from code/modules/client/preferences/tgui_prefs_migration.dm rename to code/modules/client/preferences/migrations/tgui_prefs_migration.dm diff --git a/code/modules/client/preferences_savefile.dm b/code/modules/client/preferences_savefile.dm index 117db16680e..c952fcee525 100644 --- a/code/modules/client/preferences_savefile.dm +++ b/code/modules/client/preferences_savefile.dm @@ -5,7 +5,7 @@ // You do not need to raise this if you are adding new values that have sane defaults. // Only raise this value when changing the meaning/format/name/layout of an existing value // where you would want the updater procs below to run -#define SAVEFILE_VERSION_MAX 41 +#define SAVEFILE_VERSION_MAX 42 /* SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Carn @@ -96,10 +96,16 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car if (current_version < 41) migrate_preferences_to_tgui_prefs_menu() -/datum/preferences/proc/update_character(current_version) +/datum/preferences/proc/update_character(current_version, savefile/savefile) if (current_version < 41) migrate_character_to_tgui_prefs_menu() + if (current_version < 42) + // migrate_body_types(savefile) // SKYRAT EDIT - This'll fuck up savefiles + return // SKYRAT EDIT - Linters won't shut up otherwise, changing this in the next PR. + + return // SKYRAT EDIT - Linters won't shut up otherwise + /// checks through keybindings for outdated unbound keys and updates them /datum/preferences/proc/check_keybindings() if(!parent) diff --git a/code/modules/mob/living/carbon/human/human_defines.dm b/code/modules/mob/living/carbon/human/human_defines.dm index e8fd3a45921..438467c684f 100644 --- a/code/modules/mob/living/carbon/human/human_defines.dm +++ b/code/modules/mob/living/carbon/human/human_defines.dm @@ -74,7 +74,7 @@ var/account_id var/hardcore_survival_score = 0 - /// For agendered spessmen, which body type to use + /// Which body type to use var/body_type = MALE /// How many "units of blood" we have on our hands diff --git a/tgstation.dme b/tgstation.dme index 477e2068383..16991f6d4b9 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -2228,7 +2228,6 @@ #include "code\modules\client\preferences\skin_tone.dm" #include "code\modules\client\preferences\species.dm" #include "code\modules\client\preferences\tgui.dm" -#include "code\modules\client\preferences\tgui_prefs_migration.dm" #include "code\modules\client\preferences\tooltips.dm" #include "code\modules\client\preferences\ui_style.dm" #include "code\modules\client\preferences\underwear_color.dm" @@ -2244,6 +2243,8 @@ #include "code\modules\client\preferences\middleware\quirks.dm" #include "code\modules\client\preferences\middleware\random.dm" #include "code\modules\client\preferences\middleware\species.dm" +#include "code\modules\client\preferences\migrations\body_type_migration.dm" +#include "code\modules\client\preferences\migrations\tgui_prefs_migration.dm" #include "code\modules\client\preferences\species_features\basic.dm" #include "code\modules\client\preferences\species_features\ethereal.dm" #include "code\modules\client\preferences\species_features\felinid.dm"