code:
/datum/sprite_accessory/snouts
	key = "snout"
	generic = "Snout"
	icon = 'modular_septic/icons/mob/human/sprite_accessory/lizard_snouts.dmi'
	recommended_species = list(SPECIES_SYNTHMAMMAL, SPECIES_MAMMAL, SPECIES_WEREWOLF, SPECIES_WERECAT, SPECIES_LIZARD, SPECIES_LIZARD_ASH, SPECIES_LIZARD_SILVER)
	relevant_layers = list(BODY_ADJ_LAYER, BODY_FRONT_LAYER)
	body_zone = BODY_ZONE_PRECISE_MOUTH
	genetic = TRUE
	organ_type = /obj/item/organ/external/snout
	var/use_muzzled_sprites = TRUE

/datum/sprite_accessory/snouts/is_hidden(mob/living/carbon/human/H, obj/item/bodypart/BP)
	. = ..()
	if(body_zone && !BP?.advanced_rendering)
		return TRUE
	if((H.wear_mask && (H.wear_mask.flags_inv & HIDEFACE)) || (H.head && (H.head.flags_inv & HIDEFACE)))
		return TRUE

/datum/sprite_accessory/snouts/none
	name = "None"
	icon_state = "none"
	use_muzzled_sprites = FALSE
	factual = FALSE

/datum/sprite_accessory/snouts/mammal
	icon = 'modular_septic/icons/mob/human/sprite_accessory/snouts.dmi'
	color_src = USE_MATRIXED_COLORS
	recommended_species = list(SPECIES_SYNTHMAMMAL, SPECIES_HUMANOID)

/datum/sprite_accessory/snouts/mammal/werewolf
	recommended_species = list(SPECIES_SYNTHMAMMAL, SPECIES_WEREWOLF, SPECIES_HUMANOID)

/datum/sprite_accessory/snouts/mammal/werecat
	recommended_species = list(SPECIES_SYNTHMAMMAL, SPECIES_WERECAT, SPECIES_HUMANOID)

/datum/sprite_accessory/snouts/mammal/akula
	recommended_species = list(SPECIES_SYNTHMAMMAL, SPECIES_AQUATIC, SPECIES_HUMANOID)

/datum/sprite_accessory/snouts/mammal/bird
	name = "Beak"
	icon_state = "bird"

/datum/sprite_accessory/snouts/mammal/bigbeak
	name = "Big Beak"
	icon_state = "bigbeak"

/datum/sprite_accessory/snouts/mammal/bug
	name = "Bug"
	icon_state = "bug"
	color_src = USE_ONE_COLOR
	extra2 = TRUE
	extra2_color_src = MUTCOLORS3

/datum/sprite_accessory/snouts/mammal/elephant
	name = "Elephant"
	icon_state = "elephant"
	extra = TRUE
	extra_color_src = MUTCOLORS3

/datum/sprite_accessory/snouts/mammal/husky
	name = "Husky"
	icon_state = "husky"

/datum/sprite_accessory/snouts/mammal/rhino
	name = "Rhino Horn"
	icon_state = "rhino"
	extra = TRUE
	extra = MUTCOLORS3

/datum/sprite_accessory/snouts/mammal/rodent
	name = "Rodent"
	icon_state = "rodent"

/datum/sprite_accessory/snouts/mammal/werewolf/lcanid
	name = "Mammal, Long"
	icon_state = "lcanid"

/datum/sprite_accessory/snouts/mammal/lcanidalt
	name = "Mammal, Long ALT"
	icon_state = "lcanidalt"

/datum/sprite_accessory/snouts/mammal/werewolf/lcanidstriped
	name = "Mammal, Long, Striped"
	icon_state = "lcanidstripe"

/datum/sprite_accessory/snouts/mammal/lcanidstripedalt
	name = "Mammal, Long, Striped ALT"
	icon_state = "lcanidstripealt"

/datum/sprite_accessory/snouts/mammal/werecat/scanid
	name = "Mammal, Short"
	icon_state = "scanid"

/datum/sprite_accessory/snouts/mammal/werecat/scanidalt
	name = "Mammal, Short ALT"
	icon_state = "scanidalt"

/datum/sprite_accessory/snouts/mammal/werecat/scanidalt2
	name = "Mammal, Short ALT 2"
	icon_state = "scanidalt2"

/datum/sprite_accessory/snouts/mammal/werecat/scanidalt3
	name = "Mammal, Short ALT 3"
	icon_state = "scanidalt3"

/datum/sprite_accessory/snouts/mammal/werecat/normal
	name = "Werecat, Normal"
	icon_state = "ntajaran"
	color_src = USE_ONE_COLOR

/datum/sprite_accessory/snouts/mammal/wolf
	name = "Mammal, Thick"
	icon_state = "wolf"

/datum/sprite_accessory/snouts/mammal/wolfalt
	name = "Mammal, Thick ALT"
	icon_state = "wolfalt"

/datum/sprite_accessory/snouts/mammal/otie
	name = "Otie"
	icon_state = "otie"

/datum/sprite_accessory/snouts/mammal/otiesmile
	name = "Otie Smile"
	icon_state = "otiesmile"

/*/datum/sprite_accessory/snouts/mammal/round
	name = "Mammal Round"
	icon_state = "round"
	color_src = USE_ONE_COLOR

/datum/sprite_accessory/snouts/mammal/roundlight
	name = "Mammal Round + Light"
	icon_state = "roundlight"
	color_src = USE_ONE_COLOR*/

/datum/sprite_accessory/snouts/mammal/pede
	name = "Scolipede"
	icon_state = "pede"

/datum/sprite_accessory/snouts/mammal/sergal
	name = "Sergal"
	icon_state = "sergal"

/datum/sprite_accessory/snouts/mammal/akula/shark
	name = "Shark"
	icon_state = "shark"

/datum/sprite_accessory/snouts/mammal/akula/hshark
	name = "hShark"
	icon_state = "hshark"

/datum/sprite_accessory/snouts/mammal/akula/hshark_eyes
	name = "hShark and eyes"
	icon_state = "hshark_eyes"

/*/datum/sprite_accessory/snouts/mammal/sharp
	name = "Mammal Sharp"
	icon_state = "sharp"
	color_src = USE_ONE_COLOR

/datum/sprite_accessory/snouts/mammal/sharplight
	name = "Mammal Sharp + Light"
	icon_state = "sharplight"
	color_src = USE_ONE_COLOR*/

/datum/sprite_accessory/snouts/mammal/toucan
	name = "Toucan"
	icon_state = "toucan"

/datum/sprite_accessory/snouts/mammal/redpanda
	name = "WahCoon"
	icon_state = "wah"

/datum/sprite_accessory/snouts/mammal/redpandaalt
	name = "WahCoon ALT"
	icon_state = "wahalt"

/******************************************
**************** Snouts *******************
*************but higher up*****************/

/datum/sprite_accessory/snouts/mammal/fbird
	name = "Beak (Top)"
	icon_state = "fbird"

/datum/sprite_accessory/snouts/mammal/fbigbeak
	name = "Big Beak (Top)"
	icon_state = "fbigbeak"

/datum/sprite_accessory/snouts/mammal/fbug
	name = "Bug (Top)"
	icon_state = "fbug"
	color_src = USE_ONE_COLOR
	extra2 = TRUE
	extra2_color_src = MUTCOLORS3

/datum/sprite_accessory/snouts/mammal/felephant
	name = "Elephant (Top)"
	icon_state = "felephant"
	extra = TRUE
	extra_color_src = MUTCOLORS3

/datum/sprite_accessory/snouts/mammal/frhino
	name = "Horn (Top)"
	icon_state = "frhino"
	extra = TRUE
	extra = MUTCOLORS3

/datum/sprite_accessory/snouts/mammal/fhusky
	name = "Husky (Top)"
	icon_state = "fhusky"

/datum/sprite_accessory/snouts/mammal/werewolf/flcanid
	name = "Mammal, Long (Top)"
	icon_state = "flcanid"

/datum/sprite_accessory/snouts/mammal/flcanidalt
	name = "Mammal, Long ALT (Top)"
	icon_state = "flcanidalt"

/datum/sprite_accessory/snouts/mammal/werewolf/flcanidstriped
	name = "Mammal, Long, Striped (Top)"
	icon_state = "flcanidstripe"

/datum/sprite_accessory/snouts/mammal/flcanidstripedalt
	name = "Mammal, Long, Striped ALT (Top)"
	icon_state = "flcanidstripealt"

/datum/sprite_accessory/snouts/mammal/werecat/fscanid
	name = "Mammal, Short (Top)"
	icon_state = "fscanid"

/datum/sprite_accessory/snouts/mammal/werecat/fscanidalt
	name = "Mammal, Short ALT (Top)"
	icon_state = "fscanidalt"

/datum/sprite_accessory/snouts/mammal/werecat/fscanidalt2
	name = "Mammal, Short ALT 2 (Top)"
	icon_state = "fscanidalt2"

/datum/sprite_accessory/snouts/mammal/werecat/fscanidalt3
	name = "Mammal, Short ALT 3 (Top)"
	icon_state = "fscanidalt3"

/datum/sprite_accessory/snouts/mammal/fwolf
	name = "Mammal, Thick (Top)"
	icon_state = "fwolf"

/datum/sprite_accessory/snouts/mammal/fwolfalt
	name = "Mammal, Thick ALT (Top)"
	icon_state = "fwolfalt"

/datum/sprite_accessory/snouts/mammal/fotie
	name = "Otie (Top)"
	icon_state = "fotie"

/datum/sprite_accessory/snouts/mammal/fotiesmile
	name = "Otie Smile (Top)"
	icon_state = "fotiesmile"

/datum/sprite_accessory/snouts/mammal/frodent
	name = "Rodent (Top)"
	icon_state = "frodent"

/*/datum/sprite_accessory/snouts/mammal/fround
	name = "Mammal Round (Top)"
	icon_state = "fround"
	color_src = USE_ONE_COLOR

/datum/sprite_accessory/snouts/mammal/froundlight
	name = "Mammal Round + Light (Top)"
	icon_state = "froundlight"
	color_src = USE_ONE_COLOR*/

/datum/sprite_accessory/snouts/mammal/fpede
	name = "Scolipede (Top)"
	icon_state = "fpede"

/datum/sprite_accessory/snouts/mammal/fsergal
	name = "Sergal (Top)"
	icon_state = "fsergal"

/datum/sprite_accessory/snouts/mammal/fshark
	name = "Shark (Top)"
	icon_state = "fshark"

/*/datum/sprite_accessory/snouts/mammal/fsharp
	name = "Mammal Sharp (Top)"
	icon_state = "fsharp"
	color_src = USE_ONE_COLOR

/datum/sprite_accessory/snouts/mammal/fsharplight
	name = "Mammal Sharp + Light (Top)"
	icon_state = "fsharplight"
	color_src = USE_ONE_COLOR*/

/datum/sprite_accessory/snouts/mammal/ftoucan
	name = "Toucan (Top)"
	icon_state = "ftoucan"

/datum/sprite_accessory/snouts/mammal/fredpanda
	name = "WahCoon (Top)"
	icon_state = "fwah"

/datum/sprite_accessory/snouts/mammal/skulldog
	name = "Skulldog"
	icon_state = "skulldog"
	extra = TRUE
	//extra_color_src = MATRIXED

/datum/sprite_accessory/snouts/mammal/hanubus
	name = "Anubus"
	icon_state = "hanubus"

/datum/sprite_accessory/snouts/mammal/hpanda
	name = "Panda"
	icon_state = "hpanda"

/datum/sprite_accessory/snouts/mammal/hjackal
	name = "Jackal"
	icon_state = "hjackal"

/datum/sprite_accessory/snouts/mammal/hspots
	name = "Hyena"
	icon_state = "hspots"

/datum/sprite_accessory/snouts/mammal/hhorse
	name = "Horse"
	icon_state = "hhorse"

/datum/sprite_accessory/snouts/mammal/hzebra
	name = "Zebra"
	icon_state = "hzebra"

/datum/sprite_accessory/snouts/mammal/sbeak
	name = "Corvid Beak"
	icon_state = "corvid"
	color_src = USE_ONE_COLOR

/datum/sprite_accessory/snouts/mammal/akula/shark_light
	name = "Shark Light"
	icon_state = "sharkblubber"
	color_src = USE_MATRIXED_COLORS

/datum/sprite_accessory/snouts/mammal/rat
	name = "Rat"
	icon_state = "rat"
	color_src = USE_MATRIXED_COLORS

/datum/sprite_accessory/snouts/mammal/stubby
	name = "Stubby"
	icon_state = "stubby"
	color_src = USE_MATRIXED_COLORS
	use_muzzled_sprites = FALSE


code:
/datum/sprite_accessory/moth_markings
	key = "moth_markings"
	generic = "Moth markings"

/datum/sprite_accessory/moth_antennae/none
	name = "None"
	icon_state = "none"

/datum/sprite_accessory/spines
	key = "spines"
	generic = "Spines"
	icon = 'modular_septic/icons/mob/human/sprite_accessory/mutant_bodyparts.dmi'
	special_render_case = TRUE
	default_color = DEFAULT_SECONDARY
	recommended_species = list(SPECIES_LIZARD, SPECIES_LIZARD_ASH, SPECIES_LIZARD_SILVER)
	relevant_layers = list(BODY_BEHIND_LAYER, BODY_ADJ_LAYER)
	body_zone = BODY_ZONE_PRECISE_GROIN
	genetic = TRUE

/datum/sprite_accessory/spines/is_hidden(mob/living/carbon/human/H, obj/item/bodypart/BP)
	. = ..()
	if(body_zone && !BP?.advanced_rendering)
		return TRUE
	var/list/tails = H.getorganslotlist(ORGAN_SLOT_TAIL)
	if(!length(tails) || (H.wear_suit && (HAS_TRAIT(H, TRAIT_HIDING_MUTANTPARTS) || (H.wear_suit.flags_inv & HIDEJUMPSUIT))))
		return TRUE

/datum/sprite_accessory/spines/get_special_render_state(mob/living/carbon/human/H)
	var/list/tails = H.getorganslotlist(ORGAN_SLOT_TAIL)
	for(var/thing in tails)
		var/obj/item/organ/tail/tail = thing
		if(tail.wagging)
			return "[icon_state]_wagging"
	return icon_state

/datum/sprite_accessory/caps
	key = "caps"
	generic = "Caps"

/datum/sprite_accessory/body_markings
	key = "body_markings"
	generic = "Body Markings"
	default_color = DEFAULT_TERTIARY

/datum/sprite_accessory/legs
	key = "legs"
	generic = "Leg Type"
	color_src = null
	genetic = TRUE

/datum/sprite_accessory/legs/digitigrade_lizard
	name = null

/datum/sprite_accessory/socks
	icon = 'modular_septic/icons/mob/clothing/underwear.dmi'
	use_static = TRUE

/datum/sprite_accessory/socks/socks_knee
	name = "Knee-high"
	icon_state = "socks_knee"
	use_static = null

/datum/sprite_accessory/socks/striped_knee
	name = "Knee-high - Striped"
	icon_state = "striped_knee"
	use_static = null

/datum/sprite_accessory/socks/thin_knee
	name = "Knee-high - Thin"
	icon_state = "thin_knee"
	use_static = null

/datum/sprite_accessory/socks/socks_norm
	name = "Normal"
	icon_state = "socks_norm"
	use_static = null

/datum/sprite_accessory/socks/socks_short
	name = "Short"
	icon_state = "socks_short"
	use_static = null

/datum/sprite_accessory/socks/socks_thigh
	name = "Thigh-high"
	icon_state = "socks_thigh"
	use_static = null

/datum/sprite_accessory/socks/bee_thigh
	name = "Thigh-high - Bee (Old)"
	icon_state = "bee_thigh_old"

/datum/sprite_accessory/socks/bee_knee
	name = "Knee-high - Bee (Old)"
	icon_state = "bee_knee_old"

/datum/sprite_accessory/underwear/socks/christmas_norm
	name = "Normal - Christmas"
	icon_state = "christmas_norm"

/datum/sprite_accessory/underwear/socks/candycaner_norm
	name = "Normal - Red Candy Cane"
	icon_state = "candycaner_norm"

/datum/sprite_accessory/underwear/socks/candycaneg_norm
	name = "Normal - Green Candy Cane"
	icon_state = "candycaneg_norm"

/datum/sprite_accessory/socks/christmas_knee
	name = "Knee-High - Christmas"
	icon_state = "christmas_knee"

/datum/sprite_accessory/socks/candycaner_knee
	name = "Knee-High - Red Candy Cane"
	icon_state = "candycaner_knee"

/datum/sprite_accessory/socks/candycaneg_knee
	name = "Knee-High - Green Candy Cane"
	icon_state = "candycaneg_knee"

/datum/sprite_accessory/socks/christmas_thigh
	name = "Thigh-high - Christmas"
	icon_state = "christmas_thigh"

/datum/sprite_accessory/socks/candycaner_thigh
	name = "Thigh-high - Red Candy Cane"
	icon_state = "candycaner_thigh"

/datum/sprite_accessory/socks/candycaneg_thigh
	name = "Thigh-high - Green Candy Cane"
	icon_state = "candycaneg_thigh"

/datum/sprite_accessory/socks/rainbow_knee
	name = "Knee-high - Rainbow"
	icon_state = "rainbow_knee"

/datum/sprite_accessory/socks/rainbow_thigh
	name = "Thigh-high - Rainbow"
	icon_state = "rainbow_thigh"

/datum/sprite_accessory/socks/fishnet_thigh
	name = "Thigh-high - Fishnet"
	icon_state = "fishnet"

/datum/sprite_accessory/socks/fishnet_thigh
	name = "Pantyhose - Ripped"
	icon_state = "pantyhose_ripped"
	use_static = null

/datum/sprite_accessory/underwear
	icon = 'modular_septic/icons/mob/clothing/underwear.dmi'
	///Whether the underwear uses a special sprite for digitigrade style (i.e. briefs, not panties). Adds a "_d" suffix to the icon state
	var/has_digitigrade = FALSE

/datum/sprite_accessory/underwear/male_bee
	name = "Boxers - Bee"
	icon_state = "bee_shorts"
	has_digitigrade = TRUE
	gender = MALE
	use_static = TRUE

/datum/sprite_accessory/underwear/female_beekini
	name = "Panties - Bee-kini"
	icon_state = "panties_bee-kini"
	gender = FEMALE
	use_static = TRUE

/datum/sprite_accessory/underwear/panties
	name = "Panties"
	icon_state = "panties"
	gender = FEMALE

/datum/sprite_accessory/underwear/panties_alt
	name = "Panties - Alt"
	icon_state = "panties_alt"
	gender = FEMALE

/datum/sprite_accessory/underwear/fishnet_lower
	name = "Panties - Fishnet"
	icon_state = "fishnet_lower"
	gender = FEMALE
	use_static = TRUE

/datum/sprite_accessory/underwear/female_beekini
	name = "Panties - Bee-kini"
	icon_state = "panties_bee-kini"
	gender = FEMALE
	use_static = TRUE

/datum/sprite_accessory/underwear/female_commie
	name = "Panties - Commie"
	icon_state = "panties_commie"
	gender = FEMALE
	use_static = TRUE

/datum/sprite_accessory/underwear/female_usastripe
	name = "Panties - Freedom"
	icon_state = "panties_assblastusa"
	gender = FEMALE
	use_static = TRUE

/datum/sprite_accessory/underwear/female_kinky
	name = "Panties - Kinky Black"
	icon_state = "panties_kinky"
	gender = FEMALE
	use_static = TRUE

/datum/sprite_accessory/underwear/panties_uk
	name = "Panties - UK"
	icon_state = "panties_uk"
	gender = FEMALE
	use_static = TRUE

/datum/sprite_accessory/underwear/panties_neko
	name = "Panties - Neko"
	icon_state = "panties_neko"
	gender = FEMALE

/datum/sprite_accessory/underwear/panties_slim
	name = "Panties - Slim"
	icon_state = "panties_slim"
	gender = FEMALE

/datum/sprite_accessory/underwear/striped_panties
	name = "Panties - Striped"
	icon_state = "striped_panties"
	gender = FEMALE

/datum/sprite_accessory/underwear/panties_swimsuit
	name = "Panties - Swimsuit"
	icon_state = "panties_swimming"
	gender = FEMALE

/datum/sprite_accessory/underwear/panties_thin
	name = "Panties - Thin"
	icon_state = "panties_thin"
	gender = FEMALE

/datum/sprite_accessory/underwear/longjon
	name = "Long John Bottoms"
	icon_state = "ljonb"
	has_digitigrade = TRUE

/datum/sprite_accessory/underwear/swimsuit_red
	name = "Swimsuit, One Piece - Red"
	icon_state = "swimming_red"
	gender = FEMALE
	use_static = TRUE

/datum/sprite_accessory/underwear/swimsuit
	name = "Swimsuit, One Piece - Black"
	icon_state = "swimming_black"
	gender = FEMALE
	use_static = TRUE

/datum/sprite_accessory/underwear/swimsuit_blue
	name = "Swimsuit, One Piece - Striped Blue"
	icon_state = "swimming_blue"
	gender = FEMALE
	use_static = TRUE

/datum/sprite_accessory/underwear/thong
	name = "Thong"
	icon_state = "thong"
	gender = FEMALE
	use_static = TRUE

/datum/sprite_accessory/underwear/thong_babydoll
	name = "Thong - Alt"
	icon_state = "thong_babydoll"
	gender = FEMALE

/datum/sprite_accessory/underwear/chastbelt
	name = "Chastity Belt"
	icon_state = "chastbelt"
	use_static = TRUE

/datum/sprite_accessory/underwear/chastcage
	name = "Chastity Cage"
	icon_state = "chastcage"
	use_static = null

/datum/sprite_accessory/underwear/male_briefs
	has_digitigrade = TRUE

/datum/sprite_accessory/underwear/male_boxers
	has_digitigrade = TRUE

/datum/sprite_accessory/underwear/male_stripe
	has_digitigrade = TRUE

/datum/sprite_accessory/underwear/male_midway
	has_digitigrade = TRUE

/datum/sprite_accessory/underwear/male_longjohns
	has_digitigrade = TRUE

/datum/sprite_accessory/underwear/male_hearts
	has_digitigrade = TRUE

/datum/sprite_accessory/underwear/male_commie
	has_digitigrade = TRUE

/datum/sprite_accessory/underwear/male_usastripe
	has_digitigrade = TRUE

/datum/sprite_accessory/underwear/male_uk
	has_digitigrade = TRUE

/datum/sprite_accessory/undershirt
	icon = 'modular_septic/icons/mob/clothing/underwear.dmi'
	use_static = TRUE

/datum/sprite_accessory/undershirt/tanktop_alt
	name = "Tank Top - Alt"
	icon_state = "tanktop_alt"
	use_static = null

/datum/sprite_accessory/undershirt/tanktop_midriff
	name = "Tank Top - Midriff"
	icon_state = "tank_midriff"
	gender = FEMALE
	use_static = null

/datum/sprite_accessory/undershirt/tanktop_midriff_alt
	name = "Tank Top - Midriff Halterneck"
	icon_state = "tank_midriff_alt"
	gender = FEMALE
	use_static = null

/datum/sprite_accessory/undershirt/tankstripe
	name = "Tank Top - Striped"
	icon_state = "tank_stripes"
	use_static = TRUE

/datum/sprite_accessory/undershirt/tank_top_sun
	name = "Tank top - Sun"
	icon_state = "tank_sun"
	use_static = TRUE

/datum/sprite_accessory/undershirt/babydoll
	name = "Baby-Doll"
	icon_state = "babydoll"
	gender = FEMALE
	use_static = null

/datum/sprite_accessory/undershirt/bra
	name = "Bra"
	icon_state = "bra"
	gender = FEMALE
	use_static = null

/datum/sprite_accessory/undershirt/bra_alt
	name = "Bra - Alt"
	icon_state = "bra_alt"
	gender = FEMALE
	use_static = null

/datum/sprite_accessory/undershirt/bra_thin
	name = "Bra - Thin"
	icon_state = "bra_thin"
	gender = FEMALE
	use_static = null

/datum/sprite_accessory/undershirt/bra_kinky
	name = "Bra - Kinky Black"
	icon_state = "bra_kinky"
	gender = FEMALE
	use_static = TRUE

/datum/sprite_accessory/undershirt/bra_freedom
	name = "Bra - Freedom"
	icon_state = "bra_assblastusa"
	gender = FEMALE
	use_static = TRUE

/datum/sprite_accessory/undershirt/bra_commie
	name = "Bra - Commie"
	icon_state = "bra_commie"
	gender = FEMALE
	use_static = TRUE

/datum/sprite_accessory/undershirt/bra_beekini
	name = "Bra - Bee-kini"
	icon_state = "bra_bee-kini"
	gender = FEMALE
	use_static = TRUE

/datum/sprite_accessory/undershirt/bra_uk
	name = "Bra - UK"
	icon_state = "bra_uk"
	gender = FEMALE
	use_static = TRUE

/datum/sprite_accessory/undershirt/bra_neko
	name = "Bra - Neko"
	icon_state = "bra_neko"
	gender = FEMALE
	use_static = null

/datum/sprite_accessory/undershirt/halterneck_bra
	name = "Bra - Halterneck"
	icon_state = "halterneck_bra"
	gender = FEMALE
	use_static = null

/datum/sprite_accessory/undershirt/sports_bra
	name = "Bra, Sports"
	icon_state = "sports_bra"
	gender = FEMALE
	use_static = null

/datum/sprite_accessory/undershirt/sports_bra_alt
	name = "Bra, Sports - Alt"
	icon_state = "sports_bra_alt"
	gender = FEMALE
	use_static = null

/datum/sprite_accessory/undershirt/bra_strapless
	name = "Bra, Strapless"
	icon_state = "bra_strapless"
	gender = FEMALE
	use_static = null

/datum/sprite_accessory/undershirt/bra_strapless_alt
	name = "Bra, Strapless - Alt"
	icon_state = "bra_blue"
	gender = FEMALE
	use_static = null

/datum/sprite_accessory/undershirt/striped_bra
	name = "Bra - Striped"
	icon_state = "striped_bra"
	gender = FEMALE
	use_static = null

/datum/sprite_accessory/undershirt/fishnet_sleeves
	name = "Fishnet - sleeves"
	icon_state = "fishnet_sleeves"
	gender = FEMALE
	use_static = TRUE

/datum/sprite_accessory/undershirt/fishnet_gloves
	name = "Fishnet - gloves"
	icon_state = "fishnet_gloves"
	gender = FEMALE
	use_static = TRUE

/datum/sprite_accessory/undershirt/fishnet_base
	name = "Fishnet - top"
	icon_state = "fishnet_body"
	gender = FEMALE
	use_static = TRUE

/datum/sprite_accessory/undershirt/swimsuit
	name = "Swimsuit Top"
	icon_state = "bra_swimming"
	gender = FEMALE
	use_static = null

/datum/sprite_accessory/undershirt/swimsuit_alt
	name = "Swimsuit Top - Strapless"
	icon_state = "bra_swimming_alt"
	gender = FEMALE
	use_static = null

/datum/sprite_accessory/undershirt/tubetop
	name = "Tube Top"
	icon_state = "tubetop"
	gender = FEMALE
	use_static = null

/datum/sprite_accessory/undershirt/chastbra
	name = "Chastity Bra"
	icon_state = "chastbra"
	gender = FEMALE
	use_static = TRUE

/datum/sprite_accessory/undershirt/pasties
	name = "Pasties"
	icon_state = "pasties"
	gender = FEMALE
	use_static = null

/datum/sprite_accessory/undershirt/pasties_alt
	name = "Pasties - Alt"
	icon_state = "pasties_alt"
	gender = FEMALE
	use_static = null

/datum/sprite_accessory/undershirt/shibari
	name = "Shibari"
	icon_state = "shibari"
	gender = FEMALE
	use_static = null

/datum/sprite_accessory/undershirt/shibari_sleeves
	name = "Shibari Sleeves"
	icon_state = "shibari_sleeves"
	gender = FEMALE
	use_static = null

repo_name: AnalWerewolf/sundown

license: mit


code:
//Synth snouts (This is the most important part)
/datum/sprite_accessory/snouts/synthliz
	recommended_species = list("synthliz")
	icon = 'modular_septic/icons/mob/human/sprite_accessory/synthliz_snouts.dmi'
	color_src = USE_ONE_COLOR
	default_color = null
	recommended_species = list(SPECIES_SYNTHLIZARD)
	name = "Synthetic Lizard - Snout"
	icon_state = "synthliz_basic"
	genetic = FALSE

/datum/sprite_accessory/snouts/synthliz/synthliz_under
	color_src = USE_MATRIXED_COLORS
	name = "Synthetic Lizard - Snout Under"
	icon_state = "synthliz_under"

/datum/sprite_accessory/snouts/synthliz/synthliz_tert
	color_src = USE_MATRIXED_COLORS
	name = "Synthetic Lizard - Snout Tertiary"
	icon_state = "synthliz_tert"

/datum/sprite_accessory/snouts/synthliz/synthliz_tertunder
	color_src = USE_MATRIXED_COLORS
	name = "Synthetic Lizard - Snout Tertiary Under"
	icon_state = "synthliz_tertunder"

/datum/sprite_accessory/snouts/synthliz/synthliz_long
	color_src = USE_ONE_COLOR
	name = "Synthetic Lizard - Snout Long"
	icon_state = "synthliz_long"

/datum/sprite_accessory/snouts/synthliz/synthliz_thicklong
	color_src = USE_ONE_COLOR
	name = "Synthetic Lizard - Snout Long & Thick"
	icon_state = "synthliz_thicklong"

/datum/sprite_accessory/snouts/synthliz/barlessbasic
	color_src = USE_ONE_COLOR
	name = "Synthetic Lizard - Barless"
	icon_state = "synthliz_barless_basic"

/datum/sprite_accessory/snouts/synthliz/barlessunder
	color_src = USE_MATRIXED_COLORS
	name = "Synthetic Lizard - Barless Under"
	icon_state = "synthliz_barless_under"

/datum/sprite_accessory/snouts/synthliz/barlessover
	color_src = USE_MATRIXED_COLORS
	name = "Synthetic Lizard - Barless Over"
	icon_state = "synthliz_barless_over"

/datum/sprite_accessory/snouts/synthliz/barlesstert
	color_src = USE_MATRIXED_COLORS
	name = "Synthetic Lizard - Barless Tertiary"
	icon_state = "synthliz_barless_tert"

/datum/sprite_accessory/snouts/synthliz/barlesstertunder
	color_src = USE_MATRIXED_COLORS
	name = "Synthetic Lizard - Barless Tertiary Under"
	icon_state = "synthliz_barless_tertunder"

//Protogen snoot
/datum/sprite_accessory/snouts/synthliz/protogen
	color_src = USE_MATRIXED_COLORS
	name = "Protogen"
	icon_state = "protogen"

/datum/sprite_accessory/snouts/synthliz/protogen_withbolt
	color_src = USE_MATRIXED_COLORS
	name = "Protogen - With Bolt"
	icon_state = "protogen_withbolt"

//Synth tails
/datum/sprite_accessory/tails/synthliz
	recommended_species = list("synthliz")
	icon = 'modular_septic/icons/mob/human/sprite_accessory/synthliz_tails.dmi'
	color_src = USE_ONE_COLOR
	name = "Synthetic Lizard"
	icon_state = "synthliz"
	general_type = "lizard"

//Synth Antennae
/datum/sprite_accessory/antenna/synthliz
	recommended_species = list("synthliz")
	icon = 'modular_septic/icons/mob/human/sprite_accessory/synthliz_antennas.dmi'
	color_src = USE_ONE_COLOR
	name = "Synthetic Lizard - Antennae"
	icon_state = "synth_antennae"
	default_color = null
	genetic = FALSE

/datum/sprite_accessory/antenna/synthliz/synthliz_curled
	color_src = USE_ONE_COLOR
	name = "Synthetic Lizard - Curled"
	icon_state = "synth_curled"

/datum/sprite_accessory/antenna/synthliz/synthliz_thick
	color_src = USE_ONE_COLOR
	name = "Synthetic Lizard - Thick"
	icon_state = "synth_thick"

/datum/sprite_accessory/antenna/synthliz/synth_thicklight
	color_src = USE_MATRIXED_COLORS
	name = "Synthetic Lizard - Thick Light"
	icon_state = "synth_thicklight"

/datum/sprite_accessory/antenna/synthliz/synth_short
	color_src = USE_ONE_COLOR
	name = "Synthetic Lizard - Short"
	icon_state = "synth_short"

/datum/sprite_accessory/antenna/synthliz/synth_sharp
	color_src = USE_ONE_COLOR
	name = "Synthetic Lizard - Sharp"
	icon_state = "synth_sharp"

/datum/sprite_accessory/antenna/synthliz/synth_sharplight
	color_src = USE_MATRIXED_COLORS
	name = "Synthetic Lizard - Sharp Light"
	icon_state = "synth_sharplight"

/datum/sprite_accessory/antenna/synthliz/synth_horns
	color_src = USE_ONE_COLOR
	name = "Synthetic Lizard - Horns"
	icon_state = "synth_horns"

/datum/sprite_accessory/antenna/synthliz/synth_hornslight
	color_src = USE_MATRIXED_COLORS
	name = "Synthetic Lizard - Horns Light"
	icon_state = "synth_hornslight"

/datum/sprite_accessory/antenna/synthliz/cobrahood
	name = "Synthetic Lizard - Cobra Hood"
	icon_state = "cobrahood"
	color_src = USE_MATRIXED_COLORS

/datum/sprite_accessory/antenna/synthliz/cobrahoodears
	name = "Synthetic Lizard - Cobra Hood (Ears)"
	icon_state = "cobraears"
	color_src = USE_MATRIXED_COLORS

//Synth Taurs (Ported from Virgo)
/datum/sprite_accessory/taur/synthliz
	name = "Cybernetic Lizard"
	icon_state = "synthlizard"
	taur_mode = STYLE_TAUR_PAW
	recommended_species = list("synthliz")

/datum/sprite_accessory/taur/synthliz/inv
	name = "Cybernetic Lizard (Inverted)"
	icon_state = "synthlizardinv"

/datum/sprite_accessory/taur/synthliz/feline
	name = "Cybernetic Feline"
	icon_state = "synthfeline"

/datum/sprite_accessory/taur/synthliz/feline/inv
	name = "Cybernetic Feline (Inverted)"
	icon_state = "synthfelineinv"

/datum/sprite_accessory/taur/synthliz/horse
	name = "Cybernetic Horse"
	icon_state = "synthhorse"
	taur_mode = STYLE_TAUR_HOOF
	alt_taur_mode = STYLE_TAUR_PAW

/datum/sprite_accessory/taur/synthliz/horse/inv
	name = "Cybernetic Horse (Inverted)"
	icon_state = "synthhorseinv"

/datum/sprite_accessory/taur/synthliz/wolf
	name = "Cybernetic Wolf"
	icon_state = "synthwolf"

/datum/sprite_accessory/taur/synthliz/wolf/inv
	name = "Cybernetic Wolf (Inverted)"
	icon_state = "synthwolfinv"

/datum/sprite_accessory/taur/synthliz/synthnaga
	name = "Cybernetic Naga"
	icon_state = "synthnaga"
	taur_mode = STYLE_TAUR_SNAKE


code:
/datum/sprite_accessory/tails
	key = "tail"
	generic = "Tail"
	organ_type = /obj/item/organ/tail
	icon = 'modular_septic/icons/mob/human/sprite_accessory/mutant_bodyparts.dmi'
	special_render_case = TRUE
	special_icon_case = TRUE
	special_colorize = TRUE
	relevant_layers = list(BODY_BEHIND_LAYER, BODY_FRONT_LAYER)
	genetic = TRUE
	/// A generalisation of the tail-type, e.g. lizard or feline, for hardsuit or other sprites
	var/general_type

/datum/sprite_accessory/tails/is_hidden(mob/living/carbon/human/H, obj/item/bodypart/BP)
	. = ..()
	if(body_zone && !BP?.advanced_rendering)
		return TRUE
	if(H.wear_suit)
		if(HAS_TRAIT(H, TRAIT_HIDING_MUTANTPARTS))
			return TRUE
		if(H.wear_suit.flags_inv & HIDEJUMPSUIT)
			if(istype(H.wear_suit, /obj/item/clothing/suit/space/hardsuit))
				var/obj/item/clothing/suit/space/hardsuit/HS = H.wear_suit
				if(HS.suit_tail_colors)
					return
			return TRUE

/datum/sprite_accessory/tails/get_special_render_state(mob/living/carbon/human/H)
	// Hardsuit tail spriting
	if(general_type && H.wear_suit && istype(H.wear_suit, /obj/item/clothing/suit/space/hardsuit))
		var/obj/item/clothing/suit/space/hardsuit/HS = H.wear_suit
		if(HS.suit_tail_colors)
			return "[general_type]_hardsuit"

	var/obj/item/organ/tail/T = H.getorganslot(ORGAN_SLOT_TAIL)
	if(T && T.wagging)
		return "[icon_state]_wagging"

	return icon_state

/datum/sprite_accessory/tails/get_special_icon(mob/living/carbon/human/H, passed_state)
	var/returned = icon
	if(passed_state == "[general_type]_hardsuit") //Guarantees we're wearing a hardsuit, skip checks
		var/obj/item/clothing/suit/space/hardsuit/HS = H.wear_suit
		if(HS.suit_tail_colors)
			returned = 'modular_septic/icons/mob/human/sprite_accessory/tails_hardsuit.dmi'
	return returned

/datum/sprite_accessory/tails/get_special_render_colour(mob/living/carbon/human/H, passed_state)
	if(passed_state == "[general_type]_hardsuit") //Guarantees we're wearing a hardsuit, skip checks
		var/obj/item/clothing/suit/space/hardsuit/HS = H.wear_suit
		if(HS.suit_tail_colors)
			//Currently this way, when I have more time I'll write a hex -> matrix converter to pre-bake them instead
			var/list/finished_list = list()
			finished_list += ReadRGB("[sanitize_hexcolor(HS.suit_tail_colors[1], 6, FALSE)]00")
			finished_list += ReadRGB("[sanitize_hexcolor(HS.suit_tail_colors[2], 6, FALSE)]00")
			finished_list += ReadRGB("[sanitize_hexcolor(HS.suit_tail_colors[3], 6, FALSE)]00")
			finished_list += list(0,0,0,255)
			for(var/index in 1 to LAZYLEN(finished_list))
				finished_list[index] /= 255
			return finished_list
	return null

/datum/sprite_accessory/tails/lizard
	recommended_species = list(SPECIES_LIZARD, SPECIES_LIZARD_ASH, SPECIES_SYNTHMAMMAL, SPECIES_MAMMAL,  SPECIES_LIZARD_SILVER)
	organ_type = /obj/item/organ/tail/lizard
	general_type = "lizard"

/datum/sprite_accessory/tails/human
	recommended_species = list(SPECIES_HUMAN, SPECIES_SYNTHHUMAN, SPECIES_FELINE, SPECIES_SYNTHMAMMAL, SPECIES_MAMMAL)
	organ_type = /obj/item/organ/tail/cat

/datum/sprite_accessory/tails/monkey/default
	name = "Monkey"
	icon_state = SPECIES_MONKEY
	icon = 'icons/mob/mutant_bodyparts.dmi'
	recommended_species = list(SPECIES_HUMAN, SPECIES_SYNTHHUMAN, SPECIES_FELINE, SPECIES_SYNTHMAMMAL, SPECIES_MAMMAL, SPECIES_MONKEY)
	color_src = FALSE
	organ_type = /obj/item/organ/tail/monkey

/datum/sprite_accessory/tails/none
	name = "None"
	icon_state = "none"
	recommended_species = list(SPECIES_SYNTHMAMMAL, SPECIES_MAMMAL, SPECIES_HUMAN, SPECIES_SYNTHHUMAN, SPECIES_HUMANOID)
	color_src = null
	factual = FALSE

/datum/sprite_accessory/tails/mammal
	icon_state = "none"
	recommended_species = list(SPECIES_SYNTHMAMMAL, SPECIES_MAMMAL, SPECIES_HUMAN, SPECIES_SYNTHHUMAN, SPECIES_HUMANOID)
	icon = 'modular_septic/icons/mob/human/sprite_accessory/tails.dmi'
	organ_type = /obj/item/organ/tail/fluffy/no_wag
	color_src = USE_MATRIXED_COLORS

/datum/sprite_accessory/tails/mammal/wagging
	organ_type = /obj/item/organ/tail/fluffy

/datum/sprite_accessory/tails/mammal/wagging/werewolf
	recommended_species = list(SPECIES_SYNTHMAMMAL, SPECIES_MAMMAL, SPECIES_HUMAN, SPECIES_SYNTHHUMAN, SPECIES_WEREWOLF, SPECIES_HUMANOID)
	general_type = "vulpine"

/datum/sprite_accessory/tails/mammal/wagging/werecat
	recommended_species = list(SPECIES_SYNTHMAMMAL, SPECIES_MAMMAL, SPECIES_HUMAN, SPECIES_SYNTHHUMAN, SPECIES_WERECAT, SPECIES_HUMANOID)
	general_type = "feline"

/datum/sprite_accessory/tails/mammal/wagging/akula
	recommended_species = list(SPECIES_SYNTHMAMMAL, SPECIES_MAMMAL, SPECIES_HUMAN, SPECIES_SYNTHHUMAN, SPECIES_AQUATIC, SPECIES_HUMANOID)
	general_type = "marine"

/datum/sprite_accessory/tails/mammal/wagging/avian1
	name = "Avian (alt 1)"
	icon_state = "avian1"
	general_type = "avian"

/datum/sprite_accessory/tails/mammal/wagging/avian2
	name = "Avian (alt 2)"
	icon_state = "avian2"
	general_type = "avian"

/datum/sprite_accessory/tails/mammal/wagging/axolotl
	name = "Axolotl"
	icon_state = "axolotl"
	general_type = "lizard"

/datum/sprite_accessory/tails/mammal/wagging/batl
	name = "Bat (Long)"
	icon_state = "batl"
	general_type = "feline"

/datum/sprite_accessory/tails/mammal/wagging/bats
	name = "Bat (Short)"
	icon_state = "bats"
	general_type = "feline"

/datum/sprite_accessory/tails/mammal/wagging/cable
	name = "Cable"
	icon_state = "cable"

/datum/sprite_accessory/tails/mammal/wagging/bee
	name = "Bee"
	icon_state = "bee"

/datum/sprite_accessory/tails/mammal/wagging/werecat/catbig
	name = "Cat, Big"
	icon_state = "catbig"
	color_src = USE_ONE_COLOR
	general_type = "feline"

/datum/sprite_accessory/tails/mammal/wagging/twocat
	name = "Cat, Double"
	icon_state = "twocat"

/datum/sprite_accessory/tails/mammal/wagging/corvid
	name = "Corvid"
	icon_state = "crow"
	general_type = "avian"

/datum/sprite_accessory/tails/mammal/wagging/cow
	name = "Cow"
	icon_state = "cow"

/*/datum/sprite_accessory/tails/mammal/wagging/dtiger //icon = 'icons/mob/mutant_bodyparts.dmi'
	name = "Dark Tiger"
	icon_state = "dtiger"
	color_src = USE_ONE_COLOR
	default_color = DEFAULT_PRIMARY*/

/datum/sprite_accessory/tails/mammal/wagging/eevee
	name = "Eevee"
	icon_state = "eevee"
	general_type = "vulpine"

/datum/sprite_accessory/tails/mammal/wagging/fennec
	name = "Fennec"
	icon_state = "fennec"
	general_type = "vulpine"

/datum/sprite_accessory/tails/mammal/wagging/fish
	name = "Fish"
	icon_state = "fish"
	general_type = "marine"

/datum/sprite_accessory/tails/mammal/wagging/werewolf/fox
	name = "Fox"
	icon_state = "fox"
	general_type = "vulpine"

/datum/sprite_accessory/tails/mammal/wagging/werewolf/fox2
	name = "Fox (Alt 2)"
	icon_state = "fox2"
	general_type = "vulpine"

/datum/sprite_accessory/tails/mammal/wagging/werewolf/fox3
	name = "Fox (Alt 3)"
	icon_state = "fox3"
	general_type = "vulpine"

/datum/sprite_accessory/tails/mammal/wagging/hawk
	name = "Hawk"
	icon_state = "hawk"
	general_type = "avian"

/datum/sprite_accessory/tails/mammal/wagging/horse
	name = "Horse"
	icon_state = "horse"
	color_src = USE_ONE_COLOR
	default_color = HAIR

/datum/sprite_accessory/tails/mammal/wagging/husky
	name = "Husky"
	icon_state = "husky"
	general_type = "shepherdlike"

/datum/sprite_accessory/tails/mammal/wagging/insect
	name = "Insect"
	icon_state = "insect"

/datum/sprite_accessory/tails/mammal/wagging/kangaroo
	name = "kangaroo"
	icon_state = "kangaroo"
	general_type = "straighttail"

/datum/sprite_accessory/tails/mammal/wagging/kitsune
	name = "Kitsune"
	icon_state = "kitsune"
	general_type = "vulpine" // vulpine until I can be bothered to make kitsune hardsuit tailsprite!

/datum/sprite_accessory/tails/mammal/wagging/lab
	name = "Lab"
	icon_state = "lab"

/datum/sprite_accessory/tails/mammal/wagging/leopard
	name = "Leopard"
	icon_state = "leopard"
	general_type = "feline"

/*/datum/sprite_accessory/tails/mammal/wagging/ltiger //icon = 'icons/mob/mutant_bodyparts.dmi'
	name = "Light Tiger"
	icon_state = "ltiger"
	color_src = USE_ONE_COLOR
	default_color = DEFAULT_PRIMARY*/

/datum/sprite_accessory/tails/mammal/wagging/murid
	name = "Murid"
	icon_state = "murid"

/datum/sprite_accessory/tails/mammal/wagging/orca
	name = "Orca"
	icon_state = "orca"
	general_type = "marine"

/datum/sprite_accessory/tails/mammal/wagging/otie
	name = "Otusian"
	icon_state = "otie"
	general_type = "straighttail"

/datum/sprite_accessory/tails/mammal/wagging/rabbit
	name = "Rabbit"
	icon_state = "rabbit"

/datum/sprite_accessory/tails/mammal/wagging/ailurus
	name = "Red Panda"
	icon_state = "wah"
	extra = TRUE

/datum/sprite_accessory/tails/mammal/wagging/pede
	name = "Scolipede"
	icon_state = "pede"

/datum/sprite_accessory/tails/mammal/wagging/sergal
	name = "Sergal"
	icon_state = "sergal"
	general_type = "shepherdlike"

/datum/sprite_accessory/tails/mammal/wagging/akula/shark
	name = "Shark"
	icon_state = "shark"
	general_type = "marine"

/datum/sprite_accessory/tails/mammal/wagging/shepherd
	name = "Shepherd"
	icon_state = "shepherd"
	general_type = "shepherdlike"

/datum/sprite_accessory/tails/mammal/wagging/skunk
	name = "Skunk"
	icon_state = "skunk"
	general_type = "vulpine"

/datum/sprite_accessory/tails/mammal/wagging/stripe
	name = "Stripe"
	icon_state = "stripe"

/datum/sprite_accessory/tails/mammal/wagging/straighttail
	name = "Straight Tail"
	icon_state = "straighttail"
	general_type = "straighttail"

/datum/sprite_accessory/tails/mammal/wagging/squirrel
	name = "Squirrel"
	icon_state = "squirrel"
	color_src = USE_ONE_COLOR

/datum/sprite_accessory/tails/mammal/wagging/tamamo_kitsune
	name = "Tamamo Kitsune Tails"
	icon_state = "9sune"

/datum/sprite_accessory/tails/mammal/wagging/tentacle
	name = "Tentacle"
	icon_state = "tentacle"

/datum/sprite_accessory/tails/mammal/wagging/tiger
	name = "Tiger"
	icon_state = "tiger"
	general_type = "feline"

/datum/sprite_accessory/tails/mammal/wagging/wolf
	name = "Wolf"
	icon_state = "wolf"
	color_src = USE_ONE_COLOR
	general_type = "shepherdlike"

/datum/sprite_accessory/tails/mammal/wagging/guilmon
	name = "Guilmon"
	icon_state = "guilmon"
	general_type = "lizard"

/datum/sprite_accessory/tails/mammal/wagging/akula/sharknofin
	name = "Shark no fin"
	icon_state = "sharknofin"
	general_type = "marine"

/datum/sprite_accessory/tails/mammal/raptor
    name = "Raptor"
    icon_state = "raptor"

/datum/sprite_accessory/tails/mammal/wagging/lunasune
	name = "Lunasune"
	icon_state = "lunasune"
	color_src = USE_ONE_COLOR

/datum/sprite_accessory/tails/mammal/wagging/spade
	name = "Succubus Spade Tail"
	icon_state = "spade"


code:
/datum/sprite_accessory/taur
	icon = 'modular_septic/icons/mob/human/sprite_accessory/taur.dmi'
	key = "taur"
	generic = "Taur Type"
	color_src = USE_MATRIXED_COLORS
	dimension_x = 64
	center = TRUE
	relevant_layers = list(BODY_ADJ_LAYER, BODY_FRONT_LAYER)
	body_zone = BODY_ZONE_PRECISE_GROIN
	genetic = TRUE
	var/taur_mode = NONE //Must be a single specific tauric suit variation bitflag. Don't do FLAG_1|FLAG_2
	var/alt_taur_mode = NONE //Same as above.
	var/hide_legs = TRUE
	var/hide_markings = FALSE //Any taur part that has "legs" should not hide markings

/datum/sprite_accessory/taur/is_hidden(mob/living/carbon/human/H, obj/item/bodypart/BP)
	. = ..()
	if(body_zone && !BP?.advanced_rendering)
		return TRUE
	if(H.wear_suit && (H.wear_suit.flags_inv & HIDEJUMPSUIT))
		return TRUE

/datum/sprite_accessory/taur/none
	name = "None"
	dimension_x = 32
	center = FALSE
	hide_legs = FALSE
	factual = FALSE
	color_src = null

/datum/sprite_accessory/taur/cow
	name = "Cow"
	icon_state = "cow"
	taur_mode = STYLE_TAUR_HOOF
	alt_taur_mode = STYLE_TAUR_PAW
	color_src = USE_ONE_COLOR

/datum/sprite_accessory/taur/cow/spotted
	name = "Cow (Spotted)"
	icon_state = "cow_spotted"
	color_src = USE_MATRIXED_COLORS

/datum/sprite_accessory/taur/deer
	name = "Deer"
	icon_state = "deer"
	taur_mode = STYLE_TAUR_HOOF
	alt_taur_mode = STYLE_TAUR_PAW
	color_src = USE_ONE_COLOR
	extra = TRUE
	extra_color_src = MUTCOLORS2

/datum/sprite_accessory/taur/drake
	name = "Drake"
	icon_state = "drake"
	taur_mode = STYLE_TAUR_PAW
	color_src = USE_ONE_COLOR
	extra = TRUE
	extra_color_src = MUTCOLORS2

/datum/sprite_accessory/taur/drake/old
	name = "Drake (Old)"
	icon_state = "drake_old"
	color_src = USE_MATRIXED_COLORS
	extra = FALSE

/datum/sprite_accessory/taur/drider
	name = "Drider"
	icon_state = "drider"
	color_src = USE_ONE_COLOR
	extra = TRUE
	extra_color_src = MUTCOLORS2

/datum/sprite_accessory/taur/eevee
	name = "Eevee"
	icon_state = "eevee"
	taur_mode = STYLE_TAUR_PAW
	color_src = USE_ONE_COLOR
	extra = TRUE
	extra_color_src = MUTCOLORS2

/datum/sprite_accessory/taur/horse
	name = "Horse"
	icon_state = "horse"
	taur_mode = STYLE_TAUR_HOOF
	alt_taur_mode = STYLE_TAUR_PAW

/datum/sprite_accessory/taur/naga
	name = "Naga"
	icon_state = "naga"
	taur_mode = STYLE_TAUR_SNAKE
	hide_legs = TRUE

/datum/sprite_accessory/taur/otie
	name = "Otie"
	icon_state = "otie"
	taur_mode = STYLE_TAUR_PAW

/datum/sprite_accessory/taur/pede
	name = "Scolipede"
	icon_state = "pede"
	taur_mode = STYLE_TAUR_PAW
	color_src = USE_ONE_COLOR
	extra = TRUE
	extra2 = TRUE
	extra_color_src = MUTCOLORS2
	extra2_color_src = MUTCOLORS3

/datum/sprite_accessory/taur/tentacle
	name = "Tentacle"
	icon_state = "tentacle"
	taur_mode = STYLE_TAUR_SNAKE
	color_src = USE_ONE_COLOR
	hide_legs = TRUE

/datum/sprite_accessory/taur/canine
	name = "Canine"
	icon_state = "canine"
	taur_mode = STYLE_TAUR_PAW
	color_src = USE_ONE_COLOR
	extra = TRUE
	extra_color_src = MUTCOLORS2

/datum/sprite_accessory/taur/feline
	name = "Feline"
	icon_state = "feline"
	taur_mode = STYLE_TAUR_PAW
	color_src = USE_ONE_COLOR
	extra = TRUE
	extra_color_src = MUTCOLORS2


code:
// When adding or making new wing sprites, try to use matrixed colours!
// You can find a color palette to work with in modular_septic\icons\mob\human\sprite_accessory\wings.dmi as 'colorpalette matrixcolors'
// Check some of the wings that make use of them for examples on how to make it look decent
/datum/sprite_accessory/wings
	icon = 'icons/mob/clothing/wings.dmi'
	generic = "Wings"
	key = "wings"
	color_src = USE_ONE_COLOR
	recommended_species = list(SPECIES_HUMAN, SPECIES_SYNTHHUMAN, SPECIES_FELINE, SPECIES_LIZARD, SPECIES_SYNTHMAMMAL, SPECIES_MAMMAL, SPECIES_SYNTHLIZARD)
	relevant_layers = list(BODY_BEHIND_LAYER, BODY_FRONT_LAYER, BODY_ADJ_LAYER)
	body_zone = BODY_ZONE_CHEST
	genetic = TRUE
	organ_type = /obj/item/organ/external/wings

/datum/sprite_accessory/wings/is_hidden(mob/living/carbon/human/H, obj/item/bodypart/BP)
	. = ..()
	if(body_zone && !BP?.advanced_rendering)
		return TRUE
	if(H.wear_suit && (HAS_TRAIT(H, TRAIT_HIDING_MUTANTPARTS) || (H.wear_suit.flags_inv & HIDEJUMPSUIT)) && (!H.wear_suit.species_exception || !is_type_in_list(H.dna.species, H.wear_suit.species_exception)))
		return TRUE

/datum/sprite_accessory/wings/none
	name = "None"
	icon_state = "none"
	factual = FALSE

/datum/sprite_accessory/wings/angel
	color_src = USE_ONE_COLOR
	default_color = "FFFFFF"

/datum/sprite_accessory/wings/megamoth
	color_src = USE_ONE_COLOR
	default_color = "FFFFFF"

/datum/sprite_accessory/wings/dragon
	color_src = USE_ONE_COLOR

/datum/sprite_accessory/wings/moth
	icon = 'modular_septic/icons/mob/human/sprite_accessory/moth_wings.dmi' //Needs new icon to suit new naming convention
	default_color = "FFFFFF"
	recommended_species = list(SPECIES_MOTH, SPECIES_SYNTHMAMMAL, SPECIES_INSECT)
	organ_type = /obj/item/organ/external/wings/functional/moth
	relevant_layers = list(BODY_BEHIND_LAYER, BODY_FRONT_LAYER)

/datum/sprite_accessory/wings/moth/get_preview_color()
	return COLOR_WHITE

/datum/sprite_accessory/wings/moth/none
	name = "None"
	icon_state = "none"

/datum/sprite_accessory/wings/moth/plain
	name = "Plain"
	icon_state = "plain"

/datum/sprite_accessory/wings/moth/monarch
	name = "Monarch"
	icon_state = "monarch"

/datum/sprite_accessory/wings/moth/luna
	name = "Luna"
	icon_state = "luna"

/datum/sprite_accessory/wings/moth/atlas
	name = "Atlas"
	icon_state = "atlas"

/datum/sprite_accessory/wings/moth/reddish
	name = "Reddish"
	icon_state = "redish"

/datum/sprite_accessory/wings/moth/royal
	name = "Royal"
	icon_state = "royal"

/datum/sprite_accessory/wings/moth/gothic
	name = "Gothic"
	icon_state = "gothic"

/datum/sprite_accessory/wings/moth/lovers
	name = "Lovers"
	icon_state = "lovers"

/datum/sprite_accessory/wings/moth/whitefly
	name = "White Fly"
	icon_state = "whitefly"

/datum/sprite_accessory/wings/moth/punished
	name = "Burnt Off"
	icon_state = "punished"
	locked = TRUE

/datum/sprite_accessory/wings/moth/firewatch
	name = "Firewatch"
	icon_state = "firewatch"

/datum/sprite_accessory/wings/moth/deathhead
	name = "Deathshead"
	icon_state = "deathhead"

/datum/sprite_accessory/wings/moth/poison
	name = "Poison"
	icon_state = "poison"

/datum/sprite_accessory/wings/moth/ragged
	name = "Ragged"
	icon_state = "ragged"

/datum/sprite_accessory/wings/moth/moonfly
	name = "Moon Fly"
	icon_state = "moonfly"

/datum/sprite_accessory/wings/moth/snow
	name = "Snow"
	icon_state = "snow"

/datum/sprite_accessory/wings/moth/oakworm
	name = "Oak Worm"
	icon_state = "oakworm"

/datum/sprite_accessory/wings/moth/jungle
	name = "Jungle"
	icon_state = "jungle"

/datum/sprite_accessory/wings/moth/witchwing
	name = "Witch Wing"
	icon_state = "witchwing"

//thx fulp lmao
/datum/sprite_accessory/wings/moth/rosy
	name = "Rosy"
	icon_state = "rosy"

/datum/sprite_accessory/wings/moth/dreamhead
	name = "Dreamhead"
	icon_state = "dreamhead"

/datum/sprite_accessory/wings/moth/delirious
	name = "Delirious"
	icon_state = "delirious"

/datum/sprite_accessory/wings/moth/feathery
	name = "Feathery"
	icon_state = "feathery"

/datum/sprite_accessory/wings/moth/brown
	name = "Brown"
	icon_state = "brown"

/datum/sprite_accessory/wings/moth/plasmafire
	name = "Plasmafire"
	icon_state = "plasmafire"

/datum/sprite_accessory/wings/moth/aspen
	name = "Aspen"
	icon_state = "aspen"

/datum/sprite_accessory/wings/mammal
	icon = 'modular_septic/icons/mob/human/sprite_accessory/wings.dmi'
	default_color = DEFAULT_PRIMARY
	recommended_species = list(SPECIES_SYNTHMAMMAL, SPECIES_MAMMAL, "lizard", SPECIES_INSECT, "synthliz")
	relevant_layers = list(BODY_BEHIND_LAYER, BODY_FRONT_LAYER)

/datum/sprite_accessory/wings/mammal/bat //TODO: port my sprite from hyper for this one
	name = "Bat"
	icon_state = "bat"

/datum/sprite_accessory/wings/mammal/fairy
	name = "Fairy"
	icon_state = "fairy"

/datum/sprite_accessory/wings/mammal/feathery
	name = "Feathery"
	icon_state = "feathery"

/datum/sprite_accessory/wings/mammal/featheryalt1
	name = "Feathery (alt 1)"
	icon_state = "featheryalt1"
	color_src = USE_MATRIXED_COLORS

/datum/sprite_accessory/wings/mammal/featheryalt2
	name = "Feathery (alt 2)"
	icon_state = "featheryalt2"
	color_src = USE_MATRIXED_COLORS

/datum/sprite_accessory/wings/mammal/bee
	name = "Bee"
	icon_state = "bee"

/datum/sprite_accessory/wings/mammal/succubus
	name = "Succubus"
	icon_state = "succubus"
	color_src = USE_MATRIXED_COLORS

/datum/sprite_accessory/wings/mammal/dragon_synth
	name = "Dragon (synthetic alt)"
	icon_state = "dragonsynth"
	color_src = USE_MATRIXED_COLORS
	genetic = FALSE

/datum/sprite_accessory/wings/mammal/dragon_alt1
	name = "Dragon (alt 1)"
	icon_state = "dragonalt1"
	color_src = USE_MATRIXED_COLORS

/datum/sprite_accessory/wings/mammal/dragon_alt2
	name = "Dragon (alt 2)"
	icon_state = "dragonalt2"
	color_src = USE_MATRIXED_COLORS

/datum/sprite_accessory/wings/mammal/harpywings
	name = "Harpy"
	icon_state = "harpy"
	color_src = USE_ONE_COLOR

/datum/sprite_accessory/wings/mammal/harpywingsalt1
	name = "Harpy (alt 1)"
	icon_state = "harpyalt"
	color_src = USE_ONE_COLOR

/datum/sprite_accessory/wings/mammal/harpywingsalt2
	name = "Harpy (Bat)"
	icon_state = "harpybat"
	color_src = USE_ONE_COLOR

/datum/sprite_accessory/wings/mammal/top/harpywings_top
	name = "Harpy (Top)"
	icon_state = "harpy_top"
	color_src = USE_ONE_COLOR

/datum/sprite_accessory/wings/mammal/top/harpywingsalt1_top
	name = "Harpy (alt 1) (Top)"
	icon_state = "harpyalt_top"
	color_src = USE_ONE_COLOR

/datum/sprite_accessory/wings/mammal/top/harpywingsalt2_top
	name = "Harpy (Bat) (Top)"
	icon_state = "harpybat_top"
	color_src = USE_ONE_COLOR


code:
/datum/sprite_accessory/xenodorsal
	icon = 'modular_septic/icons/mob/human/sprite_accessory/xeno_parts.dmi'
	generic = "Dorsal Spines"
	key = "xenodorsal"
	color_src = USE_ONE_COLOR
	relevant_layers = list(BODY_BEHIND_LAYER, BODY_FRONT_LAYER)
	genetic = TRUE

/datum/sprite_accessory/xenodorsal/standard
	name = "Standard"
	icon_state = "standard"

/datum/sprite_accessory/xenodorsal/royal
	name = "Royal"
	icon_state = "royal"

/datum/sprite_accessory/xenodorsal/down
	name = "Dorsal Down"
	icon_state = "down"

//TAILS
/datum/sprite_accessory/tails/xeno_tail
	icon = 'modular_septic/icons/mob/human/sprite_accessory/xeno_parts.dmi'
	name = "Xenomorph Tail"
	icon_state = "xeno"
	recommended_species = list("xeno")

//HEADS
/datum/sprite_accessory/xenohead
	icon = 'modular_septic/icons/mob/human/sprite_accessory/xeno_parts.dmi'
	generic = "Caste Head"
	key = "xenohead"
	relevant_layers = list(BODY_ADJ_LAYER)

/datum/sprite_accessory/xenohead/standard
	name = "Standard"
	icon_state = "standard"

/datum/sprite_accessory/xenohead/royal
	name = "Royal"
	icon_state = "royal"

/datum/sprite_accessory/xenohead/hollywood
	name = "Hollywood"
	icon_state = "hollywood"

/datum/sprite_accessory/xenohead/warrior
	name = "Warrior"
	icon_state = "warrior"


code:
//Ghosts will be reworked, but for now this will do
/mob/dead/observer
	var/can_rest = FALSE

/mob/dead/observer/Initialize()
	. = ..()
	add_verb(src, /mob/dead/observer/proc/second_chance)

/mob/dead/observer/proc/second_chance()
	set name = "Second Chance"
	set desc = "Live another life."
	set category = "Ghost"

	if(!can_rest)
		to_chat(src, span_warning("My body hasn't been buried or cremated."))
		return

	var/mob/dead/new_player/NP = new()
	NP.key = src.key
	qdel(src)


code:
/datum/emote/run_emote(mob/user, params, type_override, intentional = FALSE)
	. = TRUE
	if(!can_run_emote(user, TRUE, intentional))
		return FALSE

	var/msg = select_message_type(user, message, intentional)
	if(params && message_param)
		msg = select_param(user, params)

	msg = replace_pronoun(user, msg)

	if(!msg)
		return

	user.log_message(msg, LOG_EMOTE)
	var/dchatmsg = "[user] [msg]"

	var/tmp_sound = get_sound(user)
	if(tmp_sound && (!only_forced_audio || !intentional) && !TIMER_COOLDOWN_CHECK(user, type))
		TIMER_COOLDOWN_START(user, type, audio_cooldown)
		playsound(user, tmp_sound, 50, vary)

	var/user_turf = get_turf(user)
	if (user.client)
		for(var/mob/ghost as anything in GLOB.dead_mob_list)
			if(!ghost.client || isnewplayer(ghost))
				continue
			if(ghost.client.prefs.chat_toggles & CHAT_GHOSTSIGHT && !(ghost in viewers(user_turf, null)))
				ghost.show_message("[FOLLOW_LINK(ghost, user)] [dchatmsg]")

	if(emote_type == EMOTE_AUDIBLE)
		user.audible_message(msg, audible_message_flags = EMOTE_MESSAGE)
		user.sound_hint()
	else
		user.visible_message(msg, visible_message_flags = EMOTE_MESSAGE)

	SEND_SIGNAL(user, COMSIG_MOB_EMOTED(key))


code:
/mob/proc/on_examine_atom(atom/examined, examine_more = FALSE)
	return


code:
/mob/Initialize(mapload)
	. = ..()
	RegisterSignal(src, SIGNAL_ADDTRAIT(TRAIT_TYPINGINDICATOR), .proc/update_typing_indicator)
	RegisterSignal(src, SIGNAL_REMOVETRAIT(TRAIT_TYPINGINDICATOR), .proc/update_typing_indicator)
	RegisterSignal(src, SIGNAL_ADDTRAIT(TRAIT_SSDINDICATOR), .proc/update_ssd_indicator)
	RegisterSignal(src, SIGNAL_REMOVETRAIT(TRAIT_SSDINDICATOR), .proc/update_ssd_indicator)

/mob/proc/update_typing_indicator()
	if(HAS_TRAIT(src, TRAIT_TYPINGINDICATOR))
		add_overlay(GLOB.typing_indicator_overlay)
	else
		cut_overlay(GLOB.typing_indicator_overlay)

/mob/proc/update_ssd_indicator()
	if(HAS_TRAIT(src, TRAIT_SSDINDICATOR))
		add_overlay(GLOB.ssd_indicator_overlay)
	else
		cut_overlay(GLOB.ssd_indicator_overlay)

/mob/proc/set_typing_indicator(state = FALSE)
	if(state)
		ADD_TRAIT(src, TRAIT_TYPINGINDICATOR, COMMUNICATION_TRAIT)
	else
		REMOVE_TRAIT(src, TRAIT_TYPINGINDICATOR, COMMUNICATION_TRAIT)

/mob/proc/set_ssd_indicator(state = FALSE)
	if(state)
		ADD_TRAIT(src, TRAIT_SSDINDICATOR, COMMUNICATION_TRAIT)
	else
		REMOVE_TRAIT(src, TRAIT_SSDINDICATOR, COMMUNICATION_TRAIT)

/mob/Login()
	. = ..()
	REMOVE_TRAIT(src, TRAIT_SSDINDICATOR, COMMUNICATION_TRAIT)

/mob/Logout()
	. = ..()
	if(mind)
		ADD_TRAIT(src, TRAIT_SSDINDICATOR, COMMUNICATION_TRAIT)

/mob/say_verb(message as text)
	. = ..()
	set_typing_indicator(FALSE)

/mob/whisper_verb(message as text)
	. = ..()
	set_typing_indicator(FALSE)

/mob/me_verb(message as text)
	. = ..()
	set_typing_indicator(FALSE)

/mob/say_dead(message as text)
	. = ..()
	set_typing_indicator(FALSE)

/mob/say(message, bubble_type, list/spans, sanitize, datum/language/language, ignore_spam, forced)
	. = ..()
	set_typing_indicator(FALSE)

/mob/emote(act, m_type, message, intentional, force_silence)
	. = ..()
	set_typing_indicator(FALSE)

/proc/animate_speechbubble(image/I, list/show_to, duration)
	var/matrix/M = matrix()
	M.Scale(0,0)
	I.transform = M
	I.alpha = 0
	for(var/client/C in show_to)
		C.images += I
	animate(I, transform = 0, alpha = 255, time = 5, easing = ELASTIC_EASING)
	sleep(duration+5)
	animate(I, alpha = 0, time = 5, easing = EASE_IN|ELASTIC_EASING)
	sleep(5)
	for(var/client/C in show_to)
		C.images -= I


code:
/mob/put_in_hand(obj/item/I, hand_index, forced, ignore_anim)
	. = ..()
	if(. && I)
		I.undo_messy(duration = 0)

/mob/dropItemToGround(obj/item/I, force, silent, invdrop)
	. = ..()
	if(. && I)
		if(!(I.item_flags & NO_PIXEL_RANDOM_DROP))
			I.do_messy(duration = 2)
		I.remove_filter("hover_outline")


code:
/// Big blood drips
/mob/living/add_splatter_floor(turf/T, small_drip)
	if(get_blood_id() != /datum/reagent/blood)
		return

	if(!T)
		T = get_turf(src)

	var/list/temp_blood_DNA
	// Find existing splatter if possible
	var/obj/effect/decal/cleanable/blood/splatter = locate() in T
	if(small_drip)
		// Only a certain number of drips (or one large splatter) can be on a given turf.
		var/obj/effect/decal/cleanable/blood/drip/drop = locate() in T
		if(drop)
			drop.drips++
			if(drop.drips <= 5)
				drop.add_overlay(pick(drop.random_icon_states))
				drop.transfer_mob_blood_dna(src)
				T.pollute_turf(/datum/pollutant/metallic_scent, 5)
				return
			else if(drop.drips < 10)
				drop.transfer_mob_blood_dna(src)
				drop.update_appearance()
				T.pollute_turf(/datum/pollutant/metallic_scent, 5)
				return
			else
				temp_blood_DNA = drop.return_blood_DNA() //we transfer the dna from the drip to the splatter
				qdel(drop)//the drip is replaced by a bigger splatter
		else if(!splatter)
			drop = new(T, get_static_viruses())
			drop.transfer_mob_blood_dna(src)
			T.pollute_turf(/datum/pollutant/metallic_scent, 5)
			return

	// Create a new decal if there is none
	if(!splatter)
		splatter = new /obj/effect/decal/cleanable/blood/splatter(T, get_static_viruses())
		T.pollute_turf(/datum/pollutant/metallic_scent, 30)
	// Since it takes 10 drips to create a splatter, divide by 10
	if(small_drip)
		splatter.bloodiness = min((splatter.bloodiness + BLOOD_AMOUNT_PER_DECAL/10), BLOOD_POOL_MAX)
		splatter.drytime = min(splatter.drytime + 10 SECONDS, 3 MINUTES)
	else
		splatter.bloodiness = min((splatter.bloodiness + BLOOD_AMOUNT_PER_DECAL), BLOOD_POOL_MAX)
		splatter.drytime = min(splatter.drytime + 100 SECONDS, 3 MINUTES)
	if(!temp_blood_DNA)
		temp_blood_DNA = get_blood_dna_list()
	if(temp_blood_DNA)
		splatter.add_blood_DNA(temp_blood_DNA)

/// Blood trails
/mob/living/getTrail()
	var/drag_bleed_amount = bleedDragAmount()
	if(drag_bleed_amount <= 3)
		return pick("ltrails_1", "ltrails_2")
	else if(drag_bleed_amount <= 6)
		return "trails_1"
	else
		return "trails_2"

/mob/living/bleedDragAmount()
	var/brute_ratio = round(((getBruteLoss()+getFireLoss())/(maxHealth/2))*4, 1)
	return brute_ratio

/mob/living/makeTrail(turf/target_turf, turf/start, direction)
	if(!has_gravity() || !isturf(start) || !blood_volume)
		return

	var/bleed_amount = bleedDragAmount()
	if(!bleed_amount)
		return

	var/blood_exists = locate(/obj/effect/decal/cleanable/trail_holder) in start

	var/trail_type = getTrail()
	if(!trail_type)
		return

	var/bleed_ratio = round((getBruteLoss() + getFireLoss())/(maxHealth/2), 0.1)
	//Don't leave trail if blood volume is below a threshold
	if(blood_volume <= max(BLOOD_VOLUME_NORMAL * (1 - bleed_ratio), 0))
		return

	adjust_bloodvolume(-bleed_amount)
	var/newdir = get_dir(target_turf, start)
	if(newdir != direction)
		newdir = newdir | direction
		if(newdir == (NORTH|SOUTH))
			newdir = NORTH
		else if(newdir == (EAST|WEST))
			newdir = EAST
	if((newdir in GLOB.cardinals) && (prob(50)))
		newdir = turn(get_dir(target_turf, start), 180)
	if(!blood_exists)
		new /obj/effect/decal/cleanable/trail_holder(start, get_static_viruses())

	for(var/obj/effect/decal/cleanable/trail_holder/trail_holder in start)
		var/holder_length = LAZYLEN(trail_holder.existing_dirs)
		var/last_dir = LAZYACCESS(trail_holder.existing_dirs, holder_length)
		if((newdir != last_dir) && \
			(newdir|last_dir != (NORTH|SOUTH)) && (newdir|last_dir != (EAST|WEST)) && \
			(newdir in GLOB.diagonals) && (last_dir in GLOB.cardinals))
			newdir |= last_dir
		if((!(newdir in trail_holder.existing_dirs) || (trail_type == "trails_1" || trail_type == "trails_2")) && (holder_length <= 16)) //maximum amount of overlays is 16 (all light & heavy directions filled)
			trail_holder.existing_dirs += newdir
			trail_holder.add_overlay(image('modular_septic/icons/effects/blood.dmi', trail_type, dir = newdir))
			trail_holder.transfer_mob_blood_dna(src)

/// Missing a heartbeat, used by carbons to identify hardcrit
/mob/living/proc/is_asystole()
	return

/// Brain is poopy (hardcrit)
/mob/living/proc/nervous_system_failure()
	return FALSE

/// Blood gushing
/mob/living/proc/do_hitsplatter(direction, min_range = 1, max_range = 3, splatter_loc = FALSE, instant = FALSE)
	if((mob_biotypes & MOB_HUMANOID|MOB_ORGANIC) && blood_volume)
		if(splatter_loc)
			add_splatter_floor(get_turf(src), FALSE)
		var/obj/effect/decal/cleanable/blood/hitsplatter/B = new(loc)
		var/dist = rand(min_range, max_range)
		B.transfer_mob_blood_dna(src)
		B.do_squirt(direction, range = dist)

/// Blood volume adjust proc
/mob/living/proc/adjust_bloodvolume(amount)
	if((amount < 0) && blood_volume <= 0)
		return

	blood_volume = max(blood_volume + amount, 0)
	return TRUE


code:
// Carbon mobs always have an organ storage component - it just becomes accessible when necessary.
/mob/living/carbon/Initialize(mapload)
	. = ..()
	LoadComponent(/datum/component/storage/concrete/organ)

/mob/living/carbon/Destroy()
	UnregisterSignal(src, COMSIG_CARBON_CLEAR_WOUND_MESSAGE)
	UnregisterSignal(src, COMSIG_CARBON_ADD_TO_WOUND_MESSAGE)
	QDEL_LIST_ASSOC_VAL(chem_effects)
	if(speech_modifiers)
		for(var/thing in speech_modifiers)
			qdel(thing) // Lazylist
	return ..()

//Each hands saves a specific zone and intent etc
/mob/living/carbon/swap_hand(held_index)
	. = ..()
	if(!.)
		return
	//Update intent and zone selected according to the zone saved
	var/index = min(length(hand_index_to_intent), active_hand_index)
	a_intent_change(hand_index_to_intent[index])
	index = min(length(hand_index_to_throw), active_hand_index)
	if(hand_index_to_throw[index])
		throw_mode_on()
	else
		throw_mode_off()
	index = min(length(hand_index_to_zone), active_hand_index)
	if(hud_used)
		var/atom/movable/screen/zone_sel/zone_sel = hud_used.zone_select
		if(istype(zone_sel))
			zone_sel.set_selected_zone(hand_index_to_zone[index], user = src)
	//Action speed modifiers depending on efficiency
	var/obj/item/bodypart/active_hand = get_active_hand()
	if(active_hand)
		add_or_update_variable_actionspeed_modifier(/datum/actionspeed_modifier/limb_efficiency, (1 - (active_hand.limb_efficiency/LIMB_EFFICIENCY_OPTIMAL)) * LIMB_EFFICIENCY_ACTIONSPEED_MULTIPLIER)
	else
		add_or_update_variable_actionspeed_modifier(/datum/actionspeed_modifier/limb_efficiency,  LIMB_EFFICIENCY_ACTIONSPEED_MULTIPLIER)
	update_handedness(active_hand_index)

/mob/living/carbon/throw_mode_off()
	. = ..()
	hand_index_to_throw[active_hand_index] = throw_mode ? TRUE : FALSE

/mob/living/carbon/throw_mode_on()
	. = ..()
	hand_index_to_throw[active_hand_index] = throw_mode ? TRUE : FALSE

//Can't sprint on walk mode
/mob/living/update_move_intent_slowdown()
	. = ..()
	if(m_intent != MOVE_INTENT_RUN)
		disable_sprint()

//Suicide stuff
/mob/living/carbon/revive(full_heal = FALSE, admin_revive = FALSE, excess_healing = 0)
	. = ..()
	var/obj/item/organ/brain/BR = getorgan(/obj/item/organ/brain)
	if(BR.suicided)
		to_chat(src, span_boldwarning("NO! PLEASE, LET ME GO!"))
		SEND_SIGNAL(src, COMSIG_ADD_MOOD_EVENT, "letmedie", /datum/mood_event/letmedie)

//Heal stuff
/mob/living/carbon/fully_heal(admin_revive)
	. = ..()
	slurring = 0
	cultslurring = 0
	stuttering = 0
	set_germ_level(GERM_LEVEL_STERILE)
	setFatigueLoss(0)
	setPainLoss(0)
	setShockStage(0)
	for(var/obj/item/organ/organ in internal_organs)
		organ.set_germ_level(GERM_LEVEL_STERILE)
		organ.organ_flags &= ~(ORGAN_DEAD|ORGAN_DESTROYED|ORGAN_CUT_AWAY|ORGAN_SYNTHETIC_EMP)
		organ.applyOrganDamage(-organ.maxHealth)
	for(var/obj/item/bodypart/bodypart in bodyparts)
		REMOVE_TRAIT(bodypart, TRAIT_ROTTEN, GERM_LEVEL)
		REMOVE_TRAIT(bodypart, TRAIT_DEFORMED, CLONE)
		bodypart.set_germ_level(GERM_LEVEL_STERILE)
		bodypart.limb_flags &= ~(BODYPART_DEAD|BODYPART_DEFORMED|BODYPART_CUT_AWAY|BODYPART_SYNTHETIC_EMP)
		bodypart.heal_damage(INFINITY, INFINITY, INFINITY)
		bodypart.update_limb_efficiency()
	REMOVE_TRAIT(src, TRAIT_DISFIGURED, TRAIT_GENERIC)
	REMOVE_TRAIT(src, TRAIT_DISFIGURED, ACID)
	REMOVE_TRAIT(src, TRAIT_DISFIGURED, BRUTE)
	REMOVE_TRAIT(src, TRAIT_DISFIGURED, BURN)
	REMOVE_TRAIT(src, TRAIT_DISFIGURED, GERM_LEVEL)
	update_eyes()
	update_sight()
	update_tint()

/mob/living/carbon/update_equipment_speed_mods()
	. = ..()
	update_carry_weight()

/mob/living/carbon/attack_hand(mob/living/carbon/human/user, list/modifiers)
	if(LAZYACCESS(modifiers, MIDDLE_CLICK) && (user.zone_selected in list(BODY_ZONE_PRECISE_NECK, \
														BODY_ZONE_L_ARM, BODY_ZONE_R_ARM, \
														BODY_ZONE_PRECISE_L_HAND, BODY_ZONE_PRECISE_R_HAND)))
		for(var/thing in diseases)
			var/datum/disease/D = thing
			if(D.spread_flags & DISEASE_SPREAD_CONTACT_SKIN)
				user.ContactContractDisease(D)
		for(var/thing in user.diseases)
			var/datum/disease/D = thing
			if(D.spread_flags & DISEASE_SPREAD_CONTACT_SKIN)
				ContactContractDisease(D)
		return check_pulse(user)
	return ..()

/mob/living/carbon/throw_mode_off(method)
	if(throw_mode > method) //A toggle doesnt affect a hold
		return
	throw_mode = THROW_MODE_DISABLED
	if(hud_used)
		hud_used.throw_icon.icon_state = "act_throw"
		hud_used.throw_icon.name = "throw/catch"

/mob/living/carbon/throw_mode_on(mode = THROW_MODE_TOGGLE)
	throw_mode = mode
	if(hud_used)
		hud_used.throw_icon.icon_state = "act_throw_on"
		hud_used.throw_icon.name = "stop throwing/catching"

/mob/living/carbon/update_stat()
	. = ..()
	hud_used?.sleeping?.update_appearance()

/mob/living/carbon/update_stamina()
	var/stam = getStaminaLoss()
	if(stam >= SPRINT_MAX_STAMLOSS)
		ADD_TRAIT(src, TRAIT_SPRINT_LOCKED, STAMINA)
	else if(HAS_TRAIT_FROM(src, TRAIT_SPRINT_LOCKED, STAMINA))
		REMOVE_TRAIT(src, TRAIT_SPRINT_LOCKED, STAMINA)
	if(stam > DAMAGE_PRECISION && ((maxHealth - stam) <= crit_threshold))
		enter_stamcrit()
	else if(HAS_TRAIT_FROM(src, TRAIT_INCAPACITATED, STAMINA))
		REMOVE_TRAIT(src, TRAIT_INCAPACITATED, STAMINA)
		REMOVE_TRAIT(src, TRAIT_IMMOBILIZED, STAMINA)
		REMOVE_TRAIT(src, TRAIT_FLOORED, STAMINA)
	update_fatigue()
	update_stamina_hud()
	update_health_hud()

/mob/living/carbon/create_bodyparts()
	var/list/bodypart_paths = bodyparts.Copy()
	bodyparts = list()
	for(var/bodypart_type in bodypart_paths)
		var/obj/item/bodypart/bodypart = new bodypart_type()
		bodypart.attach_limb(src, TRUE, TRUE)

/mob/living/carbon/adjust_germ_level(add_germs, minimum_germs, maximum_germs)
	. = ..()
	update_smelly()

/mob/living/carbon/proc/update_stamina_hud(shown_stamina_amount)
	if(!client || !hud_used)
		return
	if(hud_used.fatigue)
		hud_used.fatigue.update_appearance()

/mob/living/carbon/proc/virus_immunity()
	. = 0
	var/antibiotic_boost = get_antibiotics() / 100
	return max(immunity/100 * (1+antibiotic_boost), antibiotic_boost)

/mob/living/carbon/proc/immunity_weakness()
	return max(2-virus_immunity(), 0)

/mob/living/carbon/proc/get_antibiotics()
	. = 0
	. += get_chem_effect(CE_ANTIBIOTIC)

/mob/living/carbon/proc/needs_lungs()
	if(HAS_TRAIT(src, TRAIT_NOBREATH))
		return FALSE
	if(NOLUNGS in dna?.species?.species_traits)
		return FALSE
	return TRUE

/mob/living/carbon/proc/check_pulse(mob/living/carbon/user)
	. = TRUE
	var/self = FALSE
	if(user == src)
		self = TRUE

	var/obj/item/bodypart/pulsating_cock = get_bodypart(check_zone(user.zone_selected))
	if(!pulsating_cock)
		to_chat(user, span_warning("I cannot measure [self ? "my" : p_their()] pulse without \a [parse_zone(user.zone_selected)]."))
		return
	if(!user.canUseTopic(src, TRUE) || DOING_INTERACTION_WITH_TARGET(user, src))
		to_chat(user, span_warning("I'm unable to check [self ? "my" : "[src]'s"] pulse.</"))
		return

	if(!self)
		user.visible_message(span_notice("[user] puts \his hand on [src]'s wrist and begins counting their pulse."),\
		span_notice("I begin counting [src]'s pulse..."))
	else
		user.visible_message(span_notice("[user] begins counting their own pulse."),\
		span_notice("I begin counting my pulse..."))

	if(!do_mob(user, src, 0.5 SECONDS))
		to_chat(user, span_warning("I failed to check [self ? "my" : "[src]'s"] pulse."))
		return

	if(pulse)
		to_chat(user, span_notice("[self ? "I have a" : "[src] has a"] pulse! Counting..."))
	else
		to_chat(user, span_danger("[self ? "I have no" : "[src] has no"] pulse!"))
		return

	if(do_mob(user, src, 2.5 SECONDS))
		to_chat(user, span_notice("[self ? "My" : "[src]'s"] pulse is approximately [src.get_pulse(GETPULSE_BASIC)] BPM."))
	else
		to_chat(user, span_warning("I failed to check [self ? "my" : "[src]'s"] pulse."))

// peepee
/mob/living/carbon/proc/genital_visible(genital_slot = ORGAN_SLOT_PENIS)
	return FALSE

/mob/living/carbon/proc/should_have_genital(genital_slot = ORGAN_SLOT_PENIS)
	return FALSE

// bleedout checks
/mob/living/carbon/proc/in_bleedout()
	return (CHECK_BITFIELD(status_flags, BLEEDOUT))

/mob/living/carbon/proc/update_handedness(held_index = 0)
	//Left hand
	if(held_index % 2)
		if(!(handed_flags & LEFT_HANDED))
			if(handed_flags & AMBIDEXTROUS)
				add_actionspeed_modifier(/datum/actionspeed_modifier/ambidextrous_hand)
			else
				add_actionspeed_modifier(/datum/actionspeed_modifier/nondominant_hand)
				attributes?.add_attribute_modifier(/datum/attribute_modifier/nondominant_hand, TRUE)
		else
			remove_actionspeed_modifier(/datum/actionspeed_modifier/ambidextrous_hand)
			remove_actionspeed_modifier(/datum/actionspeed_modifier/nondominant_hand)
			attributes?.remove_attribute_modifier(/datum/attribute_modifier/nondominant_hand, TRUE)
	//Right hand
	else
		if(!(handed_flags & RIGHT_HANDED))
			if(handed_flags & AMBIDEXTROUS)
				add_actionspeed_modifier(/datum/actionspeed_modifier/ambidextrous_hand)
			else
				add_actionspeed_modifier(/datum/actionspeed_modifier/nondominant_hand)
				attributes?.add_attribute_modifier(/datum/attribute_modifier/nondominant_hand, TRUE)
		else
			remove_actionspeed_modifier(/datum/actionspeed_modifier/ambidextrous_hand)
			remove_actionspeed_modifier(/datum/actionspeed_modifier/nondominant_hand)
			attributes?.remove_attribute_modifier(/datum/attribute_modifier/nondominant_hand, TRUE)


code:
/// Do we lack a functioning heart?
/mob/living/carbon/undergoing_cardiac_arrest()
	if(!needs_heart())
		return FALSE

	return ((getorganslotefficiency(ORGAN_SLOT_HEART) < ORGAN_FAILING_EFFICIENCY) || (pulse <= PULSE_NONE))

/mob/living/carbon/is_asystole()
	return undergoing_cardiac_arrest()

/mob/living/carbon/set_heartattack(status)
	if(!can_heartattack())
		return FALSE

	var/list/hearts = getorganslotlist(ORGAN_SLOT_HEART)
	if(status)
		pulse = PULSE_NONE
		for(var/obj/item/organ/heart/heart in hearts)
			heart.Stop()
	else
		pulse = PULSE_NORM
		for(var/obj/item/organ/heart/heart in hearts)
			heart.Restart()

// Brain is fried
/mob/living/carbon/nervous_system_failure()
	var/obj/item/organ/brain/brain = getorganslot(ORGAN_SLOT_BRAIN)
	if(!brain)
		return TRUE
	if(brain.is_failing())
		return TRUE

// Better drag bleed
/mob/living/carbon/bleedDragAmount()
	var/bleed_amount = 0
	for(var/i in all_wounds)
		var/datum/wound/iter_wound = i
		bleed_amount += iter_wound.drag_bleed_amount()
	for(var/i in all_injuries)
		var/datum/injury/iter_injury = i
		bleed_amount += iter_injury.drag_bleed_amt()
	return round(bleed_amount, 1)

// Better bleeding
/mob/living/carbon/bleed(amt)
	if(!adjust_bloodvolume(-amt))
		return

	//Blood loss still happens in locker, floor stays clean
	if(isturf(loc) && prob(sqrt(amt)*BLOOD_DRIP_RATE_MOD))
		add_splatter_floor(loc, (amt < 10))

// Better bleed warning
/mob/living/carbon/bleed_warn(bleed_amt = 0, forced = FALSE)
	if((get_blood_circulation() <= 0) || !client)
		return
	if(!COOLDOWN_FINISHED(src, bleeding_message_cd) && !forced)
		return

	if(!bleed_amt) // if we weren't provided the amount of blood we lost this tick in the args
		bleed_amt = get_bleed_rate()

	var/bleeding_severity = ""
	var/next_cooldown = BLEEDING_MESSAGE_BASE_CD

	switch(bleed_amt)
		if(-INFINITY to 0)
			return
		if(0 to 1)
			bleeding_severity = "You feel light trickles of blood across your skin"
			next_cooldown *= 2.5
		if(1 to 3)
			bleeding_severity = "You feel a small stream of blood running across your body"
			next_cooldown *= 2
		if(3 to 5)
			bleeding_severity = "You skin feels clammy from the flow of blood leaving your body"
			next_cooldown *= 1.7
		if(5 to 7)
			bleeding_severity = "Your body grows more and more numb as blood pours out"
			next_cooldown *= 1.5
		if(7 to INFINITY)
			bleeding_severity = "Your heartbeat thrashes wildly trying to keep up with your massive bloodloss"

	var/rate_of_change = ", but it's getting better." // if there's no wounds actively getting bloodier or maintaining the same flow, we must be getting better!
	if(HAS_TRAIT(src, TRAIT_COAGULATING)) // if we have coagulant, we're getting better quick
		rate_of_change = ", but it's clotting up quickly!"
	else
		// flick through our wounds to see if there are any bleeding ones getting worse or holding flow (maybe move this to handle_blood and cache it so we don't need to cycle through the wounds so much)
		for(var/i in all_wounds)
			var/datum/wound/iter_wound = i
			if(!iter_wound.blood_flow)
				continue
			var/iter_wound_roc = iter_wound.get_bleed_rate_of_change()
			switch(iter_wound_roc)
				if(BLOOD_FLOW_INCREASING) // assume the worst, if one wound is getting bloodier, we focus on that
					rate_of_change = ", and it's getting worse!"
					break
				if(BLOOD_FLOW_STEADY) // our best case now is that our bleeding isn't getting worse
					rate_of_change = ", and it's holding steady."
				if(BLOOD_FLOW_DECREASING) // this only matters if none of the wounds fit the above two cases, included here for completeness
					continue
		// same for injuries
		if(rate_of_change != ", and it's getting worse!")
			for(var/i in all_injuries)
				var/datum/injury/iter_injury = i
				if(!iter_injury.is_bleeding())
					continue
				var/iter_injury_roc = iter_injury.get_bleed_rate_of_change()
				switch(iter_injury_roc)
					if(BLOOD_FLOW_INCREASING) // assume the worst, if one wound is getting bloodier, we focus on that
						rate_of_change = ", and it's getting worse!"
						break
					if(BLOOD_FLOW_STEADY) // our best case now is that our bleeding isn't getting worse
						rate_of_change = ", and it's holding steady."
					if(BLOOD_FLOW_DECREASING) // this only matters if none of the injuries fit the above two cases, included here for completeness
						continue
		// if we have a torn artery it won't get better on it's on
		if(rate_of_change != ", and it's getting worse!")
			for(var/bp in bodyparts)
				var/obj/item/bodypart/bodypart = bp
				if(bodypart.is_artery_torn())
					rate_of_change = ", and it's holding steady."

	to_chat(src, span_userdanger("[bleeding_severity][rate_of_change]"))
	COOLDOWN_START(src, bleeding_message_cd, next_cooldown)

/// This is basically a meme, but having multiple infected and failing organs = you are in septic shock
/mob/living/carbon/proc/undergoing_septic_shock()
	var/fuckeduporgans = 0
	for(var/obj/item/organ/organ as anything in internal_organs)
		if((organ.germ_level >= INFECTION_LEVEL_TWO) && organ.is_failing())
			fuckeduporgans++
	for(var/obj/item/bodypart/bodypart as anything in bodyparts)
		if(bodypart.germ_level >= INFECTION_LEVEL_THREE)
			fuckeduporgans++
	return (fuckeduporgans >= 6)

/// Blood volume, affected by the heart
/mob/living/carbon/proc/get_blood_circulation()
	if(HAS_TRAIT(src, TRAIT_BLOODLOSSIMMUNE))
		return BLOOD_VOLUME_NORMAL
	if(!needs_heart())
		return blood_volume

	var/heart_efficiency = getorganslotefficiency(ORGAN_SLOT_HEART)
	var/apparent_blood_volume = blood_volume

	var/pulse_mod = 1
	if(HAS_TRAIT(src, TRAIT_FAKEDEATH))
		pulse_mod = 1
	else
		switch(pulse)
			if(-INFINITY to PULSE_NONE)
				//Did someone at least perform CPR?
				if(recent_heart_pump && (world.time <= text2num(recent_heart_pump[1]) + heart_pump_duration))
					pulse_mod *= recent_heart_pump[recent_heart_pump[1]]
				else
					if(stat < DEAD)
						//Fuck - But we're still alive so there is *some* blood flow.
						pulse_mod *= 0.1
					else
						//Dead people don't pump blood, at all
						pulse_mod *= 0
			if(PULSE_SLOW)
				pulse_mod *= 0.9
			if(PULSE_FAST)
				pulse_mod *= 1.1
			if(PULSE_FASTER, PULSE_THREADY)
				pulse_mod *= 1.25

	var/min_efficiency = recent_heart_pump ? 0.5 : 0.25
	apparent_blood_volume *= clamp(1 - (100 - heart_efficiency)/100, min_efficiency, 5)
	apparent_blood_volume *= pulse_mod

	var/blockage = get_chem_effect(src, CE_BLOCKAGE)
	if(blockage)
		var/list/hearts = getorganslotlist(ORGAN_SLOT_HEART)
		var/bypassed_heart = FALSE
		for(var/thing in hearts)
			var/obj/item/organ/heart/heart = thing
			if(heart.open)
				bypassed_heart = TRUE
		if(!bypassed_heart)
			apparent_blood_volume *= max(0, 1 - (blockage/100))

	return apparent_blood_volume

/// Blood volume, affected by the condition of circulation organs, affected by the oxygen loss - What ultimately matters for brain.
/mob/living/carbon/proc/get_blood_oxygenation()
	if(HAS_TRAIT(src, TRAIT_BLOODLOSSIMMUNE))
		return BLOOD_VOLUME_NORMAL

	var/apparent_blood_volume = get_blood_circulation()
	if(blood_carries_oxygen())
		if(!needs_lungs())
			return apparent_blood_volume
	else
		apparent_blood_volume = BLOOD_VOLUME_NORMAL

	var/apparent_blood_volume_mod = max(0, 1 - getOxyLoss()/maxHealth)
	var/oxygenated = get_chem_effect(CE_OXYGENATED)
	if(oxygenated == 1) // Tirimol
		apparent_blood_volume_mod += 0.5
	else if(oxygenated >= 2) // Dexalin plus
		apparent_blood_volume_mod += 0.8
	apparent_blood_volume = apparent_blood_volume * apparent_blood_volume_mod
	return apparent_blood_volume

/// Do we need blood to sustain the brain?
/mob/living/carbon/proc/blood_carries_oxygen()
	return TRUE

/// Get the pulse integer
/mob/living/carbon/proc/pulse()
	return pulse

/// A pulse to be read by players
/mob/living/carbon/proc/get_pulse_as_number(raw_pulse = pulse)
	switch(raw_pulse)
		if(PULSE_NONE)
			return 0
		if(PULSE_SLOW)
			return rand(40, 60)
		if(PULSE_NORM)
			return rand(60, 90)
		if(PULSE_FAST)
			return rand(90, 120)
		if(PULSE_FASTER)
			return rand(120, 160)
		if(PULSE_THREADY)
			return PULSE_MAX_BPM
	CRASH("For some reason, on a get_pulse_as_number() call, someone's pulse is not a valid integer!")

/// Generates realistic-ish pulse output based on preset levels as text
/mob/living/carbon/proc/get_pulse(method)	//method 0 is for hands, 1 is for machines, more accurate
	if(method == GETPULSE_PERFECT)
		return pulse

	var/list/hearts = getorganslotlist(ORGAN_SLOT_HEART)
	if(!length(hearts))
		// No heart, no pulse
		return "0"

	var/bypassed_heart = FALSE
	for(var/thing in hearts)
		var/obj/item/organ/heart/heart = thing
		if(heart.open)
			bypassed_heart = TRUE

	if(bypassed_heart && (method <= GETPULSE_BASIC))
		// Heart is a open type (?) and cannot be checked unless it's a machine
		return "muddled and unclear"

	var/bpm = get_pulse_as_number()
	if(bpm >= PULSE_MAX_BPM)
		if(method == GETPULSE_ADVANCED)
			return ">[PULSE_MAX_BPM]"
		else
			return "extremely weak and fast"

	if(method == GETPULSE_ADVANCED)
		return "[bpm]"
	else
		return "[bpm > 0 ? max(0, bpm + rand(-10, 10)) : 0]"


code:
/// Returns how often we need to breathe, basically
/mob/living/carbon/proc/get_breath_modulo()
	return 4

/// Returns how much air we need to breathe in
/mob/living/carbon/proc/get_breath_volume()
	return BREATH_VOLUME

/// We handle breathing with the new organ process system, which will call breathe()
/mob/living/carbon/handle_breathing(delta_time, times_fired)
	return

/// Second link in a breath chain, calls check_breath()
/mob/living/carbon/breathe(delta_time, times_fired, datum/organ_process/lung_process)
	if(reagents.has_reagent(/datum/reagent/toxin/lexorin, needs_metabolizing = TRUE))
		return

	if(istype(loc, /obj/machinery/atmospherics/components/unary/cryo_cell))
		return

	var/datum/gas_mixture/environment
	if(loc)
		environment = loc.return_air()

	var/datum/gas_mixture/breath

	var/turf/turf_loc = get_turf(src)
	if(turf_loc?.pollution)
		turf_loc.pollution.touch_act(src)

	if(getorganslotefficiency(ORGAN_SLOT_BREATHING_TUBE) < ORGAN_FAILING_EFFICIENCY)
		//You can't breath at all when in critical, when being choked, holding your breath, or drowning,
		//so you're going to miss a breath
		if(HAS_TRAIT(src, TRAIT_HOLDING_BREATH) || HAS_TRAIT(src, TRAIT_MAGIC_CHOKE) || \
			(undergoing_cardiac_arrest() && !get_chem_effect(CE_STABLE)) || \
			(pulledby && pulledby.grab_state >= GRAB_KILL) || \
			turf_loc?.liquids && !HAS_TRAIT(src, TRAIT_WATER_BREATHING) && ((body_position == LYING_DOWN && turf_loc.liquids.liquid_state >= LIQUID_STATE_WAIST) || (body_position == STANDING_UP && turf_loc.liquids.liquid_state >= LIQUID_STATE_FULLTILE)) )
			losebreath++

	var/lung_efficiency = getorganslotefficiency(ORGAN_SLOT_LUNGS)
	var/list/lungs = getorganslotlist(ORGAN_SLOT_LUNGS)
	//Suffocation
	if(losebreath >= 1) //You've missed a breath, take oxy damage
		losebreath--
		if(prob(10))
			if(turf_loc?.liquids)
				agony_gargle()
			else
				agony_gasp()
		if(turf_loc?.liquids)
			if((oxyloss > OXYGEN_DAMAGE_CHOKING_THRESHOLD) || (stat > CONSCIOUS))
				//Try and drink water#]
				var/datum/reagents/temporary_holder = turf_loc.liquids.take_reagents_flat(CHOKE_REAGENTS_INGEST_ON_BREATH_AMOUNT)
				temporary_holder.trans_to(src, temporary_holder.total_volume, methods = INGEST)
				qdel(temporary_holder)
				visible_message(span_warning("<b>[src]</b> chokes on liquids!"), \
							span_userdanger("I'm choking on liquids!"))
		if(istype(loc, /obj/))
			var/obj/loc_as_obj = loc
			loc_as_obj.handle_internal_lifeform(src,0)
	//Breathing normally
	else
		//Breathe from internal
		var/breath_volume = get_breath_volume()
		breath = get_breath_from_internal(breath_volume)
		if(isnull(breath)) //in case of 0 pressure internals
			if(isobj(loc)) //Breathe from loc as object
				var/obj/loc_as_obj = loc
				breath = loc_as_obj.handle_internal_lifeform(src, breath_volume)
			else if(isturf(loc)) //Breathe from loc as turf
				var/breath_moles = 0
				if(environment)
					breath_moles = environment.total_moles()*(breath_volume/CELL_VOLUME)
				breath = loc.remove_air(breath_moles)
				if(turf_loc?.pollution && COOLDOWN_FINISHED(src, next_smell))
					COOLDOWN_START(src, next_smell, SMELL_COOLDOWN)
					turf_loc.pollution.smell_act(src)
					turf_loc.pollution.breathe_act(src)
		else //Breathe from loc as obj again
			if(istype(loc, /obj))
				var/obj/loc_as_obj = loc
				loc_as_obj.handle_internal_lifeform(src,0)
			if(GLOB.breathing_sound)
				playsound(get_turf(src), GLOB.breathing_sound, 40, 1, SHORT_RANGE_SOUND_EXTRARANGE)

	check_breath(breath, lung_efficiency, lungs, lung_process)

/// Third link in a breath chain, calls handle_breath_temperature()
/mob/living/carbon/check_breath(datum/gas_mixture/breath, lung_efficiency, list/lungs, datum/organ_process/lung_process)
	//CRIT
	if(!breath || (breath.total_moles() == 0) || (lung_efficiency < lung_process.failing_threshold) || !length(lungs))
		check_failed_breath(breath, lung_efficiency, lungs, lung_process)
		return FALSE

	var/safe_oxy_min = 16
	var/safe_co2_max = 10
	var/safe_tox_max = 0.05
	var/SA_para_min = 1
	var/SA_sleep_min = 5
	var/oxygen_used = 0
	var/breath_pressure = (breath.total_moles()*R_IDEAL_GAS_EQUATION*breath.temperature)/BREATH_VOLUME

	var/list/breath_gases = breath.gases
	breath.assert_gases(/datum/gas/oxygen, /datum/gas/plasma, /datum/gas/carbon_dioxide, /datum/gas/nitrous_oxide, /datum/gas/bz)

	var/O2_partialpressure = (breath_gases[/datum/gas/oxygen][MOLES]/breath.total_moles())*breath_pressure
	var/Toxins_partialpressure = (breath_gases[/datum/gas/plasma][MOLES]/breath.total_moles())*breath_pressure
	var/CO2_partialpressure = (breath_gases[/datum/gas/carbon_dioxide][MOLES]/breath.total_moles())*breath_pressure

	//OXYGEN
	if(O2_partialpressure < safe_oxy_min) //Not enough oxygen
		if(prob(20))
			emote("gasp")
		if(O2_partialpressure > 0)
			var/ratio = 1 - O2_partialpressure/safe_oxy_min
			adjustOxyLoss(min(5*ratio, 3))
			failed_last_breath = TRUE
			oxygen_used = breath_gases[/datum/gas/oxygen][MOLES]*ratio
		else
			adjustOxyLoss(3)
			failed_last_breath = TRUE
		throw_alert("cant_breathe", /atom/movable/screen/alert/cant_breathe)

	else //Enough oxygen
		failed_last_breath = FALSE
		if(health >= crit_threshold)
			adjustOxyLoss(-5)
		oxygen_used = breath_gases[/datum/gas/oxygen][MOLES]
		clear_alert("cant_breathe")

	breath_gases[/datum/gas/oxygen][MOLES] -= oxygen_used
	breath_gases[/datum/gas/carbon_dioxide][MOLES] += oxygen_used

	//CARBON DIOXIDE
	if(CO2_partialpressure > safe_co2_max)
		if(!co2overloadtime)
			co2overloadtime = world.time
		else if(world.time - co2overloadtime > 120)
			Unconscious(60)
			adjustOxyLoss(3)
			if(world.time - co2overloadtime > 300)
				adjustOxyLoss(8)
		if(prob(20))
			emote("cough")

	else
		co2overloadtime = 0

	//TOXINS/PLASMA
	if(Toxins_partialpressure > safe_tox_max)
		var/ratio = (breath_gases[/datum/gas/plasma][MOLES]/safe_tox_max) * 10
		adjustToxLoss(clamp(ratio, MIN_TOXIC_GAS_DAMAGE, MAX_TOXIC_GAS_DAMAGE))
		throw_alert("cant_breathe", /atom/movable/screen/alert/cant_breathe)
	else
		clear_alert("cant_breathe")

	//NITROUS OXIDE
	if(breath_gases[/datum/gas/nitrous_oxide])
		var/SA_partialpressure = (breath_gases[/datum/gas/nitrous_oxide][MOLES]/breath.total_moles())*breath_pressure
		if(SA_partialpressure > SA_para_min)
			throw_alert("cant_breathe", /atom/movable/screen/alert/cant_breathe)
			SEND_SIGNAL(src, COMSIG_CLEAR_MOOD_EVENT, "chemical_euphoria")
			Unconscious(60)
			if(SA_partialpressure > SA_sleep_min)
				Sleeping(max(AmountSleeping() + 40, 200))
		else if(SA_partialpressure > 0.01)
			clear_alert("cant_breathe")
			if(prob(20))
				emote(pick("giggle","laugh"))
			SEND_SIGNAL(src, COMSIG_ADD_MOOD_EVENT, "chemical_euphoria", /datum/mood_event/chemical_euphoria)
		else
			SEND_SIGNAL(src, COMSIG_CLEAR_MOOD_EVENT, "chemical_euphoria")
			clear_alert("cant_breathe")
	else
		SEND_SIGNAL(src, COMSIG_CLEAR_MOOD_EVENT, "chemical_euphoria")
		clear_alert("cant_breathe")

	//BZ (Facepunch port of their Agent B)
	if(breath_gases[/datum/gas/bz])
		var/bz_partialpressure = (breath_gases[/datum/gas/bz][MOLES]/breath.total_moles())*breath_pressure
		if(bz_partialpressure > 1)
			hallucination += 10
		else if(bz_partialpressure > 0.01)
			hallucination += 5

	//TRITIUM
	if(breath_gases[/datum/gas/tritium])
		var/tritium_partialpressure = (breath_gases[/datum/gas/tritium][MOLES]/breath.total_moles())*breath_pressure
		radiation += tritium_partialpressure/10

	//NITRYL
	if(breath_gases[/datum/gas/nitryl])
		var/nitryl_partialpressure = (breath_gases[/datum/gas/nitryl][MOLES]/breath.total_moles())*breath_pressure
		adjustFireLoss(nitryl_partialpressure/4)

	//FREON
	if(breath_gases[/datum/gas/freon])
		var/freon_partialpressure = (breath_gases[/datum/gas/freon][MOLES]/breath.total_moles())*breath_pressure
		adjustFireLoss(freon_partialpressure * 0.25)

	//MIASMA
	if(breath_gases[/datum/gas/miasma])
		var/miasma_partialpressure = (breath_gases[/datum/gas/miasma][MOLES]/breath.total_moles())*breath_pressure

		if(prob(1 * miasma_partialpressure))
			var/datum/disease/advance/miasma_disease = new /datum/disease/advance/random(2,3)
			miasma_disease.name = "Unknown"
			ForceContractDisease(miasma_disease, TRUE, TRUE)

		//Miasma side effects
		switch(miasma_partialpressure)
			if(0.25 to 5)
				// At lower pp, give out a little warning
				SEND_SIGNAL(src, COMSIG_CLEAR_MOOD_EVENT, "smell")
				if(prob(5))
					to_chat(src, span_notice("There is an unpleasant smell in the air."))
			if(5 to 20)
				//At somewhat higher pp, warning becomes more obvious
				if(prob(15))
					to_chat(src, span_warning("You smell something horribly decayed inside this room."))
					SEND_SIGNAL(src, COMSIG_ADD_MOOD_EVENT, "smell", /datum/mood_event/disgust/bad_smell)
			if(15 to 30)
				//Small chance to vomit. By now, people have internals on anyway
				if(prob(5))
					to_chat(src, span_warning("The stench of rotting carcasses is unbearable!"))
					SEND_SIGNAL(src, COMSIG_ADD_MOOD_EVENT, "smell", /datum/mood_event/disgust/nauseating_stench)
					vomit()
			if(30 to INFINITY)
				//Higher chance to vomit. Let the horror start
				if(prob(25))
					to_chat(src, span_warning("The stench of rotting carcasses is unbearable!"))
					SEND_SIGNAL(src, COMSIG_ADD_MOOD_EVENT, "smell", /datum/mood_event/disgust/nauseating_stench)
					vomit()
			else
				SEND_SIGNAL(src, COMSIG_CLEAR_MOOD_EVENT, "smell")

	//Clear all moods if no miasma at all
	else
		SEND_SIGNAL(src, COMSIG_CLEAR_MOOD_EVENT, "smell")

	breath.garbage_collect()

	//BREATH TEMPERATURE
	check_breath_temperature(breath, lung_efficiency, lungs, lung_process)
	// remember to exhale too!
	check_exhale(breath, lung_efficiency, lungs, lung_process)

	return TRUE

/mob/living/carbon/proc/check_exhale(datum/gas_mixture/breath, lung_efficiency = 0, list/lungs, datum/organ_process/lung_process)
	if(!breath)
		return
	loc.assume_air(breath)
	air_update_turf(FALSE, FALSE)

/mob/living/carbon/proc/check_failed_breath(datum/gas_mixture/breath, lung_efficiency = 0, list/lungs, datum/organ_process/lung_process)
	if(get_chem_effect(CE_OXYGENATED))
		return FALSE
	if(get_chem_effect(CE_STABLE) && lung_efficiency)
		return FALSE
	if(prob(20))
		agony_gasp()
	adjustOxyLoss(1)

	failed_last_breath = TRUE
	throw_alert("cant_breathe", /atom/movable/screen/alert/cant_breathe)

//Fourth and final link in a breath chain
/mob/living/carbon/proc/check_breath_temperature(datum/gas_mixture/breath, lung_efficiency, list/lungs, datum/organ_process/lung_process)
	// The air you breathe out should match your body temperature
	breath.temperature = bodytemperature


code:
//this is to ensure gibbing drops the chest, which i think is cool
/mob/living/carbon/spread_bodyparts()
	. = ..()
	var/obj/item/bodypart/chest = get_bodypart_nostump(BODY_ZONE_CHEST)
	if(chest)
		chest.drop_limb(TRUE)
		chest.throw_at(get_edge_target_turf(src,pick(GLOB.alldirs)),rand(1,3),5)

/mob/living/carbon/spill_organs(no_brain, no_organs, no_bodyparts)
	for(var/obj/item/organ/organ in internal_organs)
		organ.layer = initial(organ.layer)
		organ.plane = initial(organ.plane)
		organ.mouse_opacity = initial(organ.mouse_opacity)
		if(organ.maptext)
			organ.maptext = ""
	return ..()

/mob/living/carbon/death(gibbed)
	. = ..()
	// We're dead - We can't have a pulse!
	pulse = PULSE_NONE
	for(var/thing in getorganslotlist(ORGAN_SLOT_HEART))
		var/obj/item/organ/heart/heart = thing
		heart.Stop()
	// Shit yourself
	if(!QDELETED(src))
		if(prob(80))
			shit(FALSE)
		if(prob(80))
			piss(FALSE)

/mob/living/carbon/revive(full_heal, admin_revive, excess_healing)
	. = ..()
	// We are alive - We need our pulse back!
	set_heartattack(FALSE)