mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-26 22:50:26 +01:00
Fixes the prefs dummy not updating for species features / Bald quirk prefs QoL (#89833)
## About The Pull Request  Fixes #89768 Fixes #89769 - Fixes the prefs menu not updating mobs Organs are imprinted on insert, and SSwardrobe didn't reset this imprinting status when taking out items. Weirdly in the past (testing old commits) items withdrawn DID reset imprinting status - or maybe they never set it in the first place? - Lots of prefs now respect features `is_accessible` is used when checking many features rather than the prefs menu checking itself in the UI - Bald quirk QOL Just handy stuff like showing the wig in the prefs preview, pre-starting with your hat attached ## Changelog 🆑 Melbert fix: Preference dummy now properly updates when changing some species features qol: If you have the bald quirk selected, the wig shows up on the preference dummy qol: If you have the bald quirk selected, and your role starts with a hat, the hat will start attached to your wig /🆑
This commit is contained in:
@@ -325,23 +325,27 @@ GLOBAL_LIST_INIT(preference_entries_by_key, init_preference_entries_by_key())
|
||||
|
||||
return null
|
||||
|
||||
/// Checks the species currently selected by the passed preferences object to see if it has this preference's key as a feature.
|
||||
/datum/preference/proc/current_species_has_savekey(datum/preferences/preferences)
|
||||
var/species_type = preferences.read_preference(/datum/preference/choiced/species)
|
||||
var/datum/species/species = GLOB.species_prototypes[species_type]
|
||||
return (savefile_key in species.get_features())
|
||||
|
||||
/// Checks if this preference is relevant and thus visible to the passed preferences object.
|
||||
/datum/preference/proc/has_relevant_feature(datum/preferences/preferences)
|
||||
if(isnull(relevant_inherent_trait) && isnull(relevant_external_organ) && isnull(relevant_head_flag) && isnull(relevant_body_markings))
|
||||
return TRUE
|
||||
|
||||
return current_species_has_savekey(preferences)
|
||||
|
||||
/// Returns whether or not this preference is accessible.
|
||||
/// If FALSE, will not show in the UI and will not be editable (by update_preference).
|
||||
/datum/preference/proc/is_accessible(datum/preferences/preferences)
|
||||
SHOULD_CALL_PARENT(TRUE)
|
||||
SHOULD_NOT_SLEEP(TRUE)
|
||||
|
||||
if ( \
|
||||
!isnull(relevant_inherent_trait) \
|
||||
|| !isnull(relevant_external_organ) \
|
||||
|| !isnull(relevant_head_flag) \
|
||||
|| !isnull(relevant_body_markings) \
|
||||
)
|
||||
var/species_type = preferences.read_preference(/datum/preference/choiced/species)
|
||||
|
||||
var/datum/species/species = GLOB.species_prototypes[species_type]
|
||||
if (!(savefile_key in species.get_features()))
|
||||
return FALSE
|
||||
if (!has_relevant_feature(preferences))
|
||||
return FALSE
|
||||
|
||||
if (!should_show_on_page(preferences.current_window))
|
||||
return FALSE
|
||||
|
||||
@@ -143,6 +143,9 @@
|
||||
category = PREFERENCE_CATEGORY_SUPPLEMENTAL_FEATURES
|
||||
relevant_head_flag = HEAD_HAIR
|
||||
|
||||
/datum/preference/color/hair_color/has_relevant_feature(datum/preferences/preferences)
|
||||
return ..() || (/datum/quirk/item_quirk/bald::name in preferences.all_quirks)
|
||||
|
||||
/datum/preference/color/hair_color/apply_to_human(mob/living/carbon/human/target, value)
|
||||
target.set_haircolor(value, update = FALSE)
|
||||
|
||||
@@ -158,6 +161,9 @@
|
||||
should_generate_icons = TRUE
|
||||
relevant_head_flag = HEAD_HAIR
|
||||
|
||||
/datum/preference/choiced/hairstyle/has_relevant_feature(datum/preferences/preferences)
|
||||
return ..() || (/datum/quirk/item_quirk/bald::name in preferences.all_quirks)
|
||||
|
||||
/datum/preference/choiced/hairstyle/init_possible_values()
|
||||
return assoc_to_keys_features(SSaccessories.hairstyles_list)
|
||||
|
||||
|
||||
@@ -5,6 +5,10 @@
|
||||
main_feature_name = "Ethereal color"
|
||||
should_generate_icons = TRUE
|
||||
|
||||
/datum/preference/choiced/ethereal_color/has_relevant_feature(datum/preferences/preferences)
|
||||
// Skips checks for relevant_organ, relevant trait etc. because ethereal color is tied directly to species (atm)
|
||||
return current_species_has_savekey(preferences)
|
||||
|
||||
/datum/preference/choiced/ethereal_color/init_possible_values()
|
||||
return assoc_to_keys(GLOB.color_list_ethereal)
|
||||
|
||||
|
||||
@@ -63,6 +63,7 @@
|
||||
category = PREFERENCE_CATEGORY_FEATURES
|
||||
main_feature_name = "Frills"
|
||||
should_generate_icons = TRUE
|
||||
relevant_external_organ = /obj/item/organ/frills
|
||||
|
||||
/datum/preference/choiced/lizard_frills/init_possible_values()
|
||||
return assoc_to_keys_features(SSaccessories.frills_list)
|
||||
@@ -79,6 +80,7 @@
|
||||
category = PREFERENCE_CATEGORY_FEATURES
|
||||
main_feature_name = "Horns"
|
||||
should_generate_icons = TRUE
|
||||
relevant_external_organ = /obj/item/organ/horns
|
||||
|
||||
/datum/preference/choiced/lizard_horns/init_possible_values()
|
||||
return assoc_to_keys_features(SSaccessories.horns_list)
|
||||
@@ -134,6 +136,7 @@
|
||||
category = PREFERENCE_CATEGORY_FEATURES
|
||||
main_feature_name = "Snout"
|
||||
should_generate_icons = TRUE
|
||||
relevant_external_organ = /obj/item/organ/snout
|
||||
|
||||
/datum/preference/choiced/lizard_snout/init_possible_values()
|
||||
return assoc_to_keys_features(SSaccessories.snouts_list)
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
category = PREFERENCE_CATEGORY_FEATURES
|
||||
main_feature_name = "Antennae"
|
||||
should_generate_icons = TRUE
|
||||
relevant_external_organ = /obj/item/organ/antennae
|
||||
|
||||
/datum/preference/choiced/moth_antennae/init_possible_values()
|
||||
return assoc_to_keys_features(SSaccessories.moth_antennae_list)
|
||||
@@ -84,6 +85,7 @@
|
||||
category = PREFERENCE_CATEGORY_FEATURES
|
||||
main_feature_name = "Moth wings"
|
||||
should_generate_icons = TRUE
|
||||
relevant_external_organ = /obj/item/organ/wings/moth
|
||||
|
||||
/datum/preference/choiced/moth_wings/init_possible_values()
|
||||
return assoc_to_keys_features(SSaccessories.moth_wings_list)
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
category = PREFERENCE_CATEGORY_FEATURES
|
||||
main_feature_name = "Hairstyle"
|
||||
should_generate_icons = TRUE
|
||||
relevant_external_organ = /obj/item/organ/pod_hair
|
||||
|
||||
/datum/preference/choiced/pod_hair/init_possible_values()
|
||||
return assoc_to_keys_features(SSaccessories.pod_hair_list)
|
||||
|
||||
Reference in New Issue
Block a user