[MIRROR] Allows any character to use the body type setting regardless of gender [MDB IGNORE] (#9426)

* Allows any character to use the body type setting regardless of gender

* Feex

* Another feex

* Avoiding savefile corruption

* Shut up linters

Co-authored-by: Thunder12345 <Thunder12345@users.noreply.github.com>
Co-authored-by: GoldenAlpharex <jerego1234@hotmail.com>
This commit is contained in:
SkyratBot
2021-11-14 15:18:56 -05:00
committed by GitHub
co-authored by Thunder12345 GoldenAlpharex
parent 72cabc0122
commit 196eb4354f
7 changed files with 36 additions and 12 deletions
@@ -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.
+14 -7
View File
@@ -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
*/
@@ -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")
+8 -2
View File
@@ -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)
@@ -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
+2 -1
View File
@@ -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"