mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-14 01:24:21 +01:00
[MIRROR] makes it so the sanitize_hexcolors' default is 6 characters rather than 3 and gets rid of color_legacy [MDB IGNORE] (#8840)
* makes it so the sanitize_hexcolors' default is 6 characters rather than 3 and gets rid of color_legacy * Feex * Feex some more * Final feex * Please no more I'm tired * <<<<<<< HEAD Co-authored-by: Seris02 <49109742+Seris02@users.noreply.github.com> Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com> Co-authored-by: GoldenAlpharex <jerego1234@hotmail.com>
This commit is contained in:
@@ -265,14 +265,10 @@ GLOBAL_LIST_EMPTY(preferences_datums)
|
||||
if (isnull(requested_preference))
|
||||
return FALSE
|
||||
|
||||
if (!istype(requested_preference, /datum/preference/color) \
|
||||
&& !istype(requested_preference, /datum/preference/color_legacy) \
|
||||
)
|
||||
if (!istype(requested_preference, /datum/preference/color))
|
||||
return FALSE
|
||||
|
||||
var/default_value = read_preference(requested_preference.type)
|
||||
if (istype(requested_preference, /datum/preference/color_legacy))
|
||||
default_value = expand_three_digit_color(default_value)
|
||||
|
||||
// Yielding
|
||||
var/new_color = input(
|
||||
|
||||
@@ -424,32 +424,20 @@ GLOBAL_LIST_INIT(preference_entries_by_key, init_preference_entries_by_key())
|
||||
|
||||
return data
|
||||
|
||||
/// A preference that represents an RGB color of something, crunched down to 3 hex numbers.
|
||||
/// Was used heavily in the past, but doesn't provide as much range and only barely conserves space.
|
||||
/datum/preference/color_legacy
|
||||
abstract_type = /datum/preference/color_legacy
|
||||
|
||||
/datum/preference/color_legacy/deserialize(input, datum/preferences/preferences)
|
||||
return sanitize_hexcolor(input)
|
||||
|
||||
/datum/preference/color_legacy/create_default_value()
|
||||
return random_short_color()
|
||||
|
||||
/datum/preference/color_legacy/is_valid(value)
|
||||
var/static/regex/is_legacy_color = regex(@"^[0-9a-fA-F]{3}$")
|
||||
return findtext(value, is_legacy_color)
|
||||
|
||||
/// A preference that represents an RGB color of something.
|
||||
/// Will give the value as 6 hex digits, without a hash.
|
||||
/datum/preference/color
|
||||
abstract_type = /datum/preference/color
|
||||
|
||||
/datum/preference/color/deserialize(input, datum/preferences/preferences)
|
||||
return sanitize_color(input)
|
||||
return sanitize_hexcolor(input)
|
||||
|
||||
/datum/preference/color/create_default_value()
|
||||
return random_color()
|
||||
|
||||
/datum/preference/color/serialize(input)
|
||||
return sanitize_hexcolor(input)
|
||||
|
||||
/datum/preference/color/is_valid(value)
|
||||
return findtext(value, GLOB.is_color)
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
var/list/values = possible_values_for_sprite_accessory_list(accessories)
|
||||
|
||||
var/icon/head_icon = icon('icons/mob/human_parts_greyscale.dmi', "human_head_m")
|
||||
head_icon.Blend("#[skintone2hex("caucasian1")]", ICON_MULTIPLY)
|
||||
head_icon.Blend(skintone2hex("caucasian1"), ICON_MULTIPLY)
|
||||
|
||||
for (var/name in values)
|
||||
var/datum/sprite_accessory/accessory = accessories[name]
|
||||
@@ -22,13 +22,13 @@
|
||||
|
||||
return values
|
||||
|
||||
/datum/preference/color_legacy/eye_color
|
||||
/datum/preference/color/eye_color
|
||||
savefile_key = "eye_color"
|
||||
savefile_identifier = PREFERENCE_CHARACTER
|
||||
category = PREFERENCE_CATEGORY_SECONDARY_FEATURES
|
||||
relevant_species_trait = EYECOLOR
|
||||
|
||||
/datum/preference/color_legacy/eye_color/apply_to_human(mob/living/carbon/human/target, value)
|
||||
/datum/preference/color/eye_color/apply_to_human(mob/living/carbon/human/target, value)
|
||||
target.eye_color = value
|
||||
|
||||
var/obj/item/organ/eyes/eyes_organ = target.getorgan(/obj/item/organ/eyes)
|
||||
@@ -37,7 +37,7 @@
|
||||
eyes_organ.eye_color = value
|
||||
eyes_organ.old_eye_color = value
|
||||
|
||||
/datum/preference/color_legacy/eye_color/create_default_value()
|
||||
/datum/preference/color/eye_color/create_default_value()
|
||||
return random_eye_color()
|
||||
|
||||
/datum/preference/choiced/facial_hairstyle
|
||||
@@ -61,22 +61,22 @@
|
||||
|
||||
return data
|
||||
|
||||
/datum/preference/color_legacy/facial_hair_color
|
||||
/datum/preference/color/facial_hair_color
|
||||
savefile_key = "facial_hair_color"
|
||||
savefile_identifier = PREFERENCE_CHARACTER
|
||||
category = PREFERENCE_CATEGORY_SUPPLEMENTAL_FEATURES
|
||||
relevant_species_trait = FACEHAIR
|
||||
|
||||
/datum/preference/color_legacy/facial_hair_color/apply_to_human(mob/living/carbon/human/target, value)
|
||||
/datum/preference/color/facial_hair_color/apply_to_human(mob/living/carbon/human/target, value)
|
||||
target.facial_hair_color = value
|
||||
|
||||
/datum/preference/color_legacy/hair_color
|
||||
/datum/preference/color/hair_color
|
||||
savefile_key = "hair_color"
|
||||
savefile_identifier = PREFERENCE_CHARACTER
|
||||
category = PREFERENCE_CATEGORY_SUPPLEMENTAL_FEATURES
|
||||
relevant_species_trait = HAIR
|
||||
|
||||
/datum/preference/color_legacy/hair_color/apply_to_human(mob/living/carbon/human/target, value)
|
||||
/datum/preference/color/hair_color/apply_to_human(mob/living/carbon/human/target, value)
|
||||
target.hair_color = value
|
||||
|
||||
/datum/preference/choiced/hairstyle
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
var/color = GLOB.color_list_ethereal[name]
|
||||
|
||||
var/icon/icon = new(ethereal_base)
|
||||
icon.Blend("#[color]", ICON_MULTIPLY)
|
||||
icon.Blend(color, ICON_MULTIPLY)
|
||||
values[name] = icon
|
||||
|
||||
return values
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
/* SKYRAT EDIT REMOVAL
|
||||
/datum/preference/color_legacy/mutant_color
|
||||
/datum/preference/color/mutant_color
|
||||
savefile_key = "feature_mcolor"
|
||||
savefile_identifier = PREFERENCE_CHARACTER
|
||||
category = PREFERENCE_CATEGORY_SECONDARY_FEATURES
|
||||
relevant_species_trait = MUTCOLORS
|
||||
|
||||
/datum/preference/color_legacy/mutant_color/create_default_value()
|
||||
/datum/preference/color/mutant_color/create_default_value()
|
||||
return sanitize_hexcolor("[pick("7F", "FF")][pick("7F", "FF")][pick("7F", "FF")]")
|
||||
|
||||
/datum/preference/color_legacy/mutant_color/apply_to_human(mob/living/carbon/human/target, value)
|
||||
/datum/preference/color/mutant_color/apply_to_human(mob/living/carbon/human/target, value)
|
||||
target.dna.features["mcolor"] = value
|
||||
|
||||
/datum/preference/color_legacy/mutant_color/is_valid(value)
|
||||
/datum/preference/color/mutant_color/is_valid(value)
|
||||
if (!..(value))
|
||||
return FALSE
|
||||
|
||||
if (is_color_dark(expand_three_digit_color(value)))
|
||||
if (is_color_dark(value))
|
||||
return FALSE
|
||||
|
||||
return TRUE
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/datum/preference/color_legacy/underwear_color
|
||||
/datum/preference/color/underwear_color
|
||||
savefile_key = "underwear_color"
|
||||
savefile_identifier = PREFERENCE_CHARACTER
|
||||
category = PREFERENCE_CATEGORY_SUPPLEMENTAL_FEATURES
|
||||
|
||||
/datum/preference/color_legacy/underwear_color/apply_to_human(mob/living/carbon/human/target, value)
|
||||
/datum/preference/color/underwear_color/apply_to_human(mob/living/carbon/human/target, value)
|
||||
target.underwear_color = value
|
||||
|
||||
/datum/preference/color_legacy/underwear_color/is_accessible(datum/preferences/preferences)
|
||||
/datum/preference/color/underwear_color/is_accessible(datum/preferences/preferences)
|
||||
if (!..(preferences))
|
||||
return FALSE
|
||||
|
||||
|
||||
Reference in New Issue
Block a user