code:
/// Middleware to handle markings
/datum/preference_middleware/markings
	action_delegations = list(
		"add_marking" = .proc/add_marking,
		"change_marking" = .proc/change_marking,
		"remove_marking" = .proc/remove_marking,
		"color_marking" = .proc/color_marking,
		"move_marking_up" = .proc/move_marking_up,
		"move_marking_down" = .proc/move_marking_down,
		"set_preset" = .proc/set_preset,
	)

/datum/preference_middleware/markings/New(datum/preferences)
	. = ..()
	// Run this at least once to verify if everything is valid here
	if(src.preferences)
		get_ui_data()

/datum/preference_middleware/markings/on_new_character(mob/user)
	. = ..()
	get_ui_data()

/datum/preference_middleware/markings/get_ui_data(mob/user)
	var/list/data = list()

	// How?
	if(!islist(preferences.body_markings))
		preferences.body_markings = list()

	var/mismatched_parts = preferences.read_preference(/datum/preference/toggle/mismatched_parts)
	var/datum/species/species_type = preferences.read_preference(/datum/preference/choiced/species)

	var/list/presets = list()
	for(var/body_marking_set in GLOB.body_marking_sets)
		presets += body_marking_set
	if(!mismatched_parts)
		for(var/name in presets)
			var/datum/body_marking_set/body_marking_set = GLOB.body_marking_sets[name]
			if(body_marking_set.recommended_species && !(initial(species_type.id) in body_marking_set.recommended_species))
				presets -= name

	data["body_marking_sets"] = presets

	var/list/marking_parts = list()
	for(var/zone in GLOB.marking_zones)
		var/list/this_zone = list()

		this_zone["body_zone"] = zone
		this_zone["name"] = capitalize_like_old_man(parse_zone(zone))
		var/list/this_zone_marking_choices = list()
		if(LAZYACCESS(GLOB.body_markings_per_limb, zone))
			this_zone_marking_choices |= GLOB.body_markings_per_limb[zone]
		for(var/choice in this_zone_marking_choices)
			var/datum/body_marking/body_marking = GLOB.body_markings[choice]
			if(body_marking.recommended_species && !(initial(species_type.id) in body_marking.recommended_species))
				this_zone_marking_choices -= choice
		var/list/this_zone_markings = list()
		for(var/name in preferences.body_markings[zone])
			this_zone_marking_choices -= name
			var/list/this_marking = list()
			this_marking["name"] = name
			this_marking["color"] = sanitize_hexcolor(preferences.body_markings[zone][name], 6, TRUE)
			this_marking["marking_index"] = preferences.body_markings[zone].Find(name)
			this_zone_markings += list(this_marking)
		this_zone["markings"] = this_zone_markings
		this_zone["markings_choices"] = this_zone_marking_choices
		this_zone["can_add_markings"] = (LAZYLEN(this_zone_markings) < MAXIMUM_MARKINGS_PER_LIMB)

		marking_parts += list(this_zone)

	data["marking_parts"] = marking_parts
	data["maximum_markings_per_limb"] = MAXIMUM_MARKINGS_PER_LIMB
	return data

/datum/preference_middleware/markings/apply_to_human(mob/living/carbon/human/target, datum/preferences/preferences)
	target.dna.body_markings = LAZYCOPY(preferences.body_markings)
	target.dna.species.body_markings = LAZYCOPY(preferences.body_markings)
	for(var/obj/item/bodypart/bodypart as anything in target.bodyparts)
		bodypart.body_markings = list()
		if(bodypart.advanced_rendering)
			if(bodypart.body_zone && target.dna.body_markings[bodypart.body_zone])
				bodypart.body_markings[bodypart.aux_zone] = target.dna.body_markings[bodypart.body_zone].Copy()
			if(bodypart.aux_zone && target.dna.body_markings[bodypart.aux_zone])
				bodypart.body_markings[bodypart.aux_zone] = target.dna.body_markings[bodypart.aux_zone].Copy()
		if(!LAZYLEN(bodypart.body_markings))
			bodypart.body_markings = null

/datum/preference_middleware/markings/proc/add_marking(list/params, mob/user)
	var/zone = params["body_zone"]
	LAZYINITLIST(preferences.body_markings[zone])
	var/list/marking_list = preferences.body_markings[zone]
	if(LAZYLEN(marking_list) < MAXIMUM_MARKINGS_PER_LIMB)
		var/name = GLOB.body_markings_per_limb[zone][LAZYLEN(marking_list)+1]
		var/datum/body_marking/body_marking = GLOB.body_markings[name]
		var/pref_species = preferences.read_preference(/datum/preference/choiced/species)
		marking_list[name] = sanitize_hexcolor(body_marking.get_default_color(preferences.get_features(), pref_species), 6, FALSE)
		preferences.character_preview_view.update_body()
		return TRUE

/datum/preference_middleware/markings/proc/change_marking(list/params, mob/user)
	var/zone = params["body_zone"]
	var/index = params["marking_index"]
	var/new_marking = params["new_marking"]
	var/list/marking_list = preferences.body_markings[zone].Copy()
	preferences.body_markings[zone] = list()
	var/count = 0
	for(var/previousmarking in marking_list)
		count++
		if(count == index)
			preferences.body_markings[zone][new_marking] = marking_list[previousmarking]
		else
			preferences.body_markings[zone][previousmarking] = marking_list[previousmarking]
	preferences.character_preview_view.update_body()
	return TRUE

/datum/preference_middleware/markings/proc/color_marking(list/params, mob/user)
	var/zone = params["body_zone"]
	var/marking_name = params["marking_name"]
	if(marking_name)
		var/old_color = preferences.body_markings[zone][marking_name]
		var/new_color = input(user, "Select new color", "New marking color", "#[old_color]") as color
		preferences.body_markings[zone][marking_name] = sanitize_hexcolor(new_color, 6, FALSE)
		preferences.character_preview_view.update_body()
		return TRUE

/datum/preference_middleware/markings/proc/remove_marking(list/params, mob/user)
	var/zone = params["body_zone"]
	var/index = params["marking_index"]
	var/list/marking_list = preferences.body_markings[zone]
	if(LAZYACCESS(marking_list, index))
		marking_list -= marking_list[index]
		if(LAZYLEN(marking_list) <= 0)
			marking_list = null
		preferences.character_preview_view.update_body()
		return TRUE

/datum/preference_middleware/markings/proc/move_marking_up(list/params, mob/user)
	var/zone = params["body_zone"]
	var/index = params["marking_index"]
	var/list/marking_list = preferences.body_markings[zone]
	if(LAZYLEN(marking_list) >= 2 && (index >= 2))
		marking_list.Swap(index, index-1)
		preferences.character_preview_view.update_body()
		return TRUE

/datum/preference_middleware/markings/proc/move_marking_down(list/params, mob/user)
	var/zone = params["body_zone"]
	var/index = params["marking_index"]
	var/list/marking_list = preferences.body_markings[zone]
	if(LAZYLEN(marking_list) >= 2 && (index < LAZYLEN(marking_list)))
		marking_list.Swap(index, index+1)
		preferences.character_preview_view.update_body()
		return TRUE

/datum/preference_middleware/markings/proc/set_preset(list/params, mob/user)
	var/preset = params["preset"]
	if(preset)
		var/datum/body_marking_set/body_marking_set = GLOB.body_marking_sets[preset]
		var/pref_species = preferences.read_preference(/datum/preference/choiced/species)
		preferences.body_markings = assemble_body_markings_from_set(body_marking_set, preferences.get_features(), pref_species)
	preferences.character_preview_view.update_body()
	return TRUE


code:
/datum/preference_middleware/character_preview_type
	action_delegations = list(
		"select_preview_type" = .proc/select_preview_type,
	)

/datum/preference_middleware/character_preview_type/get_ui_data(mob/user)
	var/list/data = list()
	data["character_preview_type"] = preferences.character_preview_type
	return data

/datum/preference_middleware/character_preview_type/proc/select_preview_type(list/params, mob/user)
	switch(params["new_preview_type"])
		if(PREVIEW_PREF_NAKED)
			preferences.character_preview_type = PREVIEW_PREF_NAKED
		if(PREVIEW_PREF_NAKED_AROUSED)
			preferences.character_preview_type = PREVIEW_PREF_NAKED_AROUSED
		else
			preferences.character_preview_type = PREVIEW_PREF_JOB
	preferences.character_preview_view.update_body()
	return TRUE

repo_name: AnalWerewolf/sundown

license: mit


code:
/datum/preference_middleware/quirks/New(datum/preferences)
	. = ..()
	src.preferences?.all_quirks = list()


code:
// Mutant colors
/datum/preference/color/mutant_color/is_accessible(datum/preferences/preferences)
	return FALSE

/datum/preference/tri_color/mutant_colors
	category = PREFERENCE_CATEGORY_SECONDARY_FEATURES
	savefile_identifier = PREFERENCE_CHARACTER
	savefile_key = "mutant_colors"
	priority = PREFERENCE_PRIORITY_MUTANT_COLORS
	can_randomize = FALSE

/datum/preference/tri_color/mutant_colors/create_informed_default_value(datum/preferences/preferences)
	. = list("FFFFFF", "FFFFFF", "FFFFFF")
	var/species_type = preferences.read_preference(/datum/preference/choiced/species)
	if(species_type)
		var/datum/species/species = new species_type()
		var/list/features = species.get_random_features()
		if(LAZYLEN(features) && features["mcolor"] && features["mcolor2"] && features["mcolor3"])
			. = list(sanitize_hexcolor(features["mcolor"], 6), sanitize_hexcolor(features["mcolor2"], 6), sanitize_hexcolor(features["mcolor3"], 6))
		qdel(species)

/datum/preference/tri_color/mutant_colors/apply_to_human(mob/living/carbon/human/target, value)
	target.dna.features["mcolor"] = sanitize_hexcolor(value[1], 6)
	target.dna.features["mcolor2"] = sanitize_hexcolor(value[2], 6)
	target.dna.features["mcolor3"] = sanitize_hexcolor(value[3], 6)


code:
/datum/preference/toggle/mismatched_parts
	category = PREFERENCE_CATEGORY_NON_CONTEXTUAL
	savefile_identifier = PREFERENCE_CHARACTER
	savefile_key = "allow_mismatched_parts_toggle"
	priority = PREFERENCE_PRIORITY_MUTANT_COLORS
	can_randomize = FALSE
	default_value = FALSE

/datum/preference/toggle/mismatched_parts/create_default_value()
	return FALSE

/datum/preference/toggle/mismatched_parts/apply_to_human(mob/living/carbon/human/target, value, datum/preferences/preferences)
	return TRUE


code:
// Lizard body markings
/datum/preference/choiced/full_body_markings
	category = PREFERENCE_CATEGORY_FEATURES
	savefile_identifier = PREFERENCE_CHARACTER
	savefile_key = "feature_body_markings"
	priority = PREFERENCE_PRIORITY_MUTANT_PART
	main_feature_name = "Full-body markings"
	relevant_mutant_bodypart = "body_markings"
	can_randomize = FALSE
	should_generate_icons = FALSE

/datum/preference/choiced/full_body_markings/create_informed_default_value(datum/preferences/preferences)
	. = ..()
	var/species_type = preferences.read_preference(/datum/preference/choiced/species)
	var/datum/species/species = new species_type()
	if(species.default_mutant_bodyparts[relevant_mutant_bodypart])
		if(species.default_mutant_bodyparts[relevant_mutant_bodypart] == ACC_RANDOM)
			qdel(species)
			return pick(GLOB.sprite_accessories[relevant_mutant_bodypart])
		qdel(species)
		return species.default_mutant_bodyparts[relevant_mutant_bodypart]
	return "None"

/datum/preference/choiced/full_body_markings/init_possible_values()
	return assoc_to_keys(GLOB.sprite_accessories[relevant_mutant_bodypart])

/datum/preference/choiced/full_body_markings/apply_to_human(mob/living/carbon/human/target, value)
	if(!target.dna.mutant_bodyparts[relevant_mutant_bodypart])
		target.dna.mutant_bodyparts[relevant_mutant_bodypart] = list(MUTANT_INDEX_NAME = "None", \
											MUTANT_INDEX_COLOR = list("FFFFFF", "FFFFFF", "FFFFFF"))
	target.dna.mutant_bodyparts[relevant_mutant_bodypart][MUTANT_INDEX_NAME] = value

// Lizard body markings color
/datum/preference/tri_color/full_body_markings
	category = PREFERENCE_CATEGORY_SUPPLEMENTAL_FEATURES
	savefile_identifier = PREFERENCE_CHARACTER
	savefile_key = "body_markings_color"
	priority = PREFERENCE_PRIORITY_MUTANT_COLORS
	can_randomize = FALSE
	relevant_mutant_bodypart = "body_markings"

/datum/preference/tri_color/full_body_markings/create_informed_default_value(datum/preferences/preferences)
	var/part_type = preferences.read_preference(/datum/preference/choiced/ears)
	if(part_type)
		var/datum/sprite_accessory/sprite_accessory = GLOB.sprite_accessories[relevant_mutant_bodypart][part_type]
		if(sprite_accessory)
			var/pref_species = preferences.read_preference(/datum/preference/choiced/species)
			var/color = sprite_accessory.get_default_color(preferences.get_features(), pref_species)
			if(LAZYLEN(color) == 3)
				return list(sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[2], 6), sanitize_hexcolor(color[3], 6))
			else if(LAZYLEN(color) == 1)
				return list(sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[1], 6))
	return list("FFFFFF", "FFFFFF", "FFFFFF")

/datum/preference/tri_color/full_body_markings/apply_to_human(mob/living/carbon/human/target, value)
	if(!target.dna.mutant_bodyparts[relevant_mutant_bodypart])
		target.dna.mutant_bodyparts[relevant_mutant_bodypart] = list(MUTANT_INDEX_NAME = "None", \
												MUTANT_INDEX_COLOR = list("FFFFFF", "FFFFFF", "FFFFFF"))
	target.dna.mutant_bodyparts[relevant_mutant_bodypart][MUTANT_INDEX_COLOR] = list(sanitize_hexcolor(value[1], 6), sanitize_hexcolor(value[2], 6), sanitize_hexcolor(value[3], 6))


code:
// Ears
/datum/preference/choiced/ears
	category = PREFERENCE_CATEGORY_FEATURES
	savefile_identifier = PREFERENCE_CHARACTER
	savefile_key = "feature_ears"
	priority = PREFERENCE_PRIORITY_MUTANT_PART
	main_feature_name = "Ears"
	relevant_mutant_bodypart = "ears"
	can_randomize = FALSE
	should_generate_icons = TRUE

/datum/preference/choiced/ears/create_informed_default_value(datum/preferences/preferences)
	var/species_type = preferences.read_preference(/datum/preference/choiced/species)
	var/datum/species/species = new species_type()
	if(species.default_mutant_bodyparts[relevant_mutant_bodypart])
		if(species.default_mutant_bodyparts[relevant_mutant_bodypart] == ACC_RANDOM)
			qdel(species)
			return pick(GLOB.sprite_accessories[relevant_mutant_bodypart]-"None")
		qdel(species)
		return species.default_mutant_bodyparts[relevant_mutant_bodypart]
	return "None"

/datum/preference/choiced/ears/init_possible_values()
	return generate_possible_values_for_sprite_accessories_on_head(GLOB.sprite_accessories[relevant_mutant_bodypart])

/datum/preference/choiced/ears/apply_to_human(mob/living/carbon/human/target, value)
	if(!target.dna.mutant_bodyparts[relevant_mutant_bodypart])
		target.dna.mutant_bodyparts[relevant_mutant_bodypart] = list(MUTANT_INDEX_NAME = "None", \
											MUTANT_INDEX_COLOR = list("FFFFFF", "FFFFFF", "FFFFFF"))
	target.dna.mutant_bodyparts[relevant_mutant_bodypart][MUTANT_INDEX_NAME] = value

/datum/preference/choiced/ears/compile_constant_data()
	var/list/data = ..()

	data[SUPPLEMENTAL_FEATURE_KEY] = "ears_color"

	return data

// Ears color
/datum/preference/tri_color/ears
	category = PREFERENCE_CATEGORY_SUPPLEMENTAL_FEATURES
	savefile_identifier = PREFERENCE_CHARACTER
	savefile_key = "ears_color"
	priority = PREFERENCE_PRIORITY_MUTANT_COLORS
	can_randomize = FALSE
	relevant_mutant_bodypart = "ears"

/datum/preference/tri_color/ears/create_informed_default_value(datum/preferences/preferences)
	var/part_type = preferences.read_preference(/datum/preference/choiced/ears)
	if(part_type)
		var/datum/sprite_accessory/sprite_accessory = GLOB.sprite_accessories[relevant_mutant_bodypart][part_type]
		if(sprite_accessory)
			var/pref_species = preferences.read_preference(/datum/preference/choiced/species)
			var/color = sprite_accessory.get_default_color(preferences.get_features(), pref_species)
			if(LAZYLEN(color) == 3)
				return list(sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[2], 6), sanitize_hexcolor(color[3], 6))
			else if(LAZYLEN(color) == 1)
				return list(sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[1], 6))
	return list("FFFFFF", "FFFFFF", "FFFFFF")

/datum/preference/tri_color/ears/apply_to_human(mob/living/carbon/human/target, value)
	if(!target.dna.mutant_bodyparts[relevant_mutant_bodypart])
		target.dna.mutant_bodyparts[relevant_mutant_bodypart] = list(MUTANT_INDEX_NAME = "None", \
												MUTANT_INDEX_COLOR = list("FFFFFF", "FFFFFF", "FFFFFF"))
	target.dna.mutant_bodyparts[relevant_mutant_bodypart][MUTANT_INDEX_COLOR] = list(sanitize_hexcolor(value[1], 6), sanitize_hexcolor(value[2], 6), sanitize_hexcolor(value[3], 6))


code:
// Neck fluff
/datum/preference/choiced/fluff
	category = PREFERENCE_CATEGORY_FEATURES
	savefile_identifier = PREFERENCE_CHARACTER
	savefile_key = "feature_fluff"
	priority = PREFERENCE_PRIORITY_MUTANT_PART
	main_feature_name = "Fluff"
	relevant_mutant_bodypart = "fluff"
	can_randomize = FALSE
	should_generate_icons = TRUE

/datum/preference/choiced/fluff/create_informed_default_value(datum/preferences/preferences)
	. = ..()
	var/species_type = preferences.read_preference(/datum/preference/choiced/species)
	var/datum/species/species = new species_type()
	if(species.default_mutant_bodyparts[relevant_mutant_bodypart])
		if(species.default_mutant_bodyparts[relevant_mutant_bodypart] == ACC_RANDOM)
			qdel(species)
			return pick(GLOB.sprite_accessories[relevant_mutant_bodypart]-"None")
		qdel(species)
		return species.default_mutant_bodyparts[relevant_mutant_bodypart]
	return "None"

/datum/preference/choiced/fluff/init_possible_values()
	return generate_possible_values_for_sprite_accessories_on_head(GLOB.sprite_accessories[relevant_mutant_bodypart])

/datum/preference/choiced/fluff/apply_to_human(mob/living/carbon/human/target, value)
	if(!target.dna.mutant_bodyparts[relevant_mutant_bodypart])
		target.dna.mutant_bodyparts[relevant_mutant_bodypart] = list(MUTANT_INDEX_NAME = "None", \
											MUTANT_INDEX_COLOR = list("FFFFFF", "FFFFFF", "FFFFFF"))
	target.dna.mutant_bodyparts[relevant_mutant_bodypart][MUTANT_INDEX_NAME] = value

/datum/preference/choiced/fluff/compile_constant_data()
	var/list/data = ..()

	data[SUPPLEMENTAL_FEATURE_KEY] = "fluff_color"

	return data

// Fluff color
/datum/preference/tri_color/fluff
	category = PREFERENCE_CATEGORY_SUPPLEMENTAL_FEATURES
	savefile_identifier = PREFERENCE_CHARACTER
	savefile_key = "fluff_color"
	priority = PREFERENCE_PRIORITY_MUTANT_COLORS
	can_randomize = FALSE
	relevant_mutant_bodypart = "fluff"

/datum/preference/tri_color/fluff/create_informed_default_value(datum/preferences/preferences)
	var/part_type = preferences.read_preference(/datum/preference/choiced/fluff)
	if(part_type)
		var/datum/sprite_accessory/sprite_accessory = GLOB.sprite_accessories[relevant_mutant_bodypart][part_type]
		if(sprite_accessory)
			var/pref_species = preferences.read_preference(/datum/preference/choiced/species)
			var/color = sprite_accessory.get_default_color(preferences.get_features(), pref_species)
			if(LAZYLEN(color) == 3)
				return list(sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[2], 6), sanitize_hexcolor(color[3], 6))
			else if(LAZYLEN(color) == 1)
				return list(sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[1], 6))
	return list("FFFFFF", "FFFFFF", "FFFFFF")

/datum/preference/tri_color/fluff/apply_to_human(mob/living/carbon/human/target, value)
	if(!target.dna.mutant_bodyparts[relevant_mutant_bodypart])
		target.dna.mutant_bodyparts[relevant_mutant_bodypart] = list(MUTANT_INDEX_NAME = "None", \
												MUTANT_INDEX_COLOR = list("FFFFFF", "FFFFFF", "FFFFFF"))
	target.dna.mutant_bodyparts[relevant_mutant_bodypart][MUTANT_INDEX_COLOR] = list(sanitize_hexcolor(value[1], 6), sanitize_hexcolor(value[2], 6), sanitize_hexcolor(value[3], 6))


code:
// Frills
/datum/preference/choiced/frills
	category = PREFERENCE_CATEGORY_FEATURES
	savefile_identifier = PREFERENCE_CHARACTER
	savefile_key = "feature_frills"
	priority = PREFERENCE_PRIORITY_MUTANT_PART
	main_feature_name = "Frills"
	relevant_mutant_bodypart = "frills"
	can_randomize = FALSE
	should_generate_icons = TRUE

/datum/preference/choiced/frills/create_informed_default_value(datum/preferences/preferences)
	. = ..()
	var/species_type = preferences.read_preference(/datum/preference/choiced/species)
	var/datum/species/species = new species_type()
	if(species.default_mutant_bodyparts[relevant_mutant_bodypart])
		if(species.default_mutant_bodyparts[relevant_mutant_bodypart] == ACC_RANDOM)
			qdel(species)
			return pick(GLOB.sprite_accessories[relevant_mutant_bodypart]-"None")
		qdel(species)
		return species.default_mutant_bodyparts[relevant_mutant_bodypart]
	return "None"

/datum/preference/choiced/frills/init_possible_values()
	return generate_possible_values_for_sprite_accessories_on_head(GLOB.sprite_accessories[relevant_mutant_bodypart])

/datum/preference/choiced/frills/apply_to_human(mob/living/carbon/human/target, value)
	if(!target.dna.mutant_bodyparts[relevant_mutant_bodypart])
		target.dna.mutant_bodyparts[relevant_mutant_bodypart] = list(MUTANT_INDEX_NAME = "None", \
											MUTANT_INDEX_COLOR = list("FFFFFF", "FFFFFF", "FFFFFF"))
	target.dna.mutant_bodyparts[relevant_mutant_bodypart][MUTANT_INDEX_NAME] = value

/datum/preference/choiced/frills/compile_constant_data()
	var/list/data = ..()

	data[SUPPLEMENTAL_FEATURE_KEY] = "frills_color"

	return data

// Frills color
/datum/preference/tri_color/frills
	category = PREFERENCE_CATEGORY_SUPPLEMENTAL_FEATURES
	savefile_identifier = PREFERENCE_CHARACTER
	savefile_key = "frills_color"
	priority = PREFERENCE_PRIORITY_MUTANT_COLORS
	can_randomize = FALSE
	relevant_mutant_bodypart = "frills"

/datum/preference/tri_color/frills/create_informed_default_value(datum/preferences/preferences)
	var/part_type = preferences.read_preference(/datum/preference/choiced/frills)
	if(part_type)
		var/datum/sprite_accessory/sprite_accessory = GLOB.sprite_accessories[relevant_mutant_bodypart][part_type]
		if(sprite_accessory)
			var/pref_species = preferences.read_preference(/datum/preference/choiced/species)
			var/color = sprite_accessory.get_default_color(preferences.get_features(), pref_species)
			if(LAZYLEN(color) == 3)
				return list(sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[2], 6), sanitize_hexcolor(color[3], 6))
			else if(LAZYLEN(color) == 1)
				return list(sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[1], 6))
	return list("FFFFFF", "FFFFFF", "FFFFFF")

/datum/preference/tri_color/frills/apply_to_human(mob/living/carbon/human/target, value)
	if(!target.dna.mutant_bodyparts[relevant_mutant_bodypart])
		target.dna.mutant_bodyparts[relevant_mutant_bodypart] = list(MUTANT_INDEX_NAME = "None", \
												MUTANT_INDEX_COLOR = list("FFFFFF", "FFFFFF", "FFFFFF"))
	target.dna.mutant_bodyparts[relevant_mutant_bodypart][MUTANT_INDEX_COLOR] = list(sanitize_hexcolor(value[1], 6), sanitize_hexcolor(value[2], 6), sanitize_hexcolor(value[3], 6))


code:
// Breasts type
/datum/preference/choiced/breasts
	category = PREFERENCE_CATEGORY_SECONDARY_FEATURES
	savefile_identifier = PREFERENCE_CHARACTER
	savefile_key = "feature_breasts"
	priority = PREFERENCE_PRIORITY_GENITAL_PART
	main_feature_name = "Jugs"
	relevant_mutant_bodypart = "breasts"
	can_randomize = FALSE
	should_generate_icons = FALSE

/datum/preference/choiced/breasts/is_accessible(datum/preferences/preferences)
	. = ..()
	if(!.)
		return
	var/genitals_type = preferences.read_preference(/datum/preference/choiced/genitals)
	if(!(ORGAN_SLOT_BREASTS in GLOB.genital_sets[genitals_type]))
		return FALSE

/datum/preference/choiced/breasts/is_bad_preference(client/client, value, datum/preferences/preferences)
	. = FALSE
	if(value != create_informed_default_value(preferences))
		. = TRUE

/datum/preference/choiced/breasts/bad_preference_warning(client/client, value, datum/preferences/preferences)
	return div_infobox(span_animatedpain("In Nevado, having mutant jugs is a sign of mental incapacitation. \
					Think wisely about your choice."))

/datum/preference/choiced/breasts/create_informed_default_value(datum/preferences/preferences)
	var/species_type = preferences.read_preference(/datum/preference/choiced/species)
	var/datum/species/species = new species_type()
	var/list/genitals_possible = list()
	genitals_possible |= species.default_genitals_male
	genitals_possible |= species.default_genitals_female
	if(genitals_possible[ORGAN_SLOT_TESTICLES])
		var/genital_type = genitals_possible[ORGAN_SLOT_TESTICLES]
		var/obj/item/organ/our_genital = new genital_type()
		. = our_genital.mutantpart_info[MUTANT_INDEX_NAME]
		qdel(our_genital)
	qdel(species)

/datum/preference/choiced/breasts/init_possible_values()
	return assoc_to_keys(GLOB.sprite_accessories[relevant_mutant_bodypart]-"None")

/datum/preference/choiced/breasts/apply_to_human(mob/living/carbon/human/target, value, datum/preferences/preferences)
	if(!target.dna.mutant_bodyparts[relevant_mutant_bodypart])
		target.dna.mutant_bodyparts[relevant_mutant_bodypart] = list(MUTANT_INDEX_NAME = "None", \
											MUTANT_INDEX_COLOR = list("FFFFFF", "FFFFFF", "FFFFFF"))
	target.dna.mutant_bodyparts[relevant_mutant_bodypart][MUTANT_INDEX_NAME] = value

// Breasts size
/datum/preference/choiced/breasts_size
	category = PREFERENCE_CATEGORY_SECONDARY_FEATURES
	savefile_identifier = PREFERENCE_CHARACTER
	savefile_key = "breasts_size"
	priority = PREFERENCE_PRIORITY_GENITAL_PART
	main_feature_name = "Jugs size"
	relevant_mutant_bodypart = "breasts"
	can_randomize = FALSE
	should_generate_icons = FALSE

/datum/preference/choiced/breasts_size/is_accessible(datum/preferences/preferences)
	. = ..()
	if(!.)
		return
	var/genitals_type = preferences.read_preference(/datum/preference/choiced/genitals)
	if(!(ORGAN_SLOT_BREASTS in GLOB.genital_sets[genitals_type]))
		return FALSE

/datum/preference/choiced/breasts_size/create_default_value()
	return "A"

/datum/preference/choiced/breasts_size/init_possible_values()
	return list("A", "B", "C", "D", "E", "F", "G")

/datum/preference/choiced/breasts_size/apply_to_human(mob/living/carbon/human/target, value, datum/preferences/preferences)
	target.dna.features["breasts_size"] = detranslate_jug_size(value)

/datum/preference/choiced/breasts_size/is_bad_preference(client/client, value, datum/preferences/preferences)
	. = FALSE
	if(detranslate_jug_size(value) >= 4)
		. = TRUE

/datum/preference/choiced/breasts_size/bad_preference_warning(client/client, value, datum/preferences/preferences)
	return div_infobox(span_animatedpain("In Nevado, having exaggerated jugs is a sign of mental incapacitation. \
					Think wisely about your choice."))

// Breasts lactation
/datum/preference/toggle/breasts_lactation
	category = PREFERENCE_CATEGORY_SECONDARY_FEATURES
	savefile_identifier = PREFERENCE_CHARACTER
	savefile_key = "breasts_lactation_toggle"
	default_value = FALSE
	relevant_mutant_bodypart = "breasts"

/datum/preference/toggle/breasts_lactation/is_accessible(datum/preferences/preferences)
	. = ..()
	if(!.)
		return
	var/genitals_type = preferences.read_preference(/datum/preference/choiced/genitals)
	if(!(ORGAN_SLOT_BREASTS in GLOB.genital_sets[genitals_type]))
		return FALSE

/datum/preference/toggle/breasts_lactation/apply_to_human(mob/living/carbon/human/target, value, datum/preferences/preferences)
	target.dna.features["breasts_lactation"] = value

// Breasts color
/datum/preference/tri_color/breasts
	category = PREFERENCE_CATEGORY_SECONDARY_FEATURES
	savefile_identifier = PREFERENCE_CHARACTER
	savefile_key = "breasts_color"
	priority = PREFERENCE_PRIORITY_GENITAL_COLOR
	relevant_mutant_bodypart = "breasts"

/datum/preference/tri_color/breasts/is_accessible(datum/preferences/preferences)
	. = ..()
	if(!.)
		return
	var/genitals_type = preferences.read_preference(/datum/preference/choiced/genitals)
	if(!(ORGAN_SLOT_BREASTS in GLOB.genital_sets[genitals_type]))
		return FALSE
	var/datum/species/pref_species = preferences.read_preference(/datum/preference/choiced/species)
	if(initial(pref_species.use_skintones))
		var/use_skintones = preferences.read_preference(/datum/preference/toggle/skin_tone)
		if(use_skintones)
			return FALSE

/datum/preference/tri_color/breasts/create_informed_default_value(datum/preferences/preferences)
	var/part_type = preferences.read_preference(/datum/preference/choiced/breasts)
	if(part_type)
		var/datum/sprite_accessory/sprite_accessory = GLOB.sprite_accessories[relevant_mutant_bodypart][part_type]
		if(sprite_accessory)
			var/pref_species = preferences.read_preference(/datum/preference/choiced/species)
			var/color = sprite_accessory.get_default_color(preferences.get_features(), pref_species)
			if(LAZYLEN(color) == 3)
				return list(sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[2], 6), sanitize_hexcolor(color[3], 6))
			else if(LAZYLEN(color) == 1)
				return list(sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[1], 6))
	return list("FFFFFF", "FFFFFF", "FFFFFF")

/datum/preference/tri_color/breasts/apply_to_human(mob/living/carbon/human/target, value)
	if(!target.dna.mutant_bodyparts[relevant_mutant_bodypart])
		target.dna.mutant_bodyparts[relevant_mutant_bodypart] = list(MUTANT_INDEX_NAME = "None", \
												MUTANT_INDEX_COLOR = list("FFFFFF", "FFFFFF", "FFFFFF"))
	target.dna.mutant_bodyparts[relevant_mutant_bodypart][MUTANT_INDEX_COLOR] = list(sanitize_hexcolor(value[1], 6, FALSE), sanitize_hexcolor(value[2], 6, FALSE), sanitize_hexcolor(value[3], 6, FALSE))
	for(var/obj/item/organ/genital/genitals in target.internal_organs)
		if(genitals.mutantpart_key != relevant_mutant_bodypart)
			continue
		genitals.build_from_dna(target.dna, relevant_mutant_bodypart)


code:
// Penis type
/datum/preference/choiced/penis
	category = PREFERENCE_CATEGORY_SECONDARY_FEATURES
	savefile_identifier = PREFERENCE_CHARACTER
	savefile_key = "feature_penis"
	priority = PREFERENCE_PRIORITY_GENITAL_PART
	main_feature_name = "Knob"
	relevant_mutant_bodypart = "penis"
	can_randomize = FALSE
	should_generate_icons = FALSE

/datum/preference/choiced/penis/is_accessible(datum/preferences/preferences)
	. = ..()
	if(!.)
		return
	var/genitals_type = preferences.read_preference(/datum/preference/choiced/genitals)
	if(!(ORGAN_SLOT_PENIS in GLOB.genital_sets[genitals_type]))
		return FALSE

/datum/preference/choiced/penis/is_bad_preference(client/client, value, datum/preferences/preferences)
	. = FALSE
	if(value != create_informed_default_value(preferences))
		. = TRUE

/datum/preference/choiced/penis/bad_preference_warning(client/client, value, datum/preferences/preferences)
	return span_animatedpain("In Nevado, having a mutant knob is a sign of mental incapacitation. \
					Think wisely about your choice.")

/datum/preference/choiced/penis/create_informed_default_value(datum/preferences/preferences)
	var/species_type = preferences.read_preference(/datum/preference/choiced/species)
	var/datum/species/species = new species_type()
	var/list/genitals_possible = list()
	genitals_possible |= species.default_genitals_male
	genitals_possible |= species.default_genitals_female
	if(genitals_possible[ORGAN_SLOT_PENIS])
		var/genital_type = genitals_possible[ORGAN_SLOT_PENIS]
		var/obj/item/organ/our_genital = new genital_type()
		. = our_genital.mutantpart_info[MUTANT_INDEX_NAME]
		qdel(our_genital)
	qdel(species)

/datum/preference/choiced/penis/init_possible_values()
	return assoc_to_keys(GLOB.sprite_accessories[relevant_mutant_bodypart]-"None")

/datum/preference/choiced/penis/apply_to_human(mob/living/carbon/human/target, value, datum/preferences/preferences)
	if(!target.dna.mutant_bodyparts[relevant_mutant_bodypart])
		target.dna.mutant_bodyparts[relevant_mutant_bodypart] = list(MUTANT_INDEX_NAME = "None", \
											MUTANT_INDEX_COLOR = list("FFFFFF", "FFFFFF", "FFFFFF"))
	target.dna.mutant_bodyparts[relevant_mutant_bodypart][MUTANT_INDEX_NAME] = value

// Penis sheath
/datum/preference/choiced/penis_sheath
	category = PREFERENCE_CATEGORY_SECONDARY_FEATURES
	savefile_identifier = PREFERENCE_CHARACTER
	savefile_key = "penis_sheath"
	priority = PREFERENCE_PRIORITY_GENITAL_PART
	main_feature_name = "Knob sheath"
	relevant_mutant_bodypart = "penis"
	can_randomize = FALSE
	should_generate_icons = FALSE

/datum/preference/choiced/penis_sheath/is_accessible(datum/preferences/preferences)
	. = ..()
	if(!.)
		return
	var/genitals_type = preferences.read_preference(/datum/preference/choiced/genitals)
	if(!(ORGAN_SLOT_PENIS in GLOB.genital_sets[genitals_type]))
		return FALSE
	var/penis_type = preferences.read_preference(/datum/preference/choiced/penis)
	if(penis_type)
		var/datum/sprite_accessory/genital/penis/penis_accessory = GLOB.sprite_accessories[relevant_mutant_bodypart][penis_type]
		if(!penis_accessory.can_have_sheath)
			return FALSE

/datum/preference/choiced/penis_sheath/create_default_value()
	return SHEATH_NONE

/datum/preference/choiced/penis_sheath/init_possible_values()
	return SHEATH_MODES

/datum/preference/choiced/penis_sheath/apply_to_human(mob/living/carbon/human/target, value, datum/preferences/preferences)
	target.dna.features["penis_sheath"] = value

// Penis length
/datum/preference/numeric/penis_length
	category = PREFERENCE_CATEGORY_SECONDARY_FEATURES
	savefile_identifier = PREFERENCE_CHARACTER
	savefile_key = "penis_length"
	priority = PREFERENCE_PRIORITY_GENITAL_PART
	relevant_mutant_bodypart = "penis"
	can_randomize = FALSE
	minimum = PENIS_MIN_LENGTH
	maximum = PENIS_MAX_LENGTH

/datum/preference/numeric/penis_length/is_bad_preference(client/client, value, datum/preferences/preferences)
	. = FALSE
	if(value >= 18)
		return TRUE

/datum/preference/numeric/penis_length/bad_preference_warning(client/client, value, datum/preferences/preferences)
	return div_infobox(span_animatedpain("In Nevado, having a large knob is a sign of mental incapacitation. \
					Think wisely about your choice."))

/datum/preference/numeric/penis_length/is_accessible(datum/preferences/preferences)
	. = ..()
	if(!.)
		return
	var/genitals_type = preferences.read_preference(/datum/preference/choiced/genitals)
	if(!(ORGAN_SLOT_PENIS in GLOB.genital_sets[genitals_type]))
		return FALSE

/datum/preference/numeric/penis_length/create_default_value()
	return PENIS_DEFAULT_LENGTH

/datum/preference/numeric/penis_length/apply_to_human(mob/living/carbon/human/target, value, datum/preferences/preferences)
	target.dna.features["penis_size"] = value

// Penis girth
/datum/preference/numeric/penis_girth
	category = PREFERENCE_CATEGORY_SECONDARY_FEATURES
	savefile_identifier = PREFERENCE_CHARACTER
	savefile_key = "penis_girth"
	priority = PREFERENCE_PRIORITY_GENITAL_PART
	relevant_mutant_bodypart = "penis"
	can_randomize = FALSE
	minimum = PENIS_MIN_GIRTH
	maximum = PENIS_MAX_GIRTH

/datum/preference/numeric/penis_girth/is_bad_preference(client/client, value, datum/preferences/preferences)
	. = FALSE
	if(value > 13)
		. = TRUE

/datum/preference/numeric/penis_girth/bad_preference_warning(client/client, value, datum/preferences/preferences)
	return div_infobox(span_animatedpain("In Nevado, having a fat knob is a sign of mental incapacitation. \
					Think wisely about your choice."))

/datum/preference/numeric/penis_girth/is_accessible(datum/preferences/preferences)
	. = ..()
	if(!.)
		return
	var/genitals_type = preferences.read_preference(/datum/preference/choiced/genitals)
	if(!(ORGAN_SLOT_PENIS in GLOB.genital_sets[genitals_type]))
		return FALSE

/datum/preference/numeric/penis_girth/create_default_value()
	return PENIS_DEFAULT_GIRTH

/datum/preference/numeric/penis_girth/apply_to_human(mob/living/carbon/human/target, value, datum/preferences/preferences)
	target.dna.features["penis_girth"] = value

// Penis color
/datum/preference/tri_color/penis
	category = PREFERENCE_CATEGORY_SECONDARY_FEATURES
	savefile_identifier = PREFERENCE_CHARACTER
	savefile_key = "penis_color"
	priority = PREFERENCE_PRIORITY_GENITAL_COLOR
	relevant_mutant_bodypart = "penis"

/datum/preference/tri_color/penis/is_accessible(datum/preferences/preferences)
	. = ..()
	if(!.)
		return
	var/genitals_type = preferences.read_preference(/datum/preference/choiced/genitals)
	if(!(ORGAN_SLOT_PENIS in GLOB.genital_sets[genitals_type]))
		return FALSE
	var/datum/species/pref_species = preferences.read_preference(/datum/preference/choiced/species)
	if(initial(pref_species.use_skintones))
		var/use_skintones = preferences.read_preference(/datum/preference/toggle/skin_tone)
		if(use_skintones)
			return FALSE

/datum/preference/tri_color/penis/create_informed_default_value(datum/preferences/preferences)
	var/part_type = preferences.read_preference(/datum/preference/choiced/penis)
	if(part_type)
		var/datum/sprite_accessory/sprite_accessory = GLOB.sprite_accessories[relevant_mutant_bodypart][part_type]
		if(sprite_accessory)
			var/pref_species = preferences.read_preference(/datum/preference/choiced/species)
			var/color = sprite_accessory.get_default_color(preferences.get_features(), pref_species)
			if(LAZYLEN(color) == 3)
				return list(sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[2], 6), sanitize_hexcolor(color[3], 6))
			else if(LAZYLEN(color) == 1)
				return list(sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[1], 6))
	return list("FFFFFF", "FFFFFF", "FFFFFF")

/datum/preference/tri_color/penis/apply_to_human(mob/living/carbon/human/target, value)
	if(!target.dna.mutant_bodyparts[relevant_mutant_bodypart])
		target.dna.mutant_bodyparts[relevant_mutant_bodypart] = list(MUTANT_INDEX_NAME = "None", \
												MUTANT_INDEX_COLOR = list("FFFFFF", "FFFFFF", "FFFFFF"))
	target.dna.mutant_bodyparts[relevant_mutant_bodypart][MUTANT_INDEX_COLOR] = list(sanitize_hexcolor(value[1], 6, FALSE), sanitize_hexcolor(value[2], 6, FALSE), sanitize_hexcolor(value[3], 6, FALSE))


code:
// Testicles type
/datum/preference/choiced/testicles
	category = PREFERENCE_CATEGORY_SECONDARY_FEATURES
	savefile_identifier = PREFERENCE_CHARACTER
	savefile_key = "feature_testicles"
	priority = PREFERENCE_PRIORITY_GENITAL_PART
	main_feature_name = "Gonads"
	relevant_mutant_bodypart = "testicles"
	can_randomize = FALSE
	should_generate_icons = FALSE

/datum/preference/choiced/testicles/is_accessible(datum/preferences/preferences)
	. = ..()
	if(!.)
		return
	var/genitals_type = preferences.read_preference(/datum/preference/choiced/genitals)
	if(!(ORGAN_SLOT_TESTICLES in GLOB.genital_sets[genitals_type]))
		return FALSE

/datum/preference/choiced/testicles/is_bad_preference(client/client, value, datum/preferences/preferences)
	. = FALSE
	if(value != create_informed_default_value(preferences))
		. = TRUE

/datum/preference/choiced/testicles/bad_preference_warning(client/client, value, datum/preferences/preferences)
	return span_animatedpain("In Nevado, having mutant gonads is a sign of mental incapacitation. \
					Think wisely about your choice.")

/datum/preference/choiced/testicles/create_informed_default_value(datum/preferences/preferences)
	var/species_type = preferences.read_preference(/datum/preference/choiced/species)
	var/datum/species/species = new species_type()
	var/list/genitals_possible = list()
	genitals_possible |= species.default_genitals_male
	genitals_possible |= species.default_genitals_female
	if(genitals_possible[ORGAN_SLOT_TESTICLES])
		var/genital_type = genitals_possible[ORGAN_SLOT_TESTICLES]
		var/obj/item/organ/our_genital = new genital_type()
		. = our_genital.mutantpart_info[MUTANT_INDEX_NAME]
		qdel(our_genital)
	qdel(species)

/datum/preference/choiced/testicles/init_possible_values()
	return assoc_to_keys(GLOB.sprite_accessories[relevant_mutant_bodypart]-"None")

/datum/preference/choiced/testicles/apply_to_human(mob/living/carbon/human/target, value, datum/preferences/preferences)
	if(!target.dna.mutant_bodyparts[relevant_mutant_bodypart])
		target.dna.mutant_bodyparts[relevant_mutant_bodypart] = list(MUTANT_INDEX_NAME = "None", \
											MUTANT_INDEX_COLOR = list("FFFFFF", "FFFFFF", "FFFFFF"))
	target.dna.mutant_bodyparts[relevant_mutant_bodypart][MUTANT_INDEX_NAME] = value
	for(var/obj/item/organ/genital/genitals in target.internal_organs)
		if(genitals.mutantpart_key != relevant_mutant_bodypart)
			continue
		genitals.build_from_dna(target.dna, relevant_mutant_bodypart)

// Testicles size
/datum/preference/choiced/testicles_size
	category = PREFERENCE_CATEGORY_SECONDARY_FEATURES
	savefile_identifier = PREFERENCE_CHARACTER
	savefile_key = "testicles_size"
	priority = PREFERENCE_PRIORITY_GENITAL_PART
	main_feature_name = "Gonads size"
	relevant_mutant_bodypart = "testicles"
	can_randomize = FALSE
	should_generate_icons = FALSE

/datum/preference/choiced/testicles_size/is_bad_preference(client/client, value, datum/preferences/preferences)
	. = FALSE
	if(detranslate_gonad_size(value) >= 3)
		return TRUE

/datum/preference/choiced/testicles_size/bad_preference_warning(client/client, value, datum/preferences/preferences)
	return div_infobox(span_animatedpain("In Nevado, having large gonads is a sign of mental incapacitation. \
					Think wisely about your choice."))

/datum/preference/choiced/testicles_size/is_accessible(datum/preferences/preferences)
	. = ..()
	if(!.)
		return
	var/genitals_type = preferences.read_preference(/datum/preference/choiced/genitals)
	if(!(ORGAN_SLOT_TESTICLES in GLOB.genital_sets[genitals_type]))
		return FALSE

/datum/preference/choiced/testicles_size/create_default_value()
	return "Average Sized"

/datum/preference/choiced/testicles_size/init_possible_values()
	return list("Small", "Average Sized", "Big", "Huge", "Balls of Steel Sized")

/datum/preference/choiced/testicles_size/apply_to_human(mob/living/carbon/human/target, value, datum/preferences/preferences)
	target.dna.features["balls_size"] = detranslate_gonad_size(value)

// Testicles color
/datum/preference/tri_color/testicles
	category = PREFERENCE_CATEGORY_SECONDARY_FEATURES
	savefile_identifier = PREFERENCE_CHARACTER
	savefile_key = "testicles_color"
	priority = PREFERENCE_PRIORITY_GENITAL_COLOR
	relevant_mutant_bodypart = "testicles"

/datum/preference/tri_color/testicles/is_accessible(datum/preferences/preferences)
	. = ..()
	if(!.)
		return
	var/genitals_type = preferences.read_preference(/datum/preference/choiced/genitals)
	if(!(ORGAN_SLOT_TESTICLES in GLOB.genital_sets[genitals_type]))
		return FALSE
	var/datum/species/pref_species = preferences.read_preference(/datum/preference/choiced/species)
	if(initial(pref_species.use_skintones))
		var/use_skintones = preferences.read_preference(/datum/preference/toggle/skin_tone)
		if(use_skintones)
			return FALSE

/datum/preference/tri_color/testicles/create_informed_default_value(datum/preferences/preferences)
	var/part_type = preferences.read_preference(/datum/preference/choiced/testicles)
	if(part_type)
		var/datum/sprite_accessory/sprite_accessory = GLOB.sprite_accessories[relevant_mutant_bodypart][part_type]
		if(sprite_accessory)
			var/pref_species = preferences.read_preference(/datum/preference/choiced/species)
			var/color = sprite_accessory.get_default_color(preferences.get_features(), pref_species)
			if(LAZYLEN(color) == 3)
				return list(sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[2], 6), sanitize_hexcolor(color[3], 6))
			else if(LAZYLEN(color) == 1)
				return list(sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[1], 6))
	return list("FFFFFF", "FFFFFF", "FFFFFF")

/datum/preference/tri_color/testicles/apply_to_human(mob/living/carbon/human/target, value)
	if(!target.dna.mutant_bodyparts[relevant_mutant_bodypart])
		target.dna.mutant_bodyparts[relevant_mutant_bodypart] = list(MUTANT_INDEX_NAME = "None", \
												MUTANT_INDEX_COLOR = list("FFFFFF", "FFFFFF", "FFFFFF"))
	target.dna.mutant_bodyparts[relevant_mutant_bodypart][MUTANT_INDEX_COLOR] = list(sanitize_hexcolor(value[1], 6, FALSE), sanitize_hexcolor(value[2], 6, FALSE), sanitize_hexcolor(value[3], 6, FALSE))


code:
// Vagina type
/datum/preference/choiced/vagina
	category = PREFERENCE_CATEGORY_SECONDARY_FEATURES
	savefile_identifier = PREFERENCE_CHARACTER
	savefile_key = "feature_vagina"
	priority = PREFERENCE_PRIORITY_GENITAL_PART
	main_feature_name = "Cunt"
	relevant_mutant_bodypart = "vagina"
	can_randomize = FALSE
	should_generate_icons = FALSE

/datum/preference/choiced/vagina/is_accessible(datum/preferences/preferences)
	. = ..()
	if(!.)
		return
	var/genitals_type = preferences.read_preference(/datum/preference/choiced/genitals)
	if(!(ORGAN_SLOT_VAGINA in GLOB.genital_sets[genitals_type]))
		return FALSE

/datum/preference/choiced/vagina/is_bad_preference(client/client, value, datum/preferences/preferences)
	. = FALSE
	if(value != create_informed_default_value(preferences))
		. = TRUE

/datum/preference/choiced/vagina/bad_preference_warning(client/client, value, datum/preferences/preferences)
	return div_infobox(span_animatedpain("In Nevado, having a mutant cunt is a sign of mental incapacitation. \
					Think wisely about your choice."))

/datum/preference/choiced/vagina/create_informed_default_value(datum/preferences/preferences)
	var/species_type = preferences.read_preference(/datum/preference/choiced/species)
	var/datum/species/species = new species_type()
	var/list/genitals_possible = list()
	genitals_possible |= species.default_genitals_male
	genitals_possible |= species.default_genitals_female
	if(genitals_possible[ORGAN_SLOT_TESTICLES])
		var/genital_type = genitals_possible[ORGAN_SLOT_TESTICLES]
		var/obj/item/organ/our_genital = new genital_type()
		. = our_genital.mutantpart_info[MUTANT_INDEX_NAME]
		qdel(our_genital)
	qdel(species)

/datum/preference/choiced/vagina/init_possible_values()
	return assoc_to_keys(GLOB.sprite_accessories[relevant_mutant_bodypart]-"None")

/datum/preference/choiced/vagina/apply_to_human(mob/living/carbon/human/target, value, datum/preferences/preferences)
	if(!target.dna.mutant_bodyparts[relevant_mutant_bodypart])
		target.dna.mutant_bodyparts[relevant_mutant_bodypart] = list(MUTANT_INDEX_NAME = "None", \
											MUTANT_INDEX_COLOR = list("FFFFFF", "FFFFFF", "FFFFFF"))
	target.dna.mutant_bodyparts[relevant_mutant_bodypart][MUTANT_INDEX_NAME] = value
	for(var/obj/item/organ/genital/genitals in target.internal_organs)
		if(genitals.mutantpart_key != relevant_mutant_bodypart)
			continue
		genitals.build_from_dna(target.dna, relevant_mutant_bodypart)

// Vagina color
/datum/preference/tri_color/vagina
	category = PREFERENCE_CATEGORY_SECONDARY_FEATURES
	savefile_identifier = PREFERENCE_CHARACTER
	savefile_key = "vagina_color"
	priority = PREFERENCE_PRIORITY_GENITAL_COLOR
	relevant_mutant_bodypart = "vagina"

/datum/preference/tri_color/vagina/is_accessible(datum/preferences/preferences)
	. = ..()
	if(!.)
		return
	var/genitals_type = preferences.read_preference(/datum/preference/choiced/genitals)
	if(!(ORGAN_SLOT_VAGINA in GLOB.genital_sets[genitals_type]))
		return FALSE
	var/datum/species/pref_species = preferences.read_preference(/datum/preference/choiced/species)
	if(initial(pref_species.use_skintones))
		var/use_skintones = preferences.read_preference(/datum/preference/toggle/skin_tone)
		if(use_skintones)
			return FALSE

/datum/preference/tri_color/vagina/create_informed_default_value(datum/preferences/preferences)
	var/part_type = preferences.read_preference(/datum/preference/choiced/vagina)
	if(part_type)
		var/datum/sprite_accessory/sprite_accessory = GLOB.sprite_accessories[relevant_mutant_bodypart][part_type]
		if(sprite_accessory)
			var/pref_species = preferences.read_preference(/datum/preference/choiced/species)
			var/color = sprite_accessory.get_default_color(preferences.get_features(), pref_species)
			if(LAZYLEN(color) == 3)
				return list(sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[2], 6), sanitize_hexcolor(color[3], 6))
			else if(LAZYLEN(color) == 1)
				return list(sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[1], 6))
	return list("FFFFFF", "FFFFFF", "FFFFFF")

/datum/preference/tri_color/vagina/apply_to_human(mob/living/carbon/human/target, value)
	if(!target.dna.mutant_bodyparts[relevant_mutant_bodypart])
		target.dna.mutant_bodyparts[relevant_mutant_bodypart] = list(MUTANT_INDEX_NAME = "None", \
												MUTANT_INDEX_COLOR = list("FFFFFF", "FFFFFF", "FFFFFF"))
	target.dna.mutant_bodyparts[relevant_mutant_bodypart][MUTANT_INDEX_COLOR] = list(sanitize_hexcolor(value[1], 6, FALSE), sanitize_hexcolor(value[2], 6, FALSE), sanitize_hexcolor(value[3], 6, FALSE))


code:
// Head accessory
/datum/preference/choiced/head_acc
	category = PREFERENCE_CATEGORY_FEATURES
	savefile_identifier = PREFERENCE_CHARACTER
	savefile_key = "feature_head_acc"
	priority = PREFERENCE_PRIORITY_MUTANT_PART
	main_feature_name = "Head accessory"
	relevant_mutant_bodypart = "head_acc"
	can_randomize = FALSE
	should_generate_icons = TRUE

/datum/preference/choiced/head_acc/create_informed_default_value(datum/preferences/preferences)
	. = ..()
	var/species_type = preferences.read_preference(/datum/preference/choiced/species)
	var/datum/species/species = new species_type()
	if(species.default_mutant_bodyparts[relevant_mutant_bodypart])
		if(species.default_mutant_bodyparts[relevant_mutant_bodypart] == ACC_RANDOM)
			qdel(species)
			return pick(GLOB.sprite_accessories[relevant_mutant_bodypart]-"None")
		qdel(species)
		return species.default_mutant_bodyparts[relevant_mutant_bodypart]
	return "None"

/datum/preference/choiced/head_acc/init_possible_values()
	return generate_possible_values_for_sprite_accessories_on_head(GLOB.sprite_accessories[relevant_mutant_bodypart])

/datum/preference/choiced/head_acc/apply_to_human(mob/living/carbon/human/target, value)
	if(!target.dna.mutant_bodyparts[relevant_mutant_bodypart])
		target.dna.mutant_bodyparts[relevant_mutant_bodypart] = list(MUTANT_INDEX_NAME = "None", \
											MUTANT_INDEX_COLOR = list("FFFFFF", "FFFFFF", "FFFFFF"))
	target.dna.mutant_bodyparts[relevant_mutant_bodypart][MUTANT_INDEX_NAME] = value

/datum/preference/choiced/head_acc/compile_constant_data()
	var/list/data = ..()

	data[SUPPLEMENTAL_FEATURE_KEY] = "head_acc_color"

	return data

// Head accessory color
/datum/preference/tri_color/head_acc
	category = PREFERENCE_CATEGORY_SUPPLEMENTAL_FEATURES
	savefile_identifier = PREFERENCE_CHARACTER
	savefile_key = "head_acc_color"
	priority = PREFERENCE_PRIORITY_MUTANT_COLORS
	can_randomize = FALSE
	relevant_mutant_bodypart = "head_acc"

/datum/preference/tri_color/head_acc/create_informed_default_value(datum/preferences/preferences)
	var/part_type = preferences.read_preference(/datum/preference/choiced/head_acc)
	if(part_type)
		var/datum/sprite_accessory/sprite_accessory = GLOB.sprite_accessories[relevant_mutant_bodypart][part_type]
		if(sprite_accessory)
			var/pref_species = preferences.read_preference(/datum/preference/choiced/species)
			var/color = sprite_accessory.get_default_color(preferences.get_features(), pref_species)
			if(LAZYLEN(color) == 3)
				return list(sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[2], 6), sanitize_hexcolor(color[3], 6))
			else if(LAZYLEN(color) == 1)
				return list(sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[1], 6))
	return list("FFFFFF", "FFFFFF", "FFFFFF")

/datum/preference/tri_color/head_acc/apply_to_human(mob/living/carbon/human/target, value)
	if(!target.dna.mutant_bodyparts[relevant_mutant_bodypart])
		target.dna.mutant_bodyparts[relevant_mutant_bodypart] = list(MUTANT_INDEX_NAME = "None", \
												MUTANT_INDEX_COLOR = list("FFFFFF", "FFFFFF", "FFFFFF"))
	target.dna.mutant_bodyparts[relevant_mutant_bodypart][MUTANT_INDEX_COLOR] = list(sanitize_hexcolor(value[1], 6), sanitize_hexcolor(value[2], 6), sanitize_hexcolor(value[3], 6))


code:
// Horns
/datum/preference/choiced/horns
	category = PREFERENCE_CATEGORY_FEATURES
	savefile_identifier = PREFERENCE_CHARACTER
	savefile_key = "feature_horns"
	priority = PREFERENCE_PRIORITY_MUTANT_PART
	main_feature_name = "Horns"
	relevant_mutant_bodypart = "horns"
	can_randomize = FALSE
	should_generate_icons = TRUE

/datum/preference/choiced/horns/create_informed_default_value(datum/preferences/preferences)
	. = ..()
	var/species_type = preferences.read_preference(/datum/preference/choiced/species)
	var/datum/species/species = new species_type()
	if(species.default_mutant_bodyparts[relevant_mutant_bodypart])
		if(species.default_mutant_bodyparts[relevant_mutant_bodypart] == ACC_RANDOM)
			qdel(species)
			return pick(GLOB.sprite_accessories[relevant_mutant_bodypart]-"None")
		qdel(species)
		return species.default_mutant_bodyparts[relevant_mutant_bodypart]
	return "None"

/datum/preference/choiced/horns/init_possible_values()
	return generate_possible_values_for_sprite_accessories_on_head(GLOB.sprite_accessories[relevant_mutant_bodypart])

/datum/preference/choiced/horns/apply_to_human(mob/living/carbon/human/target, value)
	if(!target.dna.mutant_bodyparts[relevant_mutant_bodypart])
		target.dna.mutant_bodyparts[relevant_mutant_bodypart] = list(MUTANT_INDEX_NAME = "None", \
											MUTANT_INDEX_COLOR = list("FFFFFF", "FFFFFF", "FFFFFF"))
	target.dna.mutant_bodyparts[relevant_mutant_bodypart][MUTANT_INDEX_NAME] = value

/datum/preference/choiced/horns/compile_constant_data()
	var/list/data = ..()

	data[SUPPLEMENTAL_FEATURE_KEY] = "horns_color"

	return data

// Horn color
/datum/preference/tri_color/horns
	category = PREFERENCE_CATEGORY_SUPPLEMENTAL_FEATURES
	savefile_identifier = PREFERENCE_CHARACTER
	savefile_key = "horns_color"
	priority = PREFERENCE_PRIORITY_MUTANT_COLORS
	can_randomize = FALSE
	relevant_mutant_bodypart = "horns"

/datum/preference/tri_color/horns/create_informed_default_value(datum/preferences/preferences)
	var/part_type = preferences.read_preference(/datum/preference/choiced/horns)
	if(part_type)
		var/datum/sprite_accessory/sprite_accessory = GLOB.sprite_accessories[relevant_mutant_bodypart][part_type]
		if(sprite_accessory)
			var/pref_species = preferences.read_preference(/datum/preference/choiced/species)
			var/color = sprite_accessory.get_default_color(preferences.get_features(), pref_species)
			if(LAZYLEN(color) == 3)
				return list(sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[2], 6), sanitize_hexcolor(color[3], 6))
			else if(LAZYLEN(color) == 1)
				return list(sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[1], 6))
	return list("FFFFFF", "FFFFFF", "FFFFFF")

/datum/preference/tri_color/horns/apply_to_human(mob/living/carbon/human/target, value)
	if(!target.dna.mutant_bodyparts[relevant_mutant_bodypart])
		target.dna.mutant_bodyparts[relevant_mutant_bodypart] = list(MUTANT_INDEX_NAME = "None", \
												MUTANT_INDEX_COLOR = list("FFFFFF", "FFFFFF", "FFFFFF"))
	target.dna.mutant_bodyparts[relevant_mutant_bodypart][MUTANT_INDEX_COLOR] = list(sanitize_hexcolor(value[1], 6), sanitize_hexcolor(value[2], 6), sanitize_hexcolor(value[3], 6))


code:
// Moth antennae
/datum/preference/choiced/moth_antennae
	category = PREFERENCE_CATEGORY_FEATURES
	savefile_identifier = PREFERENCE_CHARACTER
	savefile_key = "feature_moth_antennae"
	priority = PREFERENCE_PRIORITY_MUTANT_PART
	main_feature_name = "Moth antennae"
	relevant_mutant_bodypart = "moth_antennae"
	can_randomize = FALSE
	should_generate_icons = TRUE

/datum/preference/choiced/moth_antennae/create_informed_default_value(datum/preferences/preferences)
	. = ..()
	var/species_type = preferences.read_preference(/datum/preference/choiced/species)
	var/datum/species/species = new species_type()
	if(species.default_mutant_bodyparts[relevant_mutant_bodypart])
		if(species.default_mutant_bodyparts[relevant_mutant_bodypart] == ACC_RANDOM)
			qdel(species)
			return pick(GLOB.sprite_accessories[relevant_mutant_bodypart]-"None")
		qdel(species)
		return species.default_mutant_bodyparts[relevant_mutant_bodypart]
	return "None"

/datum/preference/choiced/moth_antennae/init_possible_values()
	return generate_possible_values_for_sprite_accessories_on_moth_head(GLOB.sprite_accessories[relevant_mutant_bodypart])

/datum/preference/choiced/moth_antennae/apply_to_human(mob/living/carbon/human/target, value)
	if(!target.dna.mutant_bodyparts[relevant_mutant_bodypart])
		target.dna.mutant_bodyparts[relevant_mutant_bodypart] = list(MUTANT_INDEX_NAME = "None", \
											MUTANT_INDEX_COLOR = list("FFFFFF", "FFFFFF", "FFFFFF"))
	target.dna.mutant_bodyparts[relevant_mutant_bodypart][MUTANT_INDEX_NAME] = value

/datum/preference/choiced/moth_antennae/compile_constant_data()
	var/list/data = ..()

	data[SUPPLEMENTAL_FEATURE_KEY] = "moth_antennae_color"

	return data

// Moth antennae color
/datum/preference/tri_color/moth_antennae
	category = PREFERENCE_CATEGORY_SUPPLEMENTAL_FEATURES
	savefile_identifier = PREFERENCE_CHARACTER
	savefile_key = "moth_antennae_color"
	priority = PREFERENCE_PRIORITY_MUTANT_PART
	can_randomize = FALSE
	relevant_mutant_bodypart = "moth_antennae"

/datum/preference/tri_color/moth_antennae/create_informed_default_value(datum/preferences/preferences)
	var/part_type = preferences.read_preference(/datum/preference/choiced/moth_antennae)
	if(part_type)
		var/datum/sprite_accessory/sprite_accessory = GLOB.sprite_accessories[relevant_mutant_bodypart][part_type]
		if(sprite_accessory)
			var/pref_species = preferences.read_preference(/datum/preference/choiced/species)
			var/color = sprite_accessory.get_default_color(preferences.get_features(), pref_species)
			if(LAZYLEN(color) == 3)
				return list(sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[2], 6), sanitize_hexcolor(color[3], 6))
			else if(LAZYLEN(color) == 1)
				return list(sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[1], 6))
	return list("FFFFFF", "FFFFFF", "FFFFFF")

/datum/preference/tri_color/moth_antennae/apply_to_human(mob/living/carbon/human/target, value)
	if(!target.dna.mutant_bodyparts[relevant_mutant_bodypart])
		target.dna.mutant_bodyparts[relevant_mutant_bodypart] = list(MUTANT_INDEX_NAME = "None", \
												MUTANT_INDEX_COLOR = list("FFFFFF", "FFFFFF", "FFFFFF"))
	target.dna.mutant_bodyparts[relevant_mutant_bodypart][MUTANT_INDEX_COLOR] = list(sanitize_hexcolor(value[1], 6), sanitize_hexcolor(value[2], 6), sanitize_hexcolor(value[3], 6))


code:
// Moth markings
/datum/preference/choiced/moth_markings
	category = PREFERENCE_CATEGORY_FEATURES
	savefile_identifier = PREFERENCE_CHARACTER
	savefile_key = "feature_moth_markings"
	priority = PREFERENCE_PRIORITY_MUTANT_PART
	main_feature_name = "Moth markings"
	relevant_mutant_bodypart = "moth_markings"
	can_randomize = FALSE
	should_generate_icons = TRUE

/datum/preference/choiced/moth_markings/create_informed_default_value(datum/preferences/preferences)
	. = ..()
	var/species_type = preferences.read_preference(/datum/preference/choiced/species)
	var/datum/species/species = new species_type()
	if(species.default_mutant_bodyparts[relevant_mutant_bodypart])
		if(species.default_mutant_bodyparts[relevant_mutant_bodypart] == ACC_RANDOM)
			qdel(species)
			return pick(GLOB.sprite_accessories[relevant_mutant_bodypart]-"None")
		qdel(species)
		return species.default_mutant_bodyparts[relevant_mutant_bodypart]
	return "None"

/datum/preference/choiced/moth_markings/init_possible_values()
	return generate_possible_values_for_sprite_accessories_on_moth_chest(GLOB.sprite_accessories[relevant_mutant_bodypart])

/datum/preference/choiced/moth_markings/apply_to_human(mob/living/carbon/human/target, value)
	if(!target.dna.mutant_bodyparts[relevant_mutant_bodypart])
		target.dna.mutant_bodyparts[relevant_mutant_bodypart] = list(MUTANT_INDEX_NAME = "None", \
											MUTANT_INDEX_COLOR = list("FFFFFF", "FFFFFF", "FFFFFF"))
	target.dna.mutant_bodyparts[relevant_mutant_bodypart][MUTANT_INDEX_NAME] = value

/datum/preference/choiced/moth_markings/compile_constant_data()
	var/list/data = ..()

	data[SUPPLEMENTAL_FEATURE_KEY] = "moth_markings_color"

	return data

// Moth antennae color
/datum/preference/tri_color/moth_markings
	category = PREFERENCE_CATEGORY_SUPPLEMENTAL_FEATURES
	savefile_identifier = PREFERENCE_CHARACTER
	savefile_key = "moth_markings_color"
	priority = PREFERENCE_PRIORITY_MUTANT_COLORS
	can_randomize = FALSE
	relevant_mutant_bodypart = "moth_markings"

/datum/preference/tri_color/moth_markings/create_informed_default_value(datum/preferences/preferences)
	var/part_type = preferences.read_preference(/datum/preference/choiced/moth_markings)
	if(part_type)
		var/datum/sprite_accessory/sprite_accessory = GLOB.sprite_accessories[relevant_mutant_bodypart][part_type]
		if(sprite_accessory)
			var/pref_species = preferences.read_preference(/datum/preference/choiced/species)
			var/color = sprite_accessory.get_default_color(preferences.get_features(), pref_species)
			if(LAZYLEN(color) == 3)
				return list(sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[2], 6), sanitize_hexcolor(color[3], 6))
			else if(LAZYLEN(color) == 1)
				return list(sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[1], 6))
	return list("FFFFFF", "FFFFFF", "FFFFFF")

/datum/preference/tri_color/moth_markings/apply_to_human(mob/living/carbon/human/target, value)
	if(!target.dna.mutant_bodyparts[relevant_mutant_bodypart])
		target.dna.mutant_bodyparts[relevant_mutant_bodypart] = list(MUTANT_INDEX_NAME = "None", \
												MUTANT_INDEX_COLOR = list("FFFFFF", "FFFFFF", "FFFFFF"))
	target.dna.mutant_bodyparts[relevant_mutant_bodypart][MUTANT_INDEX_COLOR] = list(sanitize_hexcolor(value[1], 6), sanitize_hexcolor(value[2], 6), sanitize_hexcolor(value[3], 6))


code:
// Neck accessory
/datum/preference/choiced/neck_acc
	category = PREFERENCE_CATEGORY_FEATURES
	savefile_identifier = PREFERENCE_CHARACTER
	savefile_key = "feature_neck_acc"
	priority = PREFERENCE_PRIORITY_MUTANT_PART
	main_feature_name = "Neck accessory"
	relevant_mutant_bodypart = "neck_acc"
	can_randomize = FALSE
	should_generate_icons = TRUE

/datum/preference/choiced/neck_acc/create_informed_default_value(datum/preferences/preferences)
	. = ..()
	var/species_type = preferences.read_preference(/datum/preference/choiced/species)
	var/datum/species/species = new species_type()
	if(species.default_mutant_bodyparts[relevant_mutant_bodypart])
		if(species.default_mutant_bodyparts[relevant_mutant_bodypart] == ACC_RANDOM)
			qdel(species)
			return pick(GLOB.sprite_accessories[relevant_mutant_bodypart]-"None")
		qdel(species)
		return species.default_mutant_bodyparts[relevant_mutant_bodypart]
	return "None"

/datum/preference/choiced/neck_acc/init_possible_values()
	return generate_possible_values_for_sprite_accessories_on_head(GLOB.sprite_accessories[relevant_mutant_bodypart])

/datum/preference/choiced/neck_acc/apply_to_human(mob/living/carbon/human/target, value)
	if(!target.dna.mutant_bodyparts[relevant_mutant_bodypart])
		target.dna.mutant_bodyparts[relevant_mutant_bodypart] = list(MUTANT_INDEX_NAME = "None", \
											MUTANT_INDEX_COLOR = list("FFFFFF", "FFFFFF", "FFFFFF"))
	target.dna.mutant_bodyparts[relevant_mutant_bodypart][MUTANT_INDEX_NAME] = value

/datum/preference/choiced/neck_acc/compile_constant_data()
	var/list/data = ..()

	data[SUPPLEMENTAL_FEATURE_KEY] = "neck_acc_color"

	return data

// Neck accessory color
/datum/preference/tri_color/neck_acc
	category = PREFERENCE_CATEGORY_SUPPLEMENTAL_FEATURES
	savefile_identifier = PREFERENCE_CHARACTER
	savefile_key = "neck_acc_color"
	priority = PREFERENCE_PRIORITY_MUTANT_COLORS
	can_randomize = FALSE
	relevant_mutant_bodypart = "neck_acc"

/datum/preference/tri_color/neck_acc/create_informed_default_value(datum/preferences/preferences)
	var/part_type = preferences.read_preference(/datum/preference/choiced/neck_acc)
	if(part_type)
		var/datum/sprite_accessory/sprite_accessory = GLOB.sprite_accessories[relevant_mutant_bodypart][part_type]
		if(sprite_accessory)
			var/pref_species = preferences.read_preference(/datum/preference/choiced/species)
			var/color = sprite_accessory.get_default_color(preferences.get_features(), pref_species)
			if(LAZYLEN(color) == 3)
				return list(sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[2], 6), sanitize_hexcolor(color[3], 6))
			else if(LAZYLEN(color) == 1)
				return list(sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[1], 6))
	return list("FFFFFF", "FFFFFF", "FFFFFF")

/datum/preference/tri_color/neck_acc/apply_to_human(mob/living/carbon/human/target, value)
	if(!target.dna.mutant_bodyparts[relevant_mutant_bodypart])
		target.dna.mutant_bodyparts[relevant_mutant_bodypart] = list(MUTANT_INDEX_NAME = "None", \
												MUTANT_INDEX_COLOR = list("FFFFFF", "FFFFFF", "FFFFFF"))
	target.dna.mutant_bodyparts[relevant_mutant_bodypart][MUTANT_INDEX_COLOR] = list(sanitize_hexcolor(value[1], 6), sanitize_hexcolor(value[2], 6), sanitize_hexcolor(value[3], 6))


code:
// Snout
/datum/preference/choiced/snout
	category = PREFERENCE_CATEGORY_FEATURES
	savefile_identifier = PREFERENCE_CHARACTER
	savefile_key = "feature_snout"
	priority = PREFERENCE_PRIORITY_MUTANT_PART
	main_feature_name = "Snout"
	relevant_mutant_bodypart = "snout"
	can_randomize = FALSE
	should_generate_icons = TRUE

/datum/preference/choiced/snout/create_informed_default_value(datum/preferences/preferences)
	. = ..()
	var/species_type = preferences.read_preference(/datum/preference/choiced/species)
	var/datum/species/species = new species_type()
	if(species.default_mutant_bodyparts[relevant_mutant_bodypart])
		if(species.default_mutant_bodyparts[relevant_mutant_bodypart] == ACC_RANDOM)
			qdel(species)
			return pick(GLOB.sprite_accessories[relevant_mutant_bodypart]-"None")
		qdel(species)
		return species.default_mutant_bodyparts[relevant_mutant_bodypart]
	return "None"

/datum/preference/choiced/snout/init_possible_values()
	return generate_possible_values_for_sprite_accessories_on_head(GLOB.sprite_accessories[relevant_mutant_bodypart])

/datum/preference/choiced/snout/apply_to_human(mob/living/carbon/human/target, value)
	if(!target.dna.mutant_bodyparts[relevant_mutant_bodypart])
		target.dna.mutant_bodyparts[relevant_mutant_bodypart] = list(MUTANT_INDEX_NAME = "None", \
											MUTANT_INDEX_COLOR = list("FFFFFF", "FFFFFF", "FFFFFF"))
	target.dna.mutant_bodyparts[relevant_mutant_bodypart][MUTANT_INDEX_NAME] = value

/datum/preference/choiced/snout/compile_constant_data()
	var/list/data = ..()

	data[SUPPLEMENTAL_FEATURE_KEY] = "snout_color"

	return data

// Snout color
/datum/preference/tri_color/snout
	category = PREFERENCE_CATEGORY_SUPPLEMENTAL_FEATURES
	savefile_identifier = PREFERENCE_CHARACTER
	savefile_key = "snout_color"
	priority = PREFERENCE_PRIORITY_MUTANT_COLORS
	can_randomize = FALSE
	relevant_mutant_bodypart = "snout"

/datum/preference/tri_color/snout/create_informed_default_value(datum/preferences/preferences)
	var/part_type = preferences.read_preference(/datum/preference/choiced/snout)
	if(part_type)
		var/datum/sprite_accessory/sprite_accessory = GLOB.sprite_accessories[relevant_mutant_bodypart][part_type]
		if(sprite_accessory)
			var/pref_species = preferences.read_preference(/datum/preference/choiced/species)
			var/color = sprite_accessory.get_default_color(preferences.get_features(), pref_species)
			if(LAZYLEN(color) == 3)
				return list(sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[2], 6), sanitize_hexcolor(color[3], 6))
			else if(LAZYLEN(color) == 1)
				return list(sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[1], 6))
	return list("FFFFFF", "FFFFFF", "FFFFFF")

/datum/preference/tri_color/snout/apply_to_human(mob/living/carbon/human/target, value)
	if(!target.dna.mutant_bodyparts[relevant_mutant_bodypart])
		target.dna.mutant_bodyparts[relevant_mutant_bodypart] = list(MUTANT_INDEX_NAME = "None", \
												MUTANT_INDEX_COLOR = list("FFFFFF", "FFFFFF", "FFFFFF"))
	target.dna.mutant_bodyparts[relevant_mutant_bodypart][MUTANT_INDEX_COLOR] = list(sanitize_hexcolor(value[1], 6), sanitize_hexcolor(value[2], 6), sanitize_hexcolor(value[3], 6))


code:
// Spines
/datum/preference/choiced/spines
	category = PREFERENCE_CATEGORY_FEATURES
	savefile_identifier = PREFERENCE_CHARACTER
	savefile_key = "feature_spines"
	priority = PREFERENCE_PRIORITY_MUTANT_PART
	main_feature_name = "Spines"
	relevant_mutant_bodypart = "spines"
	can_randomize = FALSE
	should_generate_icons = TRUE

/datum/preference/choiced/spines/create_informed_default_value(datum/preferences/preferences)
	. = ..()
	var/species_type = preferences.read_preference(/datum/preference/choiced/species)
	var/datum/species/species = new species_type()
	if(species.default_mutant_bodyparts[relevant_mutant_bodypart])
		if(species.default_mutant_bodyparts[relevant_mutant_bodypart] == ACC_RANDOM)
			qdel(species)
			return pick(GLOB.sprite_accessories[relevant_mutant_bodypart]-"None")
		qdel(species)
		return species.default_mutant_bodyparts[relevant_mutant_bodypart]
	return "None"

/datum/preference/choiced/spines/init_possible_values()
	return generate_possible_values_for_sprite_accessories_on_groin_with_tail(GLOB.sprite_accessories[relevant_mutant_bodypart], NORTH)

/datum/preference/choiced/spines/apply_to_human(mob/living/carbon/human/target, value)
	if(!target.dna.mutant_bodyparts[relevant_mutant_bodypart])
		target.dna.mutant_bodyparts[relevant_mutant_bodypart] = list(MUTANT_INDEX_NAME = "None", \
											MUTANT_INDEX_COLOR = list("FFFFFF", "FFFFFF", "FFFFFF"))
	target.dna.mutant_bodyparts[relevant_mutant_bodypart][MUTANT_INDEX_NAME] = value

/datum/preference/choiced/spines/compile_constant_data()
	var/list/data = ..()

	data[SUPPLEMENTAL_FEATURE_KEY] = "spines_color"

	return data

// Spines color
/datum/preference/tri_color/spines
	category = PREFERENCE_CATEGORY_SUPPLEMENTAL_FEATURES
	savefile_identifier = PREFERENCE_CHARACTER
	savefile_key = "spines_color"
	priority = PREFERENCE_PRIORITY_MUTANT_COLORS
	can_randomize = FALSE
	relevant_mutant_bodypart = "spines"

/datum/preference/tri_color/spines/create_informed_default_value(datum/preferences/preferences)
	var/part_type = preferences.read_preference(/datum/preference/choiced/spines)
	if(part_type)
		var/datum/sprite_accessory/sprite_accessory = GLOB.sprite_accessories[relevant_mutant_bodypart][part_type]
		if(sprite_accessory)
			var/pref_species = preferences.read_preference(/datum/preference/choiced/species)
			var/color = sprite_accessory.get_default_color(preferences.get_features(), pref_species)
			if(LAZYLEN(color) == 3)
				return list(sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[2], 6), sanitize_hexcolor(color[3], 6))
			else if(LAZYLEN(color) == 1)
				return list(sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[1], 6))
	return list("FFFFFF", "FFFFFF", "FFFFFF")

/datum/preference/tri_color/spines/apply_to_human(mob/living/carbon/human/target, value)
	if(!target.dna.mutant_bodyparts[relevant_mutant_bodypart])
		target.dna.mutant_bodyparts[relevant_mutant_bodypart] = list(MUTANT_INDEX_NAME = "None", \
												MUTANT_INDEX_COLOR = list("FFFFFF", "FFFFFF", "FFFFFF"))
	target.dna.mutant_bodyparts[relevant_mutant_bodypart][MUTANT_INDEX_COLOR] = list(sanitize_hexcolor(value[1], 6), sanitize_hexcolor(value[2], 6), sanitize_hexcolor(value[3], 6))


code:
// Tail
/datum/preference/choiced/tail
	category = PREFERENCE_CATEGORY_FEATURES
	savefile_identifier = PREFERENCE_CHARACTER
	savefile_key = "feature_tail"
	priority = PREFERENCE_PRIORITY_MUTANT_PART
	main_feature_name = "Tail"
	relevant_mutant_bodypart = "tail"
	can_randomize = FALSE
	should_generate_icons = TRUE

/datum/preference/choiced/tail/create_informed_default_value(datum/preferences/preferences)
	. = ..()
	var/species_type = preferences.read_preference(/datum/preference/choiced/species)
	var/datum/species/species = new species_type()
	if(species.default_mutant_bodyparts[relevant_mutant_bodypart])
		if(species.default_mutant_bodyparts[relevant_mutant_bodypart] == ACC_RANDOM)
			qdel(species)
			return pick(GLOB.sprite_accessories[relevant_mutant_bodypart]-"None")
		qdel(species)
		return species.default_mutant_bodyparts[relevant_mutant_bodypart]
	return "None"

/datum/preference/choiced/tail/init_possible_values()
	return generate_possible_values_for_sprite_accessories_on_groin(GLOB.sprite_accessories[relevant_mutant_bodypart], NORTH)

/datum/preference/choiced/tail/apply_to_human(mob/living/carbon/human/target, value)
	if(!target.dna.mutant_bodyparts[relevant_mutant_bodypart])
		target.dna.mutant_bodyparts[relevant_mutant_bodypart] = list(MUTANT_INDEX_NAME = "None", \
											MUTANT_INDEX_COLOR = list("FFFFFF", "FFFFFF", "FFFFFF"))
	target.dna.mutant_bodyparts[relevant_mutant_bodypart][MUTANT_INDEX_NAME] = value

/datum/preference/choiced/tail/compile_constant_data()
	var/list/data = ..()

	data[SUPPLEMENTAL_FEATURE_KEY] = "tail_color"

	return data

// Tail color
/datum/preference/tri_color/tail
	category = PREFERENCE_CATEGORY_SUPPLEMENTAL_FEATURES
	savefile_identifier = PREFERENCE_CHARACTER
	savefile_key = "tail_color"
	priority = PREFERENCE_PRIORITY_MUTANT_COLORS
	can_randomize = FALSE
	relevant_mutant_bodypart = "tail"

/datum/preference/tri_color/spines/create_informed_default_value(datum/preferences/preferences)
	var/part_type = preferences.read_preference(/datum/preference/choiced/tail)
	if(part_type)
		var/datum/sprite_accessory/sprite_accessory = GLOB.sprite_accessories[relevant_mutant_bodypart][part_type]
		if(sprite_accessory)
			var/pref_species = preferences.read_preference(/datum/preference/choiced/species)
			var/color = sprite_accessory.get_default_color(preferences.get_features(), pref_species)
			if(LAZYLEN(color) == 3)
				return list(sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[2], 6), sanitize_hexcolor(color[3], 6))
			else if(LAZYLEN(color) == 1)
				return list(sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[1], 6))
	return list("FFFFFF", "FFFFFF", "FFFFFF")

/datum/preference/tri_color/tail/apply_to_human(mob/living/carbon/human/target, value)
	if(!target.dna.mutant_bodyparts[relevant_mutant_bodypart])
		target.dna.mutant_bodyparts[relevant_mutant_bodypart] = list(MUTANT_INDEX_NAME = "None", \
												MUTANT_INDEX_COLOR = list("FFFFFF", "FFFFFF", "FFFFFF"))
	target.dna.mutant_bodyparts[relevant_mutant_bodypart][MUTANT_INDEX_COLOR] = list(sanitize_hexcolor(value[1], 6), sanitize_hexcolor(value[2], 6), sanitize_hexcolor(value[3], 6))


code:
// Wings
/datum/preference/choiced/wings
	category = PREFERENCE_CATEGORY_FEATURES
	savefile_identifier = PREFERENCE_CHARACTER
	savefile_key = "feature_wings"
	priority = PREFERENCE_PRIORITY_MUTANT_PART
	main_feature_name = "Wings"
	relevant_mutant_bodypart = "wings"
	can_randomize = FALSE
	should_generate_icons = TRUE

/datum/preference/choiced/wings/create_informed_default_value(datum/preferences/preferences)
	. = ..()
	var/species_type = preferences.read_preference(/datum/preference/choiced/species)
	var/datum/species/species = new species_type()
	if(species.default_mutant_bodyparts[relevant_mutant_bodypart])
		if(species.default_mutant_bodyparts[relevant_mutant_bodypart] == ACC_RANDOM)
			qdel(species)
			return pick(GLOB.sprite_accessories[relevant_mutant_bodypart]-"None")
		qdel(species)
		return species.default_mutant_bodyparts[relevant_mutant_bodypart]
	return "None"

/datum/preference/choiced/wings/init_possible_values()
	return generate_possible_values_for_sprite_accessories_on_chest(GLOB.sprite_accessories[relevant_mutant_bodypart], NORTH)

/datum/preference/choiced/wings/apply_to_human(mob/living/carbon/human/target, value)
	if(!target.dna.mutant_bodyparts[relevant_mutant_bodypart])
		target.dna.mutant_bodyparts[relevant_mutant_bodypart] = list(MUTANT_INDEX_NAME = "None", \
											MUTANT_INDEX_COLOR = list("FFFFFF", "FFFFFF", "FFFFFF"))
	target.dna.mutant_bodyparts[relevant_mutant_bodypart][MUTANT_INDEX_NAME] = value

/datum/preference/choiced/wings/compile_constant_data()
	var/list/data = ..()

	data[SUPPLEMENTAL_FEATURE_KEY] = "wings_color"

	return data

// Wings color
/datum/preference/tri_color/wings
	category = PREFERENCE_CATEGORY_SUPPLEMENTAL_FEATURES
	savefile_identifier = PREFERENCE_CHARACTER
	savefile_key = "wings_color"
	priority = PREFERENCE_PRIORITY_MUTANT_COLORS
	can_randomize = FALSE
	relevant_mutant_bodypart = "wings"

/datum/preference/tri_color/wings/create_informed_default_value(datum/preferences/preferences)
	var/part_type = preferences.read_preference(/datum/preference/choiced/tail)
	if(part_type)
		var/datum/sprite_accessory/sprite_accessory = GLOB.sprite_accessories[relevant_mutant_bodypart][part_type]
		if(sprite_accessory)
			var/pref_species = preferences.read_preference(/datum/preference/choiced/species)
			var/color = sprite_accessory.get_default_color(preferences.get_features(), pref_species)
			if(LAZYLEN(color) == 3)
				return list(sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[2], 6), sanitize_hexcolor(color[3], 6))
			else if(LAZYLEN(color) == 1)
				return list(sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[1], 6), sanitize_hexcolor(color[1], 6))
	return list("FFFFFF", "FFFFFF", "FFFFFF")

/datum/preference/tri_color/wings/apply_to_human(mob/living/carbon/human/target, value)
	if(!target.dna.mutant_bodyparts[relevant_mutant_bodypart])
		target.dna.mutant_bodyparts[relevant_mutant_bodypart] = list(MUTANT_INDEX_NAME = "None", \
												MUTANT_INDEX_COLOR = list("FFFFFF", "FFFFFF", "FFFFFF"))
	target.dna.mutant_bodyparts[relevant_mutant_bodypart][MUTANT_INDEX_COLOR] = list(sanitize_hexcolor(value[1], 6), sanitize_hexcolor(value[2], 6), sanitize_hexcolor(value[3], 6))


code:
/datum/preference/choiced/security_department/is_accessible(datum/preferences/preferences)
	return FALSE


code:
// Skin tone toggle
/datum/preference/toggle/skin_tone
	category = PREFERENCE_CATEGORY_NON_CONTEXTUAL
	savefile_identifier = PREFERENCE_CHARACTER
	savefile_key = "skin_tone_toggle"
	priority = PREFERENCE_PRIORITY_USE_SKINTONES
	can_randomize = FALSE
	default_value = FALSE

/datum/preference/toggle/skin_tone/is_accessible(datum/preferences/preferences)
	. = ..()
	if(!.)
		return FALSE
	var/datum/species/species_type = preferences.read_preference(/datum/preference/choiced/species)
	return initial(species_type.use_skintones)

/datum/preference/toggle/skin_tone/create_informed_default_value(datum/preferences/preferences)
	var/datum/species/species_type = preferences.read_preference(/datum/preference/choiced/species)
	return initial(species_type.use_skintones)

/datum/preference/toggle/skin_tone/apply_to_human(mob/living/carbon/human/target, value, datum/preferences/preferences)
	target.dna.features["uses_skintones"] = value


code:
/datum/preference/choiced/species/apply_to_human(mob/living/carbon/human/target, value, datum/preferences/preferences)
	target.set_species(value, icon_update = FALSE, pref_load = preferences)


code:
/datum/preference/choiced/ui_style/is_accessible(datum/preferences/preferences)
	return FALSE


code:
/datum/preference/color/underwear_color/is_accessible(datum/preferences/preferences)
	return FALSE


code:
/datum/preference/choiced/uplink_location

/datum/preference/choiced/uplink_location/create_default_value()
	return UPLINK_RADIO

/datum/preference/choiced/uplink_location/init_possible_values()
	return list(UPLINK_RADIO)

/datum/preference/choiced/uplink_location/is_accessible(datum/preferences/preferences)
	return FALSE


code:
/datum/preference/toggle/widescreen
	default_value = TRUE

/datum/preference/toggle/widescreen/is_accessible(datum/preferences/preferences)
	return FALSE


code:
/datum/preferences/proc/save_character_septic(savefile/S)
	if(!S?.cd)
		return FALSE
	//Languages
	WRITE_FILE(S["languages"], languages)
	//Augments
	WRITE_FILE(S["augments"], augments)
	//Augments styles
	WRITE_FILE(S["augment_styles"], augment_styles)
	//Body markings
	WRITE_FILE(S["body_markings"], body_markings)
	//Birthsign
	WRITE_FILE(S["birthsign"], birthsign)
	return TRUE

/datum/preferences/proc/load_character_septic(savefile/S)
	if(!S?.cd)
		return FALSE
	//Languages
	READ_FILE(S["languages"], languages)
	//Augments
	READ_FILE(S["augments"], augments)
	//Augments styles
	READ_FILE(S["augment_styles"], augment_styles)
	//Body markings
	READ_FILE(S["body_markings"], body_markings)
	//Birthsign
	READ_FILE(S["birthsign"], birthsign)
	return TRUE


code:
/client/verb/politicalcompass()
	set name = "Political Compass"
	set category = "OOC"

	political_compass.ui_interact(mob)


code:
/client/ooc(msg as text)
	set name = "OOC" //Gave this shit a shorter name so you only have to time out "ooc" rather than "ooc message" to use it --NeoFite
	set category = "OOC"

	if(GLOB.say_disabled) //This is here to try to identify lag problems
		to_chat(usr, span_danger("Speech is currently admin-disabled."))
		return

	if(!mob)
		return

	if(!holder)
		if(!GLOB.ooc_allowed)
			to_chat(src, span_danger("OOC is globally muted."))
			return
		if(!GLOB.dooc_allowed && (mob.stat == DEAD))
			to_chat(usr, span_danger("OOC for dead mobs has been turned off."))
			return
		if(prefs.muted & MUTE_OOC)
			to_chat(src, span_danger("You cannot use OOC (muted)."))
			return
	if(is_banned_from(ckey, "OOC"))
		to_chat(src, span_danger("You have been banned from OOC."))
		return
	if(QDELETED(src))
		return

	msg = copytext_char(sanitize(msg), 1, MAX_MESSAGE_LEN)

	var/raw_msg = msg
	if(!raw_msg)
		return

	msg = emoji_parse(raw_msg)

	if(SSticker.HasRoundStarted() && (msg[1] in list(".",";",":","#") || findtext_char(msg, "say", 1, 5)))
		if(tgui_alert(usr,"Your message \"[raw_msg]\" looks like it was meant for in game communication, say it in OOC?", "Meant for OOC?", list("Yes", "No")) != "Yes")
			return

	if(!holder)
		if(handle_spam_prevention(msg,MUTE_OOC))
			return

	if(!(prefs.chat_toggles & CHAT_OOC))
		to_chat(src, span_danger("You have OOC muted."))
		return

	var/raw_msg_without_spaces = replacetext(raw_msg, " ", "")
	if((length(msg) >= 3) && ((length(raw_msg)-length(raw_msg_without_spaces))/length(raw_msg) >= 0.5) )
		to_chat(src, span_warning("Most of your message was just empty space."))
		return

	mob.log_talk(raw_msg, LOG_OOC)

	var/datum/asset/spritesheet/sheet = get_asset_datum(/datum/asset/spritesheet/chat)
	var/keyname = key
	if(SSdonators.donator_to_ooc_color[ckey])
		keyname = "[keyname]"
	if(sheet.icon_tag("donator-[ckey]"))
		keyname = "[sheet.icon_tag("donator-[ckey]")] [keyname]"
	else
		switch(country)
			if("Brazil")
				keyname = "[sheet.icon_tag("ooc-whatsapp")] [keyname]"
			if("Niger")
				keyname = "[sheet.icon_tag("ooc-niger")] [keyname]"
				msg = "[msg] - I hate niger's economic policies."
			if("Ukraine", "Russia")
				keyname = "[sheet.icon_tag("ooc-hohol")] [keyname]"
				msg = "[msg] - Oink oink!"
	var/pol_flag = political_compass?.get_flag()
	if(pol_flag)
		keyname = "[sheet.icon_tag("ooc-[pol_flag]")] [keyname]"
	var/ooccolor = prefs.read_preference(/datum/preference/color/ooc_color)
	if(prefs.unlock_content)
		if(prefs.toggles & MEMBER_PUBLIC)
			keyname = "[icon2html('icons/member_content.dmi', world, "blag")] [keyname]"
	if(prefs.hearted)
		keyname = "[sheet.icon_tag("emoji-heart")] [keyname]"
	//The linkify span classes and linkify=TRUE below make ooc text get clickable chat href links if you pass in something resembling a url
	for(var/client/player as anything in GLOB.clients)
		if(player.prefs.chat_toggles & CHAT_OOC)
			if(holder?.fakekey in player.prefs.ignoring)
				continue
			if(holder)
				if(!holder.fakekey || player.holder)
					if(check_rights_for(src, R_ADMIN))
						to_chat(player, span_adminooc("[CONFIG_GET(flag/allow_admin_ooccolor) && ooccolor ? "" :"" ]OOC: [keyname][holder.fakekey ? "/([holder.fakekey])" : ""]: [msg]"))
					else
						to_chat(player, span_adminobserverooc("OOC: [keyname][holder.fakekey ? "/([holder.fakekey])" : ""]: [msg]"))
				else
					if(GLOB.OOC_COLOR)
						to_chat(player, span_ooc("OOC: [holder.fakekey ? holder.fakekey : key]: [msg]"))
					else
						to_chat(player, span_ooc("OOC: [holder.fakekey ? holder.fakekey : key]: [msg]"))
			else if(!(key in player.prefs.ignoring))
				if(GLOB.OOC_COLOR)
					to_chat(player, span_ooc("OOC: [keyname]: [msg]"))
				else
					to_chat(player, span_ooc("OOC: [keyname]: [msg]"))


code:
/client/who()
	set name = "Who"
	set category = "OOC"

	SSwho?.who_datum?.ui_interact(mob)

/client/adminwho()
	set category = "Admin"
	set name = "Adminwho"

	SSwho?.adminwho_datum?.ui_interact(mob)


code:
/obj/item/clothing
	// Assume that clothing isn't too weighty by default
	carry_weight = 2

/obj/item/clothing/examine(mob/user)
	. = ..()
	switch(germ_level)
		if(GERM_LEVEL_DIRTY to GERM_LEVEL_FILTHY)
			. += span_alert("[src] is a bit dirty.")
		if(GERM_LEVEL_FILTHY to GERM_LEVEL_SMASHPLAYER)
			. += span_warning("[src] is filthy.")
		if(GERM_LEVEL_SMASHPLAYER to INFINITY)
			. += span_boldwarning("[src] exhudes an unbearable musty smell.")

/obj/item/clothing/germ_level_examine(mob/user)
	switch(germ_level)
		if(GERM_LEVEL_DIRTY to GERM_LEVEL_FILTHY)
			return span_alert("[src] is dirty.")
		if(GERM_LEVEL_FILTHY to GERM_LEVEL_SMASHPLAYER)
			return span_warning("[src] is filthy.")
		if(GERM_LEVEL_SMASHPLAYER to INFINITY)
			return span_boldwarning("[src] exhudes an unbearable musty smell.")

/obj/item/clothing/Topic(href, href_list)
	. = ..()
	if(href_list["list_armor"])
		var/list/readout = list("
")
		readout += span_notice("PROTECTION CLASSES (I-X)\n")
		if(LAZYLEN(armor_list))
			readout += span_notice("\nARMOR")
			for(var/dam_type in armor_list)
				var/armor_amount = armor_list[dam_type]
				readout += span_info("\n[dam_type] [armor_to_protection_class(armor_amount)]") //e.g. BOMB IV
		if(LAZYLEN(durability_list))
			readout += span_notice("\nDURABILITY")
			for(var/dam_type in durability_list)
				var/durability_amount = durability_list[dam_type]
				readout += span_info("\n[dam_type] [armor_to_protection_class(durability_amount)]") //e.g. FIRE II
		readout += "
" //div infobox

		to_chat(usr, "[readout.Join()]")


code:
/obj/item/clothing/belt
	carry_weight = 1


code:
/obj/item/storage/belt/medical/humorist
	icon = 'modular_septic/icons/obj/clothing/belts.dmi'
	icon_state = "medical_belt"
	worn_icon = 'modular_septic/icons/mob/clothing/belt.dmi'
	worn_icon_state = "medical_belt"


code:
/obj/item/storage/belt/security/full/PopulateContents()
	new /obj/item/reagent_containers/spray/pepper(src)
	new /obj/item/restraints/handcuffs(src)
	new /obj/item/grenade/flashbang(src)
	new /obj/item/assembly/flash/handheld(src)
	new /obj/item/melee/truncheon(src)
	update_appearance()


code:
/obj/item/clothing/glasses
	carry_weight = 0.15


code:
/obj/item/clothing/glasses/hud/security/sunglasses/zoomtech
	name = "ZoomTech aviators"
	desc = "Fancy golden aviators to release your inner golden shower."
	icon = 'modular_septic/icons/obj/clothing/glasses.dmi'
	icon_state = "gloopshades"
	worn_icon = 'modular_septic/icons/mob/clothing/eyes.dmi'
	worn_icon_state = "gloopshades"
	lefthand_file = 'modular_septic/icons/mob/inhands/clothing/clothing_lefthand.dmi'
	righthand_file = 'modular_septic/icons/mob/inhands/clothing/clothing_righthand.dmi'
	inhand_icon_state = "gloopshades"


code:
/obj/item/clothing/gloves
	carry_weight = 0.5


code:
/obj/item/clothing/gloves/combat/zoomtech
	name = "ZoomTech combat gloves"
	desc = "Treated leather gloves, to protect your itty bitty royal fingers."
	icon = 'modular_septic/icons/obj/clothing/gloves.dmi'
	icon_state = "zcap_gloves"
	worn_icon = 'modular_septic/icons/mob/clothing/hands.dmi'
	worn_icon_state = "zcap_gloves"


code:
/obj/item/clothing/gloves/color/black
	icon = 'modular_septic/icons/obj/clothing/gloves.dmi'
	icon_state = "black"
	worn_icon = 'modular_septic/icons/mob/clothing/hands.dmi'
	worn_icon_state = "black"

/obj/item/clothing/gloves/combat
	icon = 'modular_septic/icons/obj/clothing/gloves.dmi'
	icon_state = "combat"
	worn_icon = 'modular_septic/icons/mob/clothing/hands.dmi'
	worn_icon_state = "combat"


code:
/obj/item/clothing/gloves/color/yellow
	icon = 'modular_septic/icons/obj/clothing/gloves.dmi'
	icon_state = "insulated"
	worn_icon = 'modular_septic/icons/mob/clothing/hands.dmi'
	worn_icon_state = "insulated"
	inhand_icon_state = "black"
	desc = "These gloves provide insulation against electric shock. Thick, but don't prevent you from doing anything."
	clothing_traits = null

/obj/item/clothing/gloves/color/chief_engineer
	icon = 'modular_septic/icons/obj/clothing/gloves.dmi'
	icon_state = "insulated"
	worn_icon = 'modular_septic/icons/mob/clothing/hands.dmi'
	worn_icon_state = "insulated"
	inhand_icon_state = "black"
	desc = "These gloves provide excellent heat and electric insulation. They don't look much different from normal insuls..."


code:
/obj/item/clothing/gloves/color/latex
	germ_level = GERM_LEVEL_STERILE

/obj/item/clothing/gloves/color/latex/nitrile
	germ_level = GERM_LEVEL_STERILE


code:
/obj/item/clothing/head
	worn_icon_muzzled = 'modular_septic/icons/mob/clothing/head_muzzled.dmi'
	mutant_variants = STYLE_MUZZLE
	carry_weight = 1


code:
/obj/item/clothing/head/caphat/zoomtech
	name = "\proper doge's hat"
	desc = "An armored hat fit for those who sail sinking boats."
	icon = 'modular_septic/icons/obj/clothing/hats.dmi'
	icon_state = "zcap_hat"
	worn_icon = 'modular_septic/icons/mob/clothing/head.dmi'
	worn_icon_state = "zcap_hat"
	lefthand_file = 'modular_septic/icons/mob/inhands/clothing/clothing_lefthand.dmi'
	righthand_file = 'modular_septic/icons/mob/inhands/clothing/clothing_righthand.dmi'
	inhand_icon_state = "zcap_hat"
	mutant_variants = NONE


code:
/obj/item/clothing/head/hardhat
	icon = 'modular_septic/icons/obj/clothing/hats.dmi'
	icon_state = "hardhat0_yellow"
	worn_icon = 'modular_septic/icons/mob/clothing/head.dmi'
	worn_icon_state = "hardhat0_yellow"
	carry_weight = 0.5


code:
/obj/item/clothing/head/helmet
	desc = "A type 1 armored helmet. Moderate protection against most types of damage. Does not cover the face."
	icon = 'modular_septic/icons/obj/clothing/hats.dmi'
	icon_state = "helmet"
	worn_icon = 'modular_septic/icons/mob/clothing/head.dmi'
	worn_icon_state = "helmet"
	mutant_variants = NONE
	carry_weight = 2.5


code:
/obj/item/clothing/head/hooded/medical
	name = "practitioner hood"
	desc = "Sterile hood often worn by the humorists of Nevado."
	icon = 'modular_septic/icons/obj/clothing/hats.dmi'
	icon_state = "medical_hood"
	worn_icon = 'modular_septic/icons/mob/clothing/head.dmi'
	worn_icon_state = "medical_hood"
	armor = list(MELEE = 0, BULLET = 0, LASER = 0, ENERGY = 0, BOMB = 0, BIO = 50, RAD = 0, FIRE = 50, ACID = 50)
	body_parts_covered = HEAD
	cold_protection = HEAD
	heat_protection = HEAD
	flags_inv = HIDEHAIR
	mutant_variants = NONE

/obj/item/clothing/head/hooded/medical/cmo
	name = "hippocrite's hood"
	desc = "Hood worn by a true hypocrite."


code:
/obj/item/clothing/head/helmet/ordinator
	name = "conical steel helmet"
	desc = "A conical hat worn by the greatest dunces."
	icon = 'modular_septic/icons/obj/clothing/hats.dmi'
	icon_state = "ordinator_hat"
	worn_icon = 'modular_septic/icons/mob/clothing/head.dmi'
	worn_icon_state = "ordinator_hat"
	lefthand_file = 'modular_septic/icons/mob/inhands/clothing/clothing_lefthand.dmi'
	righthand_file = 'modular_septic/icons/mob/inhands/clothing/clothing_righthand.dmi'
	inhand_icon_state = "ordinator_hat"
	mutant_variants = NONE
	carry_weight = 2.5


code:
/obj/item/clothing/mask
	worn_icon_muzzled = 'modular_septic/icons/mob/clothing/mask_muzzled.dmi'
	mutant_variants = STYLE_MUZZLE
	carry_weight = 0.25


code:
/obj/item/clothing/mask/gas/ordinator
	name = "\proper ordinator's iron mask"
	desc = "Standard issue ordinator iron mask. Lightly armored, but very intimidating."
	icon = 'modular_septic/icons/obj/clothing/masks.dmi'
	icon_state = "ordinator_mask"
	worn_icon = 'modular_septic/icons/mob/clothing/mask.dmi'
	worn_icon_state = "ordinator_mask"
	lefthand_file = 'modular_septic/icons/mob/inhands/clothing/clothing_lefthand.dmi'
	righthand_file = 'modular_septic/icons/mob/inhands/clothing/clothing_righthand.dmi'
	inhand_icon_state = "ordinator_mask"
	body_parts_covered = FACE
	clothing_flags = BLOCK_GAS_SMOKE_EFFECT | MASKINTERNALS
	flags_inv = HIDEFACIALHAIR | HIDEFACE | HIDESNOUT
	visor_flags = BLOCK_GAS_SMOKE_EFFECT | MASKINTERNALS
	visor_flags_inv = HIDEFACIALHAIR | HIDEFACE | HIDESNOUT
	flags_cover = MASKCOVERSMOUTH | MASKCOVERSEYES | PEPPERPROOF
	visor_flags_cover = MASKCOVERSMOUTH | MASKCOVERSEYES | PEPPERPROOF
	mutant_variants = NONE
	armor = list(MELEE = 10, BULLET = 0, LASER = 0, ENERGY = 0, BOMB = 0, BIO = 0, RAD = 0, FIRE = 50, ACID = 50, WOUND = 0)
	custom_materials = list(/datum/material/iron = 150, /datum/material/plastic = 250)
	w_class = WEIGHT_CLASS_SMALL
	carry_weight = 1

/obj/item/clothing/mask/gas/ordinator/coordinator
	name = "\proper coordinator's golden mask"
	desc = "An armored golden mask worn by the second greatest clown in town. Smells of bananas."
	icon = 'modular_septic/icons/obj/clothing/masks.dmi'
	icon_state = "coordinator_mask"
	worn_icon = 'modular_septic/icons/mob/clothing/mask.dmi'
	worn_icon_state = "coordinator_mask"
	lefthand_file = 'modular_septic/icons/mob/inhands/clothing/clothing_lefthand.dmi'
	righthand_file = 'modular_septic/icons/mob/inhands/clothing/clothing_righthand.dmi'
	inhand_icon_state = "coordinator_mask"
	custom_materials = list(/datum/material/gold = 100, /datum/material/iron = 150, /datum/material/plastic = 250)


code:
/obj/item/clothing/neck/ordinator
	name = "\proper ordinator's cloak"
	desc = "A dark cloak. One could argue that it's style over substance."
	icon = 'modular_septic/icons/obj/clothing/neck.dmi'
	icon_state = "ordinator_cloak"
	worn_icon = 'modular_septic/icons/mob/clothing/neck.dmi'
	worn_icon_state = "ordinator_cloak"
	lefthand_file = 'modular_septic/icons/mob/inhands/clothing/clothing_lefthand.dmi'
	righthand_file = 'modular_septic/icons/mob/inhands/clothing/clothing_righthand.dmi'
	inhand_icon_state = "ordinator_cloak"
	strip_delay = 20
	body_parts_covered = NECK|CHEST|ARMS
	cold_protection = NECK|CHEST|ARMS
	heat_protection = NECK|CHEST|ARMS
	mutant_variants = NONE
	armor = list(MELEE = 0, BULLET = 0, LASER = 0, ENERGY = 10, BOMB = 0, BIO = 0, RAD = 0, FIRE = 25, ACID = 50, WOUND = 0)
	custom_materials = list(/datum/material/iron = 500, /datum/material/plastic = 1000)

/obj/item/clothing/neck/ordinator/coordinator
	name = "\proper coordinator's cloak"
	desc = "A dark cloak with gold trimmings. Truly, attire worthy of a dictator."
	icon = 'modular_septic/icons/obj/clothing/neck.dmi'
	icon_state = "coordinator_cloak"
	worn_icon = 'modular_septic/icons/mob/clothing/neck.dmi'
	worn_icon_state = "coordinator_cloak"
	lefthand_file = 'modular_septic/icons/mob/inhands/clothing/clothing_lefthand.dmi'
	righthand_file = 'modular_septic/icons/mob/inhands/clothing/clothing_righthand.dmi'
	inhand_icon_state = "coordinator_cloak"
	strip_delay = 25
	armor = list(MELEE = 0, BULLET = 0, LASER = 0, ENERGY = 10, BOMB = 0, BIO = 0, RAD = 0, FIRE = 25, ACID = 50, WOUND = 0)
	custom_materials = list(/datum/material/gold = 500, /datum/material/iron = 500, /datum/material/plastic = 1000)


code:
/datum/outfit/centcom/death_commando
	skillchips = null


code:
/obj/item/clothing/shoes
	worn_icon_digi ='modular_septic/icons/mob/clothing/feet_digi.dmi'
	carry_weight = 0.25


code:
/obj/item/clothing/shoes/jackboots
	icon = 'modular_septic/icons/obj/clothing/shoes.dmi'
	icon_state = "jackboots"
	worn_icon = 'modular_septic/icons/mob/clothing/feet.dmi'
	worn_icon_state = "jackboots"
	lefthand_file = 'modular_septic/icons/mob/inhands/clothing/clothing_lefthand.dmi'
	righthand_file = 'modular_septic/icons/mob/inhands/clothing/clothing_righthand.dmi'
	inhand_icon_state = "jackboots"
	carry_weight = 0.5

/obj/item/clothing/shoes/workboots
	icon = 'modular_septic/icons/obj/clothing/shoes.dmi'
	icon_state = "workboots"
	worn_icon = 'modular_septic/icons/mob/clothing/feet.dmi'
	worn_icon_state = "workboots"
	lefthand_file = 'modular_septic/icons/mob/inhands/clothing/clothing_lefthand.dmi'
	righthand_file = 'modular_septic/icons/mob/inhands/clothing/clothing_righthand.dmi'
	inhand_icon_state = "jackboots"
	carry_weight = 0.5


code:
//Hardsuits assumedly have hydraulics, and thus weigh less than spacesuits
/obj/item/clothing/head/helmet/space/hardsuit
	carry_weight = 5

/obj/item/clothing/suit/space/hardsuit
	carry_weight = 15


code:
// IRL space suits weigh SO MUCH you would not believe, i am going to be kind
/obj/item/clothing/head/helmet/space
	carry_weight = 5

/obj/item/clothing/suit/space
	carry_weight = 20


code:
/obj/item/clothing/suit
	worn_icon_digi ='modular_septic/icons/mob/clothing/suit_digi.dmi'
	var/list/suit_tail_colors


code:
/obj/item/clothing/suit/armor
	body_parts_covered = CHEST|GROIN

/obj/item/clothing/suit/armor/vest
	name = "slim type 1 armor vest"
	desc = "A slim version of the type I armored vest that provides decent protection against most types of damage."
	icon = 'modular_septic/icons/obj/clothing/suits.dmi'
	icon_state = "armorvest_slim"
	worn_icon = 'modular_septic/icons/mob/clothing/suit.dmi'
	worn_icon_state = "armorvest_slim"
	//A decent kevlar vest weighs almost 3kg
	carry_weight = 3
	//But does not cover the groin
	body_parts_covered = CHEST

/obj/item/clothing/suit/armor/vest/alt
	name = "type 1 armor vest"
	desc = "A type I armored vest that provides decent protection against most types of damage."
	icon = 'modular_septic/icons/obj/clothing/suits.dmi'
	icon_state = "armorvest"
	worn_icon = 'modular_septic/icons/mob/clothing/suit.dmi'
	worn_icon_state = "armorvest"
	//Bulkier vest
	carry_weight = 6
	body_parts_covered = CHEST|GROIN


code:
/obj/item/clothing/suit/armor/vest/capcarapace/zoomtech
	name = "ZoomTech armored leather coat"
	desc = "An armored, 100% genuine manbeast leather coat."
	icon = 'modular_septic/icons/obj/clothing/suits.dmi'
	icon_state = "zcap_coat"
	worn_icon = 'modular_septic/icons/mob/clothing/suit.dmi'
	worn_icon_state = "zcap_coat"
	lefthand_file = 'modular_septic/icons/mob/inhands/clothing/clothing_lefthand.dmi'
	righthand_file = 'modular_septic/icons/mob/inhands/clothing/clothing_righthand.dmi'
	inhand_icon_state = "zcap_coat"
	blood_overlay_type = "coat"
	body_parts_covered = NECK|CHEST|GROIN|ARMS
	cold_protection = NECK|CHEST|GROIN|ARMS
	heat_protection = NECK|CHEST|GROIN|ARMS
	mutant_variants = NONE


code:
/obj/item/clothing/suit/postal
	name = "black trenchcoat"
	desc = "Sign the petition, damn it."
	icon = 'modular_septic/icons/obj/clothing/suits.dmi'
	icon_state = "dude_jacket"
	worn_icon = 'modular_septic/icons/mob/clothing/suit.dmi'
	worn_icon_state = "dude_jacket"
	blood_overlay_type = "coat"
	body_parts_covered = NECK|CHEST|GROIN|LEGS|ARMS
	cold_protection = NECK|CHEST|GROIN|LEGS|ARMS
	heat_protection = NECK|CHEST|GROIN|LEGS|ARMS
	mutant_variants = NONE


code:
/obj/item/clothing/suit/hooded/medical
	name = "practitioner robes"
	desc = "Sterile robes often worn by the humorists of Nevado."
	icon = 'modular_septic/icons/obj/clothing/suits.dmi'
	icon_state = "medical_robes"
	worn_icon = 'modular_septic/icons/mob/clothing/suit.dmi'
	worn_icon_state = "medical_robes"
	allowed = list(
		/obj/item/analyzer,
		/obj/item/biopsy_tool,
		/obj/item/dnainjector,
		/obj/item/flashlight/pen,
		/obj/item/healthanalyzer,
		/obj/item/paper,
		/obj/item/reagent_containers/dropper,
		/obj/item/reagent_containers/glass/beaker,
		/obj/item/reagent_containers/glass/bottle,
		/obj/item/reagent_containers/hypospray,
		/obj/item/reagent_containers/pill,
		/obj/item/reagent_containers/syringe,
		/obj/item/sensor_device,
		/obj/item/soap,
		/obj/item/stack/medical,
		/obj/item/storage/pill_bottle,
		/obj/item/tank/internals/emergency_oxygen,
		/obj/item/tank/internals/plasmaman,
		/obj/item/melee/baton/telescopic,
		)
	body_parts_covered = NECK|CHEST|GROIN|ARMS|LEGS
	cold_protection = NECK|CHEST|GROIN|ARMS|LEGS
	heat_protection = NECK|CHEST|GROIN|ARMS|LEGS
	mutant_variants = NONE
	armor = list(MELEE = 0, BULLET = 0, LASER = 0, ENERGY = 0, BOMB = 0, BIO = 50, RAD = 0, FIRE = 50, ACID = 50)
	hoodtype = /obj/item/clothing/head/hooded/medical
	species_exception = list(/datum/species/golem)

/obj/item/clothing/suit/hooded/medical/cmo
	name = "hippocrite's robes"
	desc = "Robes worn by a true hypocrite."
	hoodtype = /obj/item/clothing/head/hooded/medical/cmo