mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-22 05:25:15 +01:00
SPECIES NUKING 2023: Head flags 3 & Knuckles: Fixes some growing pains with head flags (#76440)
## About The Pull Request Fixes https://github.com/tgstation/tgstation/issues/76422 This was caused by me somehow not using the wrapper there and not noticing it Also fixes hair gradients and facial hair gradients. I am pretty sure they were uhh, being hidden behind the actual hair/facial hair. Oops. Also also fixes spawning yourself as a human as admin and getting random hair colors. That was just a failure to update the icon after updating everything, I think? Additionally, to totally babyproof all of this, ensures that head_flags involved stuff gets applied AFTER species by creating a new preference priority, and uses two separate wrappers to apply gradient style and color. Here's this absolute hellspawn to prove that everything works.     Sorry for being so damn good at breaking this codebase. ## Why It's Good For The Game Bugs are bad they make you mad ## Changelog 🆑 fix: Hair and facial hair gradients work again now fix: Facial hair colors apply properly again fix: Admin spawned characters will get hair color preferences applied properly /🆑
This commit is contained in:
@@ -5,18 +5,24 @@
|
||||
/// The priority at which species runs, needed for external organs to apply properly.
|
||||
#define PREFERENCE_PRIORITY_SPECIES 2
|
||||
|
||||
/**
|
||||
* Some preferences get applied directly to bodyparts (anything head_flags related right now).
|
||||
* These must apply after species, as species gaining might replace the bodyparts of the human.
|
||||
*/
|
||||
#define PREFERENCE_PRIORITY_BODYPARTS 3
|
||||
|
||||
/// The priority at which gender is determined, needed for proper randomization.
|
||||
#define PREFERENCE_PRIORITY_GENDER 3
|
||||
#define PREFERENCE_PRIORITY_GENDER 4
|
||||
|
||||
/// The priority at which body type is decided, applied after gender so we can
|
||||
/// support the "use gender" option.
|
||||
#define PREFERENCE_PRIORITY_BODY_TYPE 4
|
||||
#define PREFERENCE_PRIORITY_BODY_TYPE 5
|
||||
|
||||
/// The priority at which names are decided, needed for proper randomization.
|
||||
#define PREFERENCE_PRIORITY_NAMES 5
|
||||
#define PREFERENCE_PRIORITY_NAMES 6
|
||||
|
||||
/// Preferences that aren't names, but change the name changes set by PREFERENCE_PRIORITY_NAMES.
|
||||
#define PREFERENCE_PRIORITY_NAME_MODIFICATIONS 6
|
||||
#define PREFERENCE_PRIORITY_NAME_MODIFICATIONS 7
|
||||
|
||||
/// The maximum preference priority, keep this updated, but don't use it for `priority`.
|
||||
#define MAX_PREFERENCE_PRIORITY PREFERENCE_PRIORITY_NAME_MODIFICATIONS
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
return values
|
||||
|
||||
/datum/preference/color/eye_color
|
||||
priority = PREFERENCE_PRIORITY_BODYPARTS
|
||||
savefile_key = "eye_color"
|
||||
savefile_identifier = PREFERENCE_CHARACTER
|
||||
category = PREFERENCE_CATEGORY_SECONDARY_FEATURES
|
||||
@@ -54,6 +55,7 @@
|
||||
return random_eye_color()
|
||||
|
||||
/datum/preference/choiced/facial_hairstyle
|
||||
priority = PREFERENCE_PRIORITY_BODYPARTS
|
||||
savefile_key = "facial_style_name"
|
||||
savefile_identifier = PREFERENCE_CHARACTER
|
||||
category = PREFERENCE_CATEGORY_FEATURES
|
||||
@@ -65,8 +67,7 @@
|
||||
return generate_possible_values_for_sprite_accessories_on_head(GLOB.facial_hairstyles_list)
|
||||
|
||||
/datum/preference/choiced/facial_hairstyle/apply_to_human(mob/living/carbon/human/target, value)
|
||||
target.facial_hairstyle = value
|
||||
target.update_body_parts()
|
||||
target.set_facial_hairstyle(value, update = FALSE)
|
||||
|
||||
/datum/preference/choiced/facial_hairstyle/compile_constant_data()
|
||||
var/list/data = ..()
|
||||
@@ -76,15 +77,17 @@
|
||||
return data
|
||||
|
||||
/datum/preference/color/facial_hair_color
|
||||
priority = PREFERENCE_PRIORITY_BODYPARTS
|
||||
savefile_key = "facial_hair_color"
|
||||
savefile_identifier = PREFERENCE_CHARACTER
|
||||
category = PREFERENCE_CATEGORY_SUPPLEMENTAL_FEATURES
|
||||
relevant_head_flag = HEAD_FACIAL_HAIR
|
||||
|
||||
/datum/preference/color/facial_hair_color/apply_to_human(mob/living/carbon/human/target, value)
|
||||
target.set_facial_haircolor(value, update = TRUE)
|
||||
target.set_facial_haircolor(value, update = FALSE)
|
||||
|
||||
/datum/preference/choiced/facial_hair_gradient
|
||||
priority = PREFERENCE_PRIORITY_BODYPARTS
|
||||
category = PREFERENCE_CATEGORY_SECONDARY_FEATURES
|
||||
savefile_identifier = PREFERENCE_CHARACTER
|
||||
savefile_key = "facial_hair_gradient"
|
||||
@@ -94,19 +97,20 @@
|
||||
return assoc_to_keys_features(GLOB.facial_hair_gradients_list)
|
||||
|
||||
/datum/preference/choiced/facial_hair_gradient/apply_to_human(mob/living/carbon/human/target, value)
|
||||
target.set_facial_hair_gradient(new_style = value, update = TRUE)
|
||||
target.set_facial_hair_gradient_style(new_style = value, update = FALSE)
|
||||
|
||||
/datum/preference/choiced/facial_hair_gradient/create_default_value()
|
||||
return "None"
|
||||
|
||||
/datum/preference/color/facial_hair_gradient
|
||||
priority = PREFERENCE_PRIORITY_BODYPARTS
|
||||
category = PREFERENCE_CATEGORY_SECONDARY_FEATURES
|
||||
savefile_identifier = PREFERENCE_CHARACTER
|
||||
savefile_key = "facial_hair_gradient_color"
|
||||
relevant_head_flag = HEAD_FACIAL_HAIR
|
||||
|
||||
/datum/preference/color/facial_hair_gradient/apply_to_human(mob/living/carbon/human/target, value)
|
||||
target.set_facial_hair_gradient(new_color = value, update = TRUE)
|
||||
target.set_facial_hair_gradient_color(new_color = value, update = FALSE)
|
||||
|
||||
/datum/preference/color/facial_hair_gradient/is_accessible(datum/preferences/preferences)
|
||||
if (!..(preferences))
|
||||
@@ -114,15 +118,17 @@
|
||||
return preferences.read_preference(/datum/preference/choiced/facial_hair_gradient) != "None"
|
||||
|
||||
/datum/preference/color/hair_color
|
||||
priority = PREFERENCE_PRIORITY_BODYPARTS
|
||||
savefile_key = "hair_color"
|
||||
savefile_identifier = PREFERENCE_CHARACTER
|
||||
category = PREFERENCE_CATEGORY_SUPPLEMENTAL_FEATURES
|
||||
relevant_head_flag = HEAD_HAIR
|
||||
|
||||
/datum/preference/color/hair_color/apply_to_human(mob/living/carbon/human/target, value)
|
||||
target.set_haircolor(value, update = TRUE)
|
||||
target.set_haircolor(value, update = FALSE)
|
||||
|
||||
/datum/preference/choiced/hairstyle
|
||||
priority = PREFERENCE_PRIORITY_BODYPARTS
|
||||
savefile_key = "hairstyle_name"
|
||||
savefile_identifier = PREFERENCE_CHARACTER
|
||||
category = PREFERENCE_CATEGORY_FEATURES
|
||||
@@ -134,7 +140,7 @@
|
||||
return generate_possible_values_for_sprite_accessories_on_head(GLOB.hairstyles_list)
|
||||
|
||||
/datum/preference/choiced/hairstyle/apply_to_human(mob/living/carbon/human/target, value)
|
||||
target.set_hairstyle(value, update = TRUE)
|
||||
target.set_hairstyle(value, update = FALSE)
|
||||
|
||||
/datum/preference/choiced/hairstyle/compile_constant_data()
|
||||
var/list/data = ..()
|
||||
@@ -144,6 +150,7 @@
|
||||
return data
|
||||
|
||||
/datum/preference/choiced/hair_gradient
|
||||
priority = PREFERENCE_PRIORITY_BODYPARTS
|
||||
category = PREFERENCE_CATEGORY_SECONDARY_FEATURES
|
||||
savefile_identifier = PREFERENCE_CHARACTER
|
||||
savefile_key = "hair_gradient"
|
||||
@@ -153,19 +160,20 @@
|
||||
return assoc_to_keys_features(GLOB.hair_gradients_list)
|
||||
|
||||
/datum/preference/choiced/hair_gradient/apply_to_human(mob/living/carbon/human/target, value)
|
||||
target.set_hair_gradient(new_style = value, update = TRUE)
|
||||
target.set_hair_gradient_style(new_style = value, update = FALSE)
|
||||
|
||||
/datum/preference/choiced/hair_gradient/create_default_value()
|
||||
return "None"
|
||||
|
||||
/datum/preference/color/hair_gradient
|
||||
priority = PREFERENCE_PRIORITY_BODYPARTS
|
||||
category = PREFERENCE_CATEGORY_SECONDARY_FEATURES
|
||||
savefile_identifier = PREFERENCE_CHARACTER
|
||||
savefile_key = "hair_gradient_color"
|
||||
relevant_head_flag = HEAD_HAIR
|
||||
|
||||
/datum/preference/color/hair_gradient/apply_to_human(mob/living/carbon/human/target, value)
|
||||
target.set_hair_gradient(new_color = value, update = TRUE)
|
||||
target.set_hair_gradient_color(new_color = value, update = FALSE)
|
||||
|
||||
/datum/preference/color/hair_gradient/is_accessible(datum/preferences/preferences)
|
||||
if (!..(preferences))
|
||||
|
||||
Reference in New Issue
Block a user