code:
/obj/item/bodypart/head
	name = "head"
	desc = "Didn't make sense not to live for fun, your brain gets smart but your head gets dumb."
	icon_state = "default_human_head"
	max_damage = 75
	max_stamina_damage = 75
	parent_body_zone = BODY_ZONE_PRECISE_NECK
	body_zone = BODY_ZONE_HEAD
	body_part = HEAD
	w_class = WEIGHT_CLASS_BULKY // Quite a hefty load
	slowdown = 1 // Balancing measure
	px_x = 0
	px_y = -8
	stam_damage_coeff = 1
	limb_flags = (BODYPART_EDIBLE|BODYPART_NO_STUMP|BODYPART_HAS_BONE|BODYPART_HAS_TENDON|BODYPART_HAS_NERVE|BODYPART_HAS_ARTERY) //stump should be handled by the neck
	children_zones = list(BODY_ZONE_PRECISE_R_EYE, BODY_ZONE_PRECISE_L_EYE, BODY_ZONE_PRECISE_FACE, BODY_ZONE_PRECISE_MOUTH)
	gender_rendering = TRUE

	max_cavity_item_size = WEIGHT_CLASS_SMALL
	max_cavity_volume = 6

	hit_modifier = -3
	hit_zone_modifier = -2

	cavity_name = "cranial cavity"
	amputation_point_name = "neck"
	bone_type = BONE_HEAD
	tendon_type = TENDON_HEAD
	artery_type = ARTERY_HEAD
	nerve_type = NERVE_HEAD

	throw_range = 3 //bowling
	maxdam_wound_penalty = 20 //somewhat hard to hit this cap, better of trying to hit the neck
	dismemberment_sounds = list(
		'modular_septic/sound/gore/head_explodie1.ogg',
		'modular_septic/sound/gore/head_explodie2.ogg',
		'modular_septic/sound/gore/head_explodie3.ogg',
		'modular_septic/sound/gore/head_explodie4.ogg',
	)

	/// Left eye
	var/obj/item/bodypart/l_eyesocket/left_eye
	/// Right eye
	var/obj/item/bodypart/r_eyesocket/right_eye
	/// Face
	var/obj/item/bodypart/face/face
	/// Jaw
	var/obj/item/bodypart/mouth/jaw

	// ~limb appearance info
	/// Hair colour and style
	var/hair_color = "000000"
	var/hairstyle = "Bald"
	var/hair_alpha = 255

/obj/item/bodypart/head/Destroy()
	QDEL_NULL(face)
	return ..()

/obj/item/bodypart/head/on_rotten_trait_gain(obj/item/bodypart/source)
	. = ..()
	if(owner && !HAS_TRAIT_FROM(owner, TRAIT_DISFIGURED, GERM_LEVEL))
		ADD_TRAIT(owner, TRAIT_DISFIGURED, GERM_LEVEL)

/obj/item/bodypart/head/on_rotten_trait_loss(obj/item/bodypart/source)
	. = ..()
	if(owner && HAS_TRAIT_FROM(owner, TRAIT_DISFIGURED, GERM_LEVEL))
		REMOVE_TRAIT(owner, TRAIT_DISFIGURED, GERM_LEVEL)

/obj/item/bodypart/head/dismember(dam_type = BRUTE, silent = TRUE, destroy = FALSE, wounding_type = WOUND_SLASH)
	var/obj/item/bodypart/chungus = owner?.get_bodypart(parent_body_zone)
	if(chungus)
		return chungus.dismember(dam_type, silent, destroy, wounding_type)
	else
		return ..()

/obj/item/bodypart/head/handle_atom_del(atom/A)
	if(A == left_eye)
		left_eye = null
		if(!owner)
			update_icon_dropped()
	if(A == right_eye)
		right_eye = null
		if(!owner)
			update_icon_dropped()
	if(A == face)
		face = null
		if(!owner)
			update_icon_dropped()
	if(A == jaw)
		jaw = null
		if(!owner)
			update_icon_dropped()
	return ..()

/obj/item/bodypart/head/surgical_examine(mob/user)
	. = ..()
	if(is_organic_limb())
		if(!brain)
			. += span_info("The brain has been removed from [src].")
		else if(brainmob?.health <= HEALTH_THRESHOLD_DEAD)
			. += span_info("[p_theyre(TRUE)] leaking some kind of clear fluid.")
		else if(brainmob)
			if(brainmob.key || brainmob.get_ghost(FALSE, TRUE))
				. += span_info("[p_theyre(TRUE)] muscles are twitching slightly... It seems to have some life still in it.")
			else
				. += span_info("[p_theyre(TRUE)] completely lifeless. Perhaps there'll be a chance for them later.")
		else if(brain?.decoy_override)
			. += span_info("[p_theyre(TRUE)] completely lifeless. Perhaps there'll be a chance for them later.")
		else
			. += span_info("[p_theyre(TRUE)] completely lifeless.")

	if(!face)
		. += span_info("[face?.real_name ? face.real_name : p_they(TRUE)] [p_have()] no face.")
	if(!left_eye)
		. += span_info("[face?.real_name ? face.real_name : p_they(TRUE)] [p_have()] no left eye.")
	if(!right_eye)
		. += span_info("[face?.real_name ? face.real_name : p_they(TRUE)] [p_have()] no right eye.")
	if(!jaw)
		. += span_info("[face?.real_name ? face.real_name : p_they(TRUE)] [p_have()] no jaw.")

/obj/item/bodypart/head/attach_limb(mob/living/carbon/new_owner, special = FALSE, ignore_parent = FALSE)
	// These are stored before calling super. This is so that if the head is from a different body, it persists its appearance.
	var/hair_color = src.hair_color
	var/hairstyle = src.hairstyle

	. = ..()
	if(!.)
		return

	if(right_eye)
		right_eye = null
	if(left_eye)
		left_eye = null
	if(face)
		face = null
	if(jaw)
		jaw = null

	if(ishuman(new_owner))
		var/mob/living/carbon/human/human_owner = new_owner
		human_owner.hair_color = hair_color
		human_owner.hairstyle = hairstyle

	if(!(new_owner.status_flags & BUILDING_ORGANS))
		new_owner.updatehealth()
		new_owner.update_body()
		new_owner.update_hair()
		new_owner.update_damage_overlays()

/obj/item/bodypart/head/drop_organs(mob/user, violent_removal)
	. = ..()
	right_eye = null
	left_eye = null
	face = null
	jaw = null

/obj/item/bodypart/head/drop_limb(special, dismembered, ignore_children, destroyed, wounding_type = WOUND_SLASH)
	if(!special)
		//Drop all worn head items
		for(var/X in list(owner.glasses, owner.ears, owner.head))
			var/obj/item/worn_item = X
			owner.dropItemToGround(worn_item, force = TRUE)

	for(var/creamtype in GLOB.creamed_types)
		qdel(owner.GetComponent(creamtype))

	//Make sure de-zombification happens before organ removal instead of during it
	var/oozes = owner.getorganslotlist(ORGAN_SLOT_ZOMBIE)
	for(var/obj/item/organ/ooze as anything in oozes)
		ooze.transfer_to_limb(src, owner)

	return ..()

/obj/item/bodypart/head/update_limb(dropping_limb, mob/living/carbon/source)
	. = ..()
	if(!owner)
		name = initial(name)
		for(var/obj/item/bodypart/face/noface in src)
			if(noface.real_name)
				name = "[noface.real_name]'s head"
				break
	else
		name = initial(name)

	if(istype(loc, /obj/item/bodypart/neck))
		var/obj/item/bodypart/neck/neck = loc
		neck.update_limb(dropping_limb, source)

	if(no_update)
		return

	var/mob/living/carbon/carbon
	if(source)
		carbon = source
	else
		carbon = owner

	if(carbon)
		if(HAS_TRAIT(carbon, TRAIT_HUSK) || HAS_TRAIT(src, TRAIT_HUSK))
			hairstyle = "Bald"
			hair_color = "000000"
			hair_alpha = initial(hair_alpha)
		else if(!animal_origin && advanced_rendering)
			var/mob/living/carbon/human/human = carbon
			var/datum/species/species = human.dna.species

			// hair
			if(human.hairstyle && (HAIR in species.species_traits))
				hairstyle = human.hairstyle
				if(species.hair_color)
					if(species.hair_color == "mutcolor")
						hair_color = human.dna.features["mcolor"]
					else if(hair_color == "fixedmutcolor")
						hair_color = "#[species.fixed_mut_color]"
					else
						hair_color = species.hair_color
				else
					hair_color = human.hair_color
				hair_alpha = species.hair_alpha
			else
				hairstyle = "Bald"
				hair_color = "000000"
				hair_alpha = initial(hair_alpha)

/obj/item/bodypart/head/get_limb_icon(dropped)
	. = ..()
	if(!dropped)
		return

	if(advanced_rendering) //having a robotic head hides certain features
		// hair
		if(hairstyle)
			var/datum/sprite_accessory/S = GLOB.hairstyles_list[hairstyle]
			if(S)
				var/image/hair_overlay = image(S.icon, "[S.icon_state]", -HAIR_LAYER, SOUTH)
				hair_overlay.color = "#" + hair_color
				hair_overlay.alpha = hair_alpha
				. += hair_overlay
	if(jaw)
		// lipstick
		if(jaw.lip_style)
			var/image/lips_overlay = image('modular_septic/icons/mob/human/sprite_accessory/human_face.dmi', "lips_[jaw.lip_style]", -BODY_LAYER, SOUTH)
			lips_overlay.color = jaw.lip_color
			. += lips_overlay
		// facial hair
		if(jaw.facial_hairstyle)
			var/datum/sprite_accessory/S2 = GLOB.facial_hairstyles_list[jaw.facial_hairstyle]
			if(S2)
				var/image/facial_overlay = image(S2.icon, "[S2.icon_state]", -HAIR_LAYER, SOUTH)
				facial_overlay.color = "#" + jaw.facial_hair_color
				facial_overlay.alpha = jaw.hair_alpha
				. += facial_overlay

	// eyes
	var/image/left_eye_overlay
	var/image/right_eye_overlay
	var/obj/item/organ/eyes/actual_left_eye = locate(/obj/item/organ/eyes) in left_eye
	var/obj/item/organ/eyes/actual_right_eye = locate(/obj/item/organ/eyes) in right_eye
	if(actual_left_eye)
		left_eye_overlay = image('modular_septic/icons/mob/human/sprite_accessory/human_face.dmi', null, actual_left_eye.eye_icon_state, -BODY_LAYER)
		left_eye_overlay.color = actual_left_eye.eye_color
	else
		left_eye_overlay = image('modular_septic/icons/mob/human/sprite_accessory/human_face.dmi', null, "eye-left-missing", -BODY_LAYER)

	if(actual_right_eye)
		right_eye_overlay = image('modular_septic/icons/mob/human/sprite_accessory/human_face.dmi', null, actual_right_eye.eye_icon_state, -BODY_LAYER)
		right_eye_overlay.color = actual_right_eye.eye_color
	else
		right_eye_overlay = image('modular_septic/icons/mob/human/sprite_accessory/human_face.dmi', null, "eye-right-missing", -BODY_LAYER)

	if(ishuman(owner) && (OFFSET_HEAD in owner.dna.species.offset_features))
		left_eye_overlay.pixel_x += owner.dna.species.offset_features[OFFSET_HEAD][1]
		left_eye_overlay.pixel_y += owner.dna.species.offset_features[OFFSET_HEAD][2]
		right_eye_overlay.pixel_x += owner.dna.species.offset_features[OFFSET_HEAD][1]
		right_eye_overlay.pixel_y += owner.dna.species.offset_features[OFFSET_HEAD][2]

	. += left_eye_overlay
	. += right_eye_overlay

	//face
	if(!face)
		. += image('modular_septic/icons/mob/human/sprite_accessory/human_face.dmi', null, "face_missing", -BODY_LAYER)
	//jaw
	if(!jaw)
		. += image('modular_septic/icons/mob/human/sprite_accessory/human_face.dmi', null, "lips_missing", -BODY_LAYER)
	//tape gag
	else if(jaw.tapered)
		. += image('modular_septic/icons/mob/human/overlays/tapegag.dmi', null, "tapegag", -UPPER_MEDICINE_LAYER)


code:
/obj/item/bodypart/l_leg/digitigrade
	name = "left digitigrade leg"
	use_digitigrade = FULL_DIGITIGRADE

repo_name: AnalWerewolf/sundown

license: mit


code:
/obj/item/bodypart/l_arm
	name = "left arm"
	desc = "The word 'sinister' stems originally from the \
		Latin 'sinestra' (left hand), because the left hand was supposed to \
		be possessed by the devil. This arm appears to be possessed by no \
		one though."
	icon_state = "default_human_l_arm"
	attack_verb_continuous = list("slaps")
	attack_verb_simple = list("slap")
	max_damage = 50
	max_stamina_damage = 50
	parent_body_zone = BODY_ZONE_CHEST
	body_zone = BODY_ZONE_L_ARM
	body_part = ARM_LEFT
	px_x = -6
	px_y = 0
	stam_heal_tick = 1

	children_zones = list(BODY_ZONE_PRECISE_L_HAND)
	max_cavity_item_size = WEIGHT_CLASS_SMALL
	max_cavity_volume = 3

	hit_modifier = -1
	hit_zone_modifier = 0

	amputation_point_name = "left shoulder"
	bone_type = BONE_L_ARM
	tendon_type = TENDON_L_ARM
	artery_type = ARTERY_L_ARM
	nerve_type = NERVE_L_ARM

/obj/item/bodypart/l_arm/set_owner(new_owner)
	. = ..()
	if(. == FALSE)
		return
	if(owner)
		if(HAS_TRAIT(owner, TRAIT_PARALYSIS_L_ARM))
			ADD_TRAIT(src, TRAIT_PARALYSIS, TRAIT_PARALYSIS_L_ARM)
			RegisterSignal(owner, SIGNAL_REMOVETRAIT(TRAIT_PARALYSIS_L_ARM), .proc/on_owner_paralysis_loss)
		else
			REMOVE_TRAIT(src, TRAIT_PARALYSIS, TRAIT_PARALYSIS_L_ARM)
			RegisterSignal(owner, SIGNAL_ADDTRAIT(TRAIT_PARALYSIS_L_ARM), .proc/on_owner_paralysis_gain)
	if(.)
		var/mob/living/carbon/old_owner = .
		if(HAS_TRAIT(old_owner, TRAIT_PARALYSIS_L_ARM))
			UnregisterSignal(old_owner, SIGNAL_REMOVETRAIT(TRAIT_PARALYSIS_L_ARM))
			if(!owner || !HAS_TRAIT(owner, TRAIT_PARALYSIS_L_ARM))
				REMOVE_TRAIT(src, TRAIT_PARALYSIS, TRAIT_PARALYSIS_L_ARM)
		else
			UnregisterSignal(old_owner, SIGNAL_ADDTRAIT(TRAIT_PARALYSIS_L_ARM))

///Proc to react to the owner gaining the TRAIT_PARALYSIS_L_ARM trait.
/obj/item/bodypart/l_arm/proc/on_owner_paralysis_gain(mob/living/carbon/source)
	SIGNAL_HANDLER
	ADD_TRAIT(src, TRAIT_PARALYSIS, TRAIT_PARALYSIS_L_ARM)
	UnregisterSignal(owner, SIGNAL_ADDTRAIT(TRAIT_PARALYSIS_L_ARM))
	RegisterSignal(owner, SIGNAL_REMOVETRAIT(TRAIT_PARALYSIS_L_ARM), .proc/on_owner_paralysis_loss)

///Proc to react to the owner losing the TRAIT_PARALYSIS_L_ARM trait.
/obj/item/bodypart/l_arm/proc/on_owner_paralysis_loss(mob/living/carbon/source)
	SIGNAL_HANDLER
	REMOVE_TRAIT(src, TRAIT_PARALYSIS, TRAIT_PARALYSIS_L_ARM)
	UnregisterSignal(owner, SIGNAL_REMOVETRAIT(TRAIT_PARALYSIS_L_ARM))
	RegisterSignal(owner, SIGNAL_ADDTRAIT(TRAIT_PARALYSIS_L_ARM), .proc/on_owner_paralysis_gain)


code:
/obj/item/bodypart/l_eyesocket
	name = "left eyesocket"
	desc = "Sightless, until the eyes reappear."
	icon = 'modular_septic/icons/obj/surgery.dmi'
	icon_state = "eyelid"
	base_icon_state = "eyelid"
	attack_verb_continuous = list("looks at", "sees")
	attack_verb_simple = list("look at", "see")
	parent_body_zone = BODY_ZONE_HEAD
	body_zone = BODY_ZONE_PRECISE_L_EYE
	body_part = EYE_LEFT
	limb_flags = (BODYPART_EDIBLE|BODYPART_NO_STUMP|BODYPART_HAS_TENDON|BODYPART_HAS_NERVE|BODYPART_HAS_ARTERY)
	sight_index = 1
	w_class = WEIGHT_CLASS_TINY
	max_damage = 30
	max_stamina_damage = 30
	wound_resistance = -10
	maxdam_wound_penalty = 5
	stam_heal_tick = 1

	hit_modifier = -4
	hit_zone_modifier = -2

	max_cavity_item_size = WEIGHT_CLASS_TINY
	max_cavity_volume = 2

	throw_range = 7
	scars_covered_by_clothes = FALSE
	dismemberment_sounds = list('modular_septic/sound/gore/severed.ogg')

	cavity_name = "orbital cavity"
	amputation_point_name = "orbit"
	tendon_type = TENDON_L_EYE
	artery_type = ARTERY_L_EYE
	nerve_type = NERVE_L_EYE

/obj/item/bodypart/l_eyesocket/get_limb_icon(dropped)
	icon_state = ""
	if(dropped && !isbodypart(loc))
		. = list()
		var/image/funky_anus = image('modular_septic/icons/obj/surgery.dmi', src, base_icon_state, BELOW_MOB_LAYER)
		funky_anus.plane = plane
		if(is_robotic_limb())
			funky_anus.icon_state = "[funky_anus.icon_state]-c"
		funky_anus.transform = matrix(-1, 0, 0, 0, 1, 0) //mirroring
		. += funky_anus
		for(var/obj/item/organ/eyes/eye in src)
			var/image/eye_under
			var/image/iris
			eye_under = image(eye.icon, src, eye.icon_state, BELOW_MOB_LAYER-0.02)
			eye_under.transform = matrix(-1, 0, 0, 0, 1, 0)
			if(eye.iris_icon_state)
				iris = image(eye.icon, src, "eye-iris", BELOW_MOB_LAYER-0.01)
				iris.transform = matrix(-1, 0, 0, 0, 1, 0) //mirroring
				iris.color = eye.eye_color || eye.old_eye_color
			. += eye_under
			if(iris)
				. += iris
			break

/obj/item/bodypart/l_eyesocket/transfer_to_limb(obj/item/bodypart/new_limb, mob/living/carbon/was_owner)
	. = ..()
	if(istype(new_limb, /obj/item/bodypart/head))
		var/obj/item/bodypart/head/head = new_limb
		head.left_eye = src


code:
/obj/item/bodypart/l_foot
	name = "left foot"
	desc = "Seems like left has taken another meaning here."
	icon_state = "default_human_r_foot"
	attack_verb_continuous = list("kicks", "stomps")
	attack_verb_simple = list("kick", "stomp")
	parent_body_zone = BODY_ZONE_L_LEG
	body_zone = BODY_ZONE_PRECISE_L_FOOT
	body_part = FOOT_LEFT
	max_damage = 30
	max_stamina_damage = 30
	stance_index = 3
	px_x = -2
	px_y = 9
	stam_heal_tick = 1

	max_cavity_item_size = WEIGHT_CLASS_TINY
	max_cavity_volume = 2.5

	hit_modifier = -2
	hit_zone_modifier = -1

	amputation_point_name = "left ankle"
	bone_type = BONE_L_FOOT
	tendon_type = TENDON_L_FOOT
	artery_type = ARTERY_L_FOOT
	nerve_type = NERVE_L_FOOT

/obj/item/bodypart/l_foot/drop_limb(special, dismembered, ignore_children, destroyed, wounding_type)
	if(owner && !special)
		if(owner.legcuffed)
			owner.legcuffed.forceMove(owner.drop_location())
			owner.legcuffed.dropped(owner)
			owner.legcuffed = null
			owner.update_inv_legcuffed()
		if(owner.shoes)
			owner.dropItemToGround(owner.shoes, TRUE)
	return ..()


code:
/obj/item/bodypart/l_hand
	name = "left hand"
	desc = "In old english, left meant weak, guess they were onto something if you're finding this."
	icon_state = "default_human_l_hand"
	attack_verb_continuous = list("slaps", "punches")
	attack_verb_simple = list("slap", "punch")
	parent_body_zone = BODY_ZONE_L_ARM
	body_zone = BODY_ZONE_PRECISE_L_HAND
	body_part = HAND_LEFT
	render_layer = HANDS_PART_LAYER
	max_damage = 30
	max_stamina_damage = 30
	held_index = 1
	px_x = -6
	px_y = -3
	stam_heal_tick = 1

	max_cavity_item_size = WEIGHT_CLASS_TINY
	max_cavity_volume = 2.5

	hit_modifier = -2
	hit_zone_modifier = -1

	amputation_point_name = "left wrist"
	bone_type = BONE_L_HAND
	tendon_type = TENDON_L_HAND
	artery_type = ARTERY_L_HAND
	nerve_type = NERVE_L_HAND

/obj/item/bodypart/l_hand/drop_limb(special, dismembered, ignore_children, destroyed, wounding_type = WOUND_SLASH)
	var/mob/living/carbon/C = owner
	. = ..()
	if(C && !special)
		if(C.handcuffed)
			C.handcuffed.forceMove(drop_location())
			C.handcuffed.dropped(C)
			C.set_handcuffed(null)
			C.update_handcuffed()
		if(C.gloves)
			C.dropItemToGround(C.gloves, TRUE)
		C.update_inv_gloves() //to remove the bloody hands overlay


code:
/obj/item/bodypart/l_leg
	name = "left leg"
	desc = "Some athletes prefer to tie their left shoelaces first for good \
		luck. In this instance, it probably would not have helped."
	icon_state = "default_human_l_leg"
	attack_verb_continuous = list("kicks", "stomps")
	attack_verb_simple = list("kick", "stomp")
	parent_body_zone = BODY_ZONE_PRECISE_GROIN
	body_zone = BODY_ZONE_L_LEG
	body_part = LEG_LEFT
	max_damage = 50
	max_stamina_damage = 50
	stance_index = 1
	px_x = -2
	px_y = 12
	stam_heal_tick = 1

	children_zones = list(BODY_ZONE_PRECISE_L_FOOT)
	max_cavity_item_size = WEIGHT_CLASS_SMALL
	max_cavity_volume = 3

	hit_modifier = -1
	hit_zone_modifier = 0

	amputation_point_name = "left hip"
	bone_type = BONE_L_LEG
	tendon_type = TENDON_L_LEG
	artery_type = ARTERY_L_LEG
	nerve_type = NERVE_L_LEG

/obj/item/bodypart/l_leg/set_owner(new_owner)
	. = ..()
	if(. == FALSE)
		return
	if(owner)
		if(HAS_TRAIT(owner, TRAIT_PARALYSIS_L_LEG))
			ADD_TRAIT(src, TRAIT_PARALYSIS, TRAIT_PARALYSIS_L_LEG)
			RegisterSignal(owner, SIGNAL_REMOVETRAIT(TRAIT_PARALYSIS_L_LEG), .proc/on_owner_paralysis_loss)
		else
			REMOVE_TRAIT(src, TRAIT_PARALYSIS, TRAIT_PARALYSIS_L_LEG)
			RegisterSignal(owner, SIGNAL_ADDTRAIT(TRAIT_PARALYSIS_L_LEG), .proc/on_owner_paralysis_gain)
	if(.)
		var/mob/living/carbon/old_owner = .
		if(HAS_TRAIT(old_owner, TRAIT_PARALYSIS_L_LEG))
			UnregisterSignal(old_owner, SIGNAL_REMOVETRAIT(TRAIT_PARALYSIS_L_LEG))
			if(!owner || !HAS_TRAIT(owner, TRAIT_PARALYSIS_L_LEG))
				REMOVE_TRAIT(src, TRAIT_PARALYSIS, TRAIT_PARALYSIS_L_LEG)
		else
			UnregisterSignal(old_owner, SIGNAL_ADDTRAIT(TRAIT_PARALYSIS_L_LEG))

///Proc to react to the owner gaining the TRAIT_PARALYSIS_L_LEG trait.
/obj/item/bodypart/l_leg/proc/on_owner_paralysis_gain(mob/living/carbon/source)
	SIGNAL_HANDLER
	ADD_TRAIT(src, TRAIT_PARALYSIS, TRAIT_PARALYSIS_L_LEG)
	UnregisterSignal(owner, SIGNAL_ADDTRAIT(TRAIT_PARALYSIS_L_LEG))
	RegisterSignal(owner, SIGNAL_REMOVETRAIT(TRAIT_PARALYSIS_L_LEG), .proc/on_owner_paralysis_loss)

///Proc to react to the owner losing the TRAIT_PARALYSIS_L_LEG trait.
/obj/item/bodypart/l_leg/proc/on_owner_paralysis_loss(mob/living/carbon/source)
	SIGNAL_HANDLER
	REMOVE_TRAIT(src, TRAIT_PARALYSIS, TRAIT_PARALYSIS_L_LEG)
	UnregisterSignal(owner, SIGNAL_REMOVETRAIT(TRAIT_PARALYSIS_L_LEG))
	RegisterSignal(owner, SIGNAL_ADDTRAIT(TRAIT_PARALYSIS_L_LEG), .proc/on_owner_paralysis_gain)


code:
/obj/item/bodypart/mouth
	name = "jaw"
	desc = "I have no mouth and i must scream."
	icon = 'modular_septic/icons/obj/surgery.dmi'
	icon_state = "jaw"
	base_icon_state = "jaw"
	attack_verb_continuous = list("bites", "munches")
	attack_verb_simple = list("bite", "munch")
	parent_body_zone = BODY_ZONE_HEAD
	body_zone = BODY_ZONE_PRECISE_MOUTH
	body_part = JAW
	limb_flags = (BODYPART_EDIBLE|BODYPART_NO_STUMP|BODYPART_HAS_BONE|BODYPART_HAS_TENDON|BODYPART_HAS_NERVE|BODYPART_HAS_ARTERY)
	max_damage = 30
	max_stamina_damage = 30
	wound_resistance = -5
	maxdam_wound_penalty = 10 // too easy to hit max damage
	stam_heal_tick = 1

	max_teeth = 32

	max_cavity_item_size = WEIGHT_CLASS_SMALL
	max_cavity_volume = 2.5

	hit_modifier = -2
	hit_zone_modifier = -1

	throw_range = 5
	dismemberment_sounds = list('modular_septic/sound/gore/severed.ogg')
	scars_covered_by_clothes = FALSE

	cavity_name = "oral cavity"
	amputation_point_name = "face"
	bone_type = BONE_MOUTH
	tendon_type = TENDON_MOUTH
	artery_type = ARTERY_MOUTH
	nerve_type = NERVE_MOUTH

	/// Sticky tape muting us
	var/obj/item/stack/sticky_tape/tapered = null

	///Facial hair colour and style
	var/facial_hair_color = "000000"
	var/facial_hairstyle = "Shaved"
	var/hair_alpha = 255

	///Lips
	var/lip_style = null
	var/lip_color = "white"
	var/stored_lipstick_trait

/obj/item/bodypart/mouth/Initialize()
	. = ..()
	//Add TEETH.
	fill_teeth()

/obj/item/bodypart/mouth/get_limb_icon(dropped)
	icon_state = ""
	if(dropped && !isbodypart(loc))
		. = list()
		var/image/funky_anus = image('modular_septic/icons/obj/surgery.dmi', src, base_icon_state, BELOW_MOB_LAYER)
		funky_anus.plane = plane
		if(is_robotic_limb())
			funky_anus.icon_state = "[funky_anus.icon_state]-c"
		. += funky_anus

/obj/item/bodypart/mouth/attach_limb(mob/living/carbon/new_owner, special, ignore_parent = FALSE)
	. = ..()
	//Handle teeth and tape stuff
	if(!.)
		return
	if(tapered)
		ADD_TRAIT(owner, TRAIT_MUTE, "tape")
	if(teeth_mod)
		teeth_mod.add_speech_modifier(new_owner)

/obj/item/bodypart/mouth/drop_limb(special, ignore_children, dismembered, destroyed, wounding_type)
	var/mob/living/carbon/was_owner = owner
	. = ..()
	//Handle teeth and tape stuff
	if(!.)
		return
	if(tapered)
		REMOVE_TRAIT(was_owner, TRAIT_MUTE, "tape")
	if(teeth_mod)
		teeth_mod.remove_speech_modifier()
	//Handle dental implants
	for(var/datum/action/item_action/hands_free/activate_pill/AP in was_owner.actions)
		AP.Remove(owner)
		var/obj/pill = AP.target
		if(pill)
			pill.forceMove(src)

/obj/item/bodypart/mouth/update_limb(dropping_limb, mob/living/carbon/source)
	. = ..()
	if(istype(loc, /obj/item/bodypart/face))
		var/obj/item/bodypart/face/face = loc
		face.update_limb(dropping_limb, source)

	if(no_update)
		return

	var/mob/living/carbon/carbon
	if(source)
		carbon = source
	else
		carbon = owner

	if(carbon)
		if(HAS_TRAIT(carbon, TRAIT_HUSK) || HAS_TRAIT(src, TRAIT_HUSK))
			facial_hairstyle = "Shaved"
			facial_hair_color = "000000"
			hair_alpha = initial(hair_alpha)
			lip_style  = null
			stored_lipstick_trait = null
		else if(!animal_origin && advanced_rendering)
			var/mob/living/carbon/human/human = carbon
			var/datum/species/species = human.dna.species

			// facial hair
			if(human.facial_hairstyle && (FACEHAIR in species.species_traits))
				facial_hairstyle = human.facial_hairstyle
				facial_hair_color = human.dna.features["mcolor"]
				hair_alpha = species.hair_alpha
			else
				facial_hairstyle = "Shaved"
				facial_hair_color = "000000"
				hair_alpha = initial(hair_alpha)

/obj/item/bodypart/mouth/transfer_to_limb(obj/item/bodypart/new_limb, mob/living/carbon/was_owner)
	. = ..()
	if(istype(new_limb, /obj/item/bodypart/face))
		var/obj/item/bodypart/face/face = new_limb
		face.jaw = src

/obj/item/bodypart/mouth/get_teeth_amount()
	. = 0
	if(teeth_object)
		. += teeth_object.amount

/obj/item/bodypart/mouth/knock_out_teeth(amount = 1, throw_dir = SOUTH)
	//this is HORRIBLE but it prevents runtimes
	if(SSticker.current_state < GAME_STATE_PLAYING)
		return
	amount = clamp(amount, 0, max_teeth)
	if(!amount)
		return
	if(teeth_object && teeth_object.amount)
		//No point in making many stacks because they get merged on the ground
		var/drop = min(teeth_object.amount, amount)
		if(!drop)
			return
		for(var/y in 1 to drop)
			if(QDELETED(teeth_object) || !teeth_object.use(1))
				break
			var/obj/item/stack/teeth/dropped_teeth = new teeth_object.type(get_turf(owner), 1, FALSE)
			dropped_teeth.add_mob_blood(owner)
			dropped_teeth.amount = 1
			var/range = clamp(round(amount/2), rand(0,1), 3)
			var/turf/target_turf = get_ranged_target_turf(dropped_teeth, throw_dir, range)
			INVOKE_ASYNC(dropped_teeth, /atom/movable.proc/throw_at, target_turf, range, rand(1,3))
			INVOKE_ASYNC(dropped_teeth, /obj/item/stack/teeth.proc/do_knock_out_animation, 5)
		if(teeth_mod)
			teeth_mod.update_lisp()
		else
			teeth_mod = new()
			if(owner)
				teeth_mod.add_speech_modifier(owner)
		if(owner)
			owner.Stun(2 SECONDS)
		return drop

/obj/item/bodypart/mouth/update_teeth()
	if(teeth_mod)
		teeth_mod.update_lisp()
	else
		if(get_teeth_amount() < max_teeth)
			teeth_mod = new()
			teeth_mod.add_speech_modifier(owner)
	update_limb_efficiency()
	return TRUE

/obj/item/bodypart/mouth/Topic(href, href_list)
	. = ..()
	if(href_list["tape"])
		var/mob/living/carbon/C = usr
		if(!istype(C) || !C.canUseTopic(owner, TRUE, FALSE, FALSE, TRUE, FALSE) || owner?.wear_mask || DOING_INTERACTION_WITH_TARGET(C, owner))
			return
		if(C == owner)
			owner.visible_message(span_warning("[owner] desperately tries to rip \the [tapered] from their mouth!"),
								span_warning("You desperately try to rip \the [tapered] from your mouth!"))
			if(do_mob(owner, owner, 3 SECONDS))
				tapered.forceMove(get_turf(owner))
				tapered = null
				owner.visible_message(span_warning("[owner] rips \the [tapered] from their mouth!"),
									span_warning("You successfully remove \the [tapered] from your mouth!"))
				playsound(owner, 'modular_septic/sound/effects/clothripping.ogg', 40, 0, -4)
				owner.emote("scream")
				REMOVE_TRAIT(owner, TRAIT_MUTE, "tape")
			else
				to_chat(owner, span_warning("You fail to take \the [tapered] off."))
		else
			if(do_mob(C, owner, 1.5 SECONDS))
				owner.UnregisterSignal(tapered, COMSIG_MOB_SAY)
				tapered.forceMove(get_turf(owner))
				tapered = null
				C.visible_message(span_warning("[C] rips \the [tapered] from [owner]'s mouth!"),
								span_warning("You rip \the [tapered] out of [owner]'s mouth!"))
				playsound(owner, 'modular_septic/sound/effects/clothripping.ogg', 40, 0, -4)
				if(owner)
					owner.emote("scream")
					REMOVE_TRAIT(owner, TRAIT_MUTE, "tape")
			else
				to_chat(usr, span_warning("You fail to take \the [tapered] off."))
		update_limb(!owner)

/obj/item/bodypart/mouth/proc/get_stickied(obj/item/stack/sticky_tape/tape, mob/user)
	if(!tape || tapered)
		return
	if(tape.use(1))
		if(user && owner)
			if(user == owner)
				owner.visible_message(span_danger("[user] tapes [owner.p_their()] own [name] shut with \the [tape]!"), \
					span_userdanger("You tape your [name] shut with \the [tape]!"))
			else
				owner.visible_message(span_danger("[user] tapes [owner]'s [name] shut with \the [tape]!"), \
					span_userdanger("[user] tapes your [name] shut with \the [tape]!"), \
					ignored_mobs = user)
				to_chat(user, span_warning("You successfully gag [owner]'s [name] shut with \the [src]!"))
		else if(user)
			user.visible_message(span_warning("[user] tapes [name] shut."), \
					span_notice("You tape [name] shut."))
		tapered = new tape.type(owner)
		tapered.amount = 1
		if(owner)
			ADD_TRAIT(owner, TRAIT_MUTE, "tape")
	update_limb(!owner)


code:
/obj/item/bodypart/neck
	name = "neck"
	desc = "Whoever did this was a real cutthroat."
	icon = 'modular_septic/icons/obj/surgery.dmi'
	icon_state = "neck"
	base_icon_state = "neck"
	attack_verb_continuous = list("snaps")
	attack_verb_simple = list("snap")
	parent_body_zone = BODY_ZONE_CHEST
	children_zones = list(BODY_ZONE_HEAD)
	body_zone = BODY_ZONE_PRECISE_NECK
	body_part = NECK
	limb_flags = (BODYPART_EDIBLE|BODYPART_HAS_BONE|BODYPART_HAS_TENDON|BODYPART_HAS_NERVE|BODYPART_HAS_ARTERY)
	max_damage = 30
	max_stamina_damage = 30
	wound_resistance = -5
	maxdam_wound_penalty = 5 // too easy to hit max damage, too lethal
	stam_heal_tick = 1

	max_cavity_item_size = WEIGHT_CLASS_TINY
	max_cavity_volume = 2.5

	hit_modifier = -3
	hit_zone_modifier = -1

	throw_range = 3
	maxdam_wound_penalty = 10
	px_x = 0
	px_y = -8
	dismemberment_sounds = list(
		'modular_septic/sound/gore/head_explodie1.ogg',
		'modular_septic/sound/gore/head_explodie2.ogg',
		'modular_septic/sound/gore/head_explodie3.ogg',
		'modular_septic/sound/gore/head_explodie4.ogg',
	)

	cavity_name = "esophagus"
	amputation_point_name = "trachea"
	bone_type = BONE_NECK
	tendon_type = TENDON_NECK
	artery_type = ARTERY_NECK
	nerve_type = NERVE_NECK

/obj/item/bodypart/neck/get_limb_icon(dropped)
	icon_state = ""
	var/obj/item/bodypart/head/head = locate(/obj/item/bodypart/head) in src
	if(dropped && !isbodypart(loc))
		if(head)
			. = list()
			. |= head.get_limb_icon(dropped)
		else
			var/image/funky_anus = image(icon, src, base_icon_state, BELOW_MOB_LAYER)
			if(locate(/obj/item/organ/bone) in src)
				funky_anus.icon_state = "[base_icon_state]-bone"
			funky_anus.plane = plane
			if(is_robotic_limb())
				funky_anus.icon_state = "[funky_anus.icon_state]-c"
			. += funky_anus

/obj/item/bodypart/neck/update_limb(dropping_limb, mob/living/carbon/source)
	. = ..()
	if(!owner)
		name = initial(name)
		for(var/obj/item/bodypart/head/nohead in src)
			if(nohead.face)
				name = "[nohead.face.real_name]'s neck"
				break
	else
		name = initial(name)


code:
/obj/item/bodypart/r_leg/digitigrade
	name = "right digitigrade leg"
	use_digitigrade = FULL_DIGITIGRADE


code:
/obj/item/bodypart/r_arm
	name = "right arm"
	desc = "Over 87% of humans are right handed. That figure is much lower \
		among humans missing their right arm."
	icon_state = "default_human_r_arm"
	attack_verb_continuous = list("slaps")
	attack_verb_simple = list("slap")
	max_damage = 50
	max_stamina_damage = 50
	parent_body_zone = BODY_ZONE_CHEST
	body_zone = BODY_ZONE_R_ARM
	body_part = ARM_RIGHT
	px_x = 6
	px_y = 0
	stam_heal_tick = 1

	children_zones = list(BODY_ZONE_PRECISE_R_HAND)
	max_cavity_item_size = WEIGHT_CLASS_SMALL
	max_cavity_volume = 3

	hit_modifier = -1
	hit_zone_modifier = 0

	amputation_point_name = "left shoulder"
	bone_type = BONE_R_ARM
	tendon_type = TENDON_R_ARM
	artery_type = ARTERY_R_ARM
	nerve_type = NERVE_R_ARM

/obj/item/bodypart/r_arm/set_owner(new_owner)
	. = ..()
	if(. == FALSE)
		return
	if(owner)
		if(HAS_TRAIT(owner, TRAIT_PARALYSIS_R_ARM))
			ADD_TRAIT(src, TRAIT_PARALYSIS, TRAIT_PARALYSIS_R_ARM)
			RegisterSignal(owner, SIGNAL_REMOVETRAIT(TRAIT_PARALYSIS_R_ARM), .proc/on_owner_paralysis_loss)
		else
			REMOVE_TRAIT(src, TRAIT_PARALYSIS, TRAIT_PARALYSIS_R_ARM)
			RegisterSignal(owner, SIGNAL_ADDTRAIT(TRAIT_PARALYSIS_R_ARM), .proc/on_owner_paralysis_gain)
	if(.)
		var/mob/living/carbon/old_owner = .
		if(HAS_TRAIT(old_owner, TRAIT_PARALYSIS_R_ARM))
			UnregisterSignal(old_owner, SIGNAL_REMOVETRAIT(TRAIT_PARALYSIS_R_ARM))
			if(!owner || !HAS_TRAIT(owner, TRAIT_PARALYSIS_R_ARM))
				REMOVE_TRAIT(src, TRAIT_PARALYSIS, TRAIT_PARALYSIS_R_ARM)
		else
			UnregisterSignal(old_owner, SIGNAL_ADDTRAIT(TRAIT_PARALYSIS_R_ARM))

///Proc to react to the owner gaining the TRAIT_PARALYSIS_R_ARM trait.
/obj/item/bodypart/r_arm/proc/on_owner_paralysis_gain(mob/living/carbon/source)
	SIGNAL_HANDLER
	ADD_TRAIT(src, TRAIT_PARALYSIS, TRAIT_PARALYSIS_R_ARM)
	UnregisterSignal(owner, SIGNAL_ADDTRAIT(TRAIT_PARALYSIS_R_ARM))
	RegisterSignal(owner, SIGNAL_REMOVETRAIT(TRAIT_PARALYSIS_R_ARM), .proc/on_owner_paralysis_loss)

///Proc to react to the owner losing the TRAIT_PARALYSIS_R_ARM trait.
/obj/item/bodypart/r_arm/proc/on_owner_paralysis_loss(mob/living/carbon/source)
	SIGNAL_HANDLER
	REMOVE_TRAIT(src, TRAIT_PARALYSIS, TRAIT_PARALYSIS_R_ARM)
	UnregisterSignal(owner, SIGNAL_REMOVETRAIT(TRAIT_PARALYSIS_R_ARM))
	RegisterSignal(owner, SIGNAL_ADDTRAIT(TRAIT_PARALYSIS_R_ARM), .proc/on_owner_paralysis_gain)


code:
/obj/item/bodypart/r_eyesocket
	name = "right eyesocket"
	desc = "Sightless, until the eyes reappear."
	icon = 'modular_septic/icons/obj/surgery.dmi'
	icon_state = "eyelid"
	base_icon_state = "eyelid"
	attack_verb_continuous = list("looks at", "sees")
	attack_verb_simple = list("look at", "see")
	parent_body_zone = BODY_ZONE_HEAD
	body_zone = BODY_ZONE_PRECISE_R_EYE
	body_part = EYE_RIGHT
	limb_flags = (BODYPART_EDIBLE|BODYPART_NO_STUMP|BODYPART_HAS_TENDON|BODYPART_HAS_ARTERY|BODYPART_HAS_NERVE)
	sight_index = 2
	w_class = WEIGHT_CLASS_TINY
	max_damage = 30
	max_stamina_damage = 30
	wound_resistance = -10
	maxdam_wound_penalty = 5
	stam_heal_tick = 1

	hit_modifier = -4
	hit_zone_modifier = -2

	max_cavity_item_size = WEIGHT_CLASS_TINY
	max_cavity_volume = 2

	throw_range = 7
	scars_covered_by_clothes = FALSE
	dismemberment_sounds = list('modular_septic/sound/gore/severed.ogg')

	cavity_name = "orbital cavity"
	amputation_point_name = "orbit"
	tendon_type = TENDON_R_EYE
	artery_type = ARTERY_R_EYE
	nerve_type = NERVE_R_EYE

/obj/item/bodypart/r_eyesocket/get_limb_icon(dropped)
	icon_state = ""
	if(dropped && !isbodypart(loc))
		. = list()
		var/image/funky_anus = image('modular_septic/icons/obj/surgery.dmi', src, base_icon_state, BELOW_MOB_LAYER)
		funky_anus.plane = plane
		if(is_robotic_limb())
			funky_anus.icon_state = "[funky_anus.icon_state]-c"
		. += funky_anus
		for(var/obj/item/organ/eyes/eye in src)
			var/image/eye_under
			var/image/iris
			eye_under = image(eye.icon, src, eye.icon_state, BELOW_MOB_LAYER-0.02)
			if(eye.iris_icon_state)
				iris = image(eye.icon, src, "eye-iris", BELOW_MOB_LAYER-0.01)
				iris.color = eye.eye_color || eye.old_eye_color
			. += eye_under
			if(iris)
				. += iris
			break

/obj/item/bodypart/r_eyesocket/transfer_to_limb(obj/item/bodypart/new_limb, mob/living/carbon/was_owner)
	. = ..()
	if(istype(new_limb, /obj/item/bodypart/head))
		var/obj/item/bodypart/head/head = new_limb
		head.right_eye = src


code:
/obj/item/bodypart/r_foot
	name = "right foot"
	desc = "Equals roughly 30.48 centimeters."
	icon_state = "default_human_r_foot"
	attack_verb_continuous = list("kicks", "stomps")
	attack_verb_simple = list("kick", "stomp")
	parent_body_zone = BODY_ZONE_R_LEG
	body_zone = BODY_ZONE_PRECISE_R_FOOT
	body_part = FOOT_RIGHT
	max_damage = 30
	max_stamina_damage = 30
	stance_index = 4
	px_x = -2
	px_y = 9
	stam_heal_tick = 1

	max_cavity_item_size = WEIGHT_CLASS_TINY
	max_cavity_volume = 2.5

	hit_modifier = -2
	hit_zone_modifier = -1

	amputation_point_name = "left ankle"
	bone_type = BONE_R_FOOT
	tendon_type = TENDON_R_FOOT
	artery_type = ARTERY_R_FOOT
	nerve_type = NERVE_R_FOOT

/obj/item/bodypart/r_foot/drop_limb(special, dismembered, ignore_children, destroyed, wounding_type)
	if(owner && !special)
		if(owner.legcuffed)
			owner.legcuffed.forceMove(owner.drop_location())
			owner.legcuffed.dropped(owner)
			owner.legcuffed = null
			owner.update_inv_legcuffed()
		if(owner.shoes)
			owner.dropItemToGround(owner.shoes, TRUE)
	return ..()


code:
/obj/item/bodypart/r_hand
	name = "right hand"
	desc = "If you're seeing this, it probably wasn't the right hand."
	icon_state = "default_human_r_hand"
	attack_verb_continuous = list("slaps", "punches")
	attack_verb_simple = list("slap", "punch")
	parent_body_zone = BODY_ZONE_R_ARM
	body_zone = BODY_ZONE_PRECISE_R_HAND
	body_part = HAND_RIGHT
	render_layer = HANDS_PART_LAYER
	max_damage = 30
	max_stamina_damage = 30
	held_index = 2
	px_x = 6
	px_y = -3
	stam_heal_tick = 1

	max_cavity_item_size = WEIGHT_CLASS_TINY
	max_cavity_volume = 2.5

	hit_modifier = -2
	hit_zone_modifier = -1

	amputation_point_name = "right wrist"
	bone_type = BONE_R_HAND
	tendon_type = TENDON_R_HAND
	artery_type = ARTERY_R_HAND
	nerve_type = NERVE_R_HAND

/obj/item/bodypart/r_hand/drop_limb(special, dismembered, ignore_children, destroyed, wounding_type = WOUND_SLASH)
	var/mob/living/carbon/C = owner
	. = ..()
	if(C && !special)
		if(C.handcuffed)
			C.handcuffed.forceMove(drop_location())
			C.handcuffed.dropped(C)
			C.set_handcuffed(null)
			C.update_handcuffed()
		if(C.gloves)
			C.dropItemToGround(C.gloves, TRUE)
		C.update_inv_gloves() //to remove the bloody hands overlay


code:
/obj/item/bodypart/r_leg
	name = "right leg"
	desc = "You put your right leg in, your right leg out. In, out, in, out, \
		shake it all about. And then it apparently detaches. \
		The hokey pokey has certainly changed a lot since space colonisation."
	icon_state = "default_human_r_leg"
	attack_verb_continuous = list("kicks", "stomps")
	attack_verb_simple = list("kick", "stomp")
	parent_body_zone = BODY_ZONE_PRECISE_GROIN
	body_zone = BODY_ZONE_R_LEG
	body_part = LEG_RIGHT
	max_damage = 50
	max_stamina_damage = 50
	stance_index = 2
	px_x = 2
	px_y = 12
	stam_heal_tick = 1

	children_zones = list(BODY_ZONE_PRECISE_R_FOOT)
	max_cavity_item_size = WEIGHT_CLASS_SMALL
	max_cavity_volume = 3

	hit_modifier = -1
	hit_zone_modifier = 0

	amputation_point_name = "left hip"
	bone_type = BONE_R_LEG
	tendon_type = TENDON_R_LEG
	artery_type = ARTERY_R_LEG
	nerve_type = NERVE_R_LEG

/obj/item/bodypart/r_leg/set_owner(new_owner)
	. = ..()
	if(. == FALSE)
		return
	if(owner)
		if(HAS_TRAIT(owner, TRAIT_PARALYSIS_R_LEG))
			ADD_TRAIT(src, TRAIT_PARALYSIS, TRAIT_PARALYSIS_R_LEG)
			RegisterSignal(owner, SIGNAL_REMOVETRAIT(TRAIT_PARALYSIS_R_LEG), .proc/on_owner_paralysis_loss)
		else
			REMOVE_TRAIT(src, TRAIT_PARALYSIS, TRAIT_PARALYSIS_R_LEG)
			RegisterSignal(owner, SIGNAL_ADDTRAIT(TRAIT_PARALYSIS_R_LEG), .proc/on_owner_paralysis_gain)
	if(.)
		var/mob/living/carbon/old_owner = .
		if(HAS_TRAIT(old_owner, TRAIT_PARALYSIS_R_LEG))
			UnregisterSignal(old_owner, SIGNAL_REMOVETRAIT(TRAIT_PARALYSIS_R_LEG))
			if(!owner || !HAS_TRAIT(owner, TRAIT_PARALYSIS_R_LEG))
				REMOVE_TRAIT(src, TRAIT_PARALYSIS, TRAIT_PARALYSIS_R_LEG)
		else
			UnregisterSignal(old_owner, SIGNAL_ADDTRAIT(TRAIT_PARALYSIS_R_LEG))

///Proc to react to the owner gaining the TRAIT_PARALYSIS_R_LEG trait.
/obj/item/bodypart/r_leg/proc/on_owner_paralysis_gain(mob/living/carbon/source)
	SIGNAL_HANDLER
	ADD_TRAIT(src, TRAIT_PARALYSIS, TRAIT_PARALYSIS_R_LEG)
	UnregisterSignal(owner, SIGNAL_ADDTRAIT(TRAIT_PARALYSIS_R_LEG))
	RegisterSignal(owner, SIGNAL_REMOVETRAIT(TRAIT_PARALYSIS_R_LEG), .proc/on_owner_paralysis_loss)

///Proc to react to the owner losing the TRAIT_PARALYSIS_R_LEG trait.
/obj/item/bodypart/r_leg/proc/on_owner_paralysis_loss(mob/living/carbon/source)
	SIGNAL_HANDLER
	REMOVE_TRAIT(src, TRAIT_PARALYSIS, TRAIT_PARALYSIS_R_LEG)
	UnregisterSignal(owner, SIGNAL_REMOVETRAIT(TRAIT_PARALYSIS_R_LEG))
	RegisterSignal(owner, SIGNAL_ADDTRAIT(TRAIT_PARALYSIS_R_LEG), .proc/on_owner_paralysis_gain)


code:
/obj/item/bodypart/head/alien
	icon = DEFAULT_BODYPART_ICON_ANIMAL
	icon_state = "alien_head"
	can_be_disabled = FALSE
	dismemberable = FALSE
	max_damage = 400
	px_x = 0
	px_y = 0
	animal_origin = ALIEN_BODYPART

/obj/item/bodypart/face/alien
	can_be_disabled = FALSE
	dismemberable = FALSE
	max_damage = 150
	animal_origin = ALIEN_BODYPART

/obj/item/bodypart/mouth/alien
	can_be_disabled = FALSE
	dismemberable = FALSE
	max_damage = 150
	animal_origin = ALIEN_BODYPART

/obj/item/bodypart/l_eyesocket/alien
	name = "alien left eyesocket"
	desc = "It turned out they had them after all!"
	max_damage = 100
	animal_origin = ALIEN_BODYPART

/obj/item/bodypart/r_eyesocket/alien
	name = "alien right eyesocket"
	desc = "It turned out they had them after all!"
	max_damage = 100
	animal_origin = ALIEN_BODYPART

/obj/item/bodypart/neck/alien
	can_be_disabled = FALSE
	dismemberable = FALSE
	max_damage = 200
	animal_origin = ALIEN_BODYPART

/obj/item/bodypart/chest/alien
	icon = DEFAULT_BODYPART_ICON_ANIMAL
	icon_state = "alien_chest"
	can_be_disabled = FALSE
	dismemberable = FALSE
	max_damage = 500
	px_x = 0
	px_y = 0
	animal_origin = ALIEN_BODYPART

/obj/item/bodypart/groin/alien
	icon = DEFAULT_BODYPART_ICON_ANIMAL
	icon_state = "alien_groin"
	can_be_disabled = FALSE
	dismemberable = FALSE
	max_damage = 400
	px_x = 0
	px_y = 0
	animal_origin = ALIEN_BODYPART

/obj/item/bodypart/r_arm/alien
	icon = DEFAULT_BODYPART_ICON_ANIMAL
	icon_state = "alien_r_arm"
	dismemberable = FALSE
	can_be_disabled = FALSE
	max_damage = 100
	px_x = 0
	px_y = 0
	animal_origin = ALIEN_BODYPART

/obj/item/bodypart/r_hand/alien
	icon = DEFAULT_BODYPART_ICON_ANIMAL
	icon_state = "alien_r_hand"
	dismemberable = FALSE
	can_be_disabled = FALSE
	max_damage = 70
	px_x = 0
	px_y = 0
	animal_origin = ALIEN_BODYPART

/obj/item/bodypart/l_arm/alien
	icon = DEFAULT_BODYPART_ICON_ANIMAL
	icon_state = "alien_l_arm"
	dismemberable = FALSE
	can_be_disabled = FALSE
	max_damage = 100
	px_x = 0
	px_y = 0
	animal_origin = ALIEN_BODYPART

/obj/item/bodypart/l_hand/alien
	icon = DEFAULT_BODYPART_ICON_ANIMAL
	icon_state = "alien_l_hand"
	dismemberable = FALSE
	can_be_disabled = FALSE
	max_damage = 70
	px_x = 0
	px_y = 0
	animal_origin = ALIEN_BODYPART

/obj/item/bodypart/r_leg/alien
	icon = DEFAULT_BODYPART_ICON_ANIMAL
	icon_state = "alien_r_leg"
	px_x = 0
	px_y = 0
	dismemberable = FALSE
	can_be_disabled = FALSE
	max_damage = 100
	animal_origin = ALIEN_BODYPART

/obj/item/bodypart/r_foot/alien
	icon = DEFAULT_BODYPART_ICON_ANIMAL
	icon_state = "alien_r_foot"
	px_x = 0
	px_y = 0
	dismemberable = FALSE
	can_be_disabled = FALSE
	max_damage = 70
	animal_origin = ALIEN_BODYPART

/obj/item/bodypart/l_leg/alien
	icon = DEFAULT_BODYPART_ICON_ANIMAL
	icon_state = "alien_l_leg"
	px_x = 0
	px_y = 0
	dismemberable = FALSE
	can_be_disabled = FALSE
	max_damage = 100
	animal_origin = ALIEN_BODYPART

/obj/item/bodypart/l_foot/alien
	icon = DEFAULT_BODYPART_ICON_ANIMAL
	icon_state = "alien_l_foot"
	px_x = 0
	px_y = 0
	dismemberable = FALSE
	can_be_disabled = FALSE
	max_damage = 70
	animal_origin = ALIEN_BODYPART


code:
/obj/item/bodypart/r_arm/children
	starting_children = list(/obj/item/bodypart/r_hand)

/obj/item/bodypart/l_arm/children
	starting_children = list(/obj/item/bodypart/l_hand)

/obj/item/bodypart/r_leg/children
	starting_children = list(/obj/item/bodypart/r_foot)

/obj/item/bodypart/l_leg/children
	starting_children = list(/obj/item/bodypart/l_foot)

/obj/item/bodypart/chest/children
	starting_children = list(/obj/item/bodypart/neck, /obj/item/bodypart/groin)

/obj/item/bodypart/groin/children
	starting_children = list(/obj/item/bodypart/r_leg/children, /obj/item/bodypart/l_leg/children)

/obj/item/bodypart/neck/children
	starting_children = list(/obj/item/bodypart/head/children)

/obj/item/bodypart/head/children
	starting_children = list(/obj/item/bodypart/face, /obj/item/bodypart/mouth, /obj/item/bodypart/r_eyesocket, /obj/item/bodypart/l_eyesocket)


code:
//For ye whom may venture here, split up arm / hand sprites are formatted as "l_hand" & "l_arm".
//The complete sprite (displayed when the limb is on the ground) should be named "borg_l_arm".
//Failure to follow this pattern will cause the hand's icons to be missing due to the way get_limb_icon() works to generate the mob's icons using the aux_zone var.

/obj/item/bodypart/r_arm/robot
	name = "cyborg right arm"
	desc = "A skeletal limb wrapped in pseudomuscles, with a low-conductivity case."
	render_icon = DEFAULT_BODYPART_ICON_ROBOTIC
	icon_state = "borg_r_arm"
	inhand_icon_state = "buildpipe"
	flags_1 = CONDUCT_1
	status = BODYPART_ROBOTIC
	brute_reduction = 5
	burn_reduction = 5
	disable_threshold = 1

	light_brute_msg = ROBOTIC_LIGHT_BRUTE_MSG
	medium_brute_msg = ROBOTIC_MEDIUM_BRUTE_MSG
	heavy_brute_msg = ROBOTIC_HEAVY_BRUTE_MSG

	light_burn_msg = ROBOTIC_LIGHT_BURN_MSG
	medium_burn_msg = ROBOTIC_MEDIUM_BURN_MSG
	heavy_burn_msg = ROBOTIC_HEAVY_BURN_MSG

	incoming_brute_mult = ROBOTIC_BRUTE_DMG_MULTIPLIER
	incoming_burn_mult = ROBOTIC_BURN_DMG_MULTIPLIER
	incoming_pain_mult = ROBOTIC_PAIN_DMG_MULTIPLIER

	advanced_rendering = FALSE
	starting_children = list(/obj/item/bodypart/r_hand/robot)

/obj/item/bodypart/r_arm/robot/nochildren
	starting_children = null

/obj/item/bodypart/r_hand/robot
	name = "cyborg right hand"
	desc = "A skeletal limb wrapped in pseudomuscles, with a low-conductivity case."
	render_icon = DEFAULT_BODYPART_ICON_ROBOTIC
	icon_state = "borg_r_hand"
	inhand_icon_state = "buildpipe"
	flags_1 = CONDUCT_1
	status = BODYPART_ROBOTIC
	brute_reduction = 5
	burn_reduction = 5
	disable_threshold = 1

	light_brute_msg = ROBOTIC_LIGHT_BRUTE_MSG
	medium_brute_msg = ROBOTIC_MEDIUM_BRUTE_MSG
	heavy_brute_msg = ROBOTIC_HEAVY_BRUTE_MSG

	light_burn_msg = ROBOTIC_LIGHT_BURN_MSG
	medium_burn_msg = ROBOTIC_MEDIUM_BURN_MSG
	heavy_burn_msg = ROBOTIC_HEAVY_BURN_MSG

	incoming_brute_mult = ROBOTIC_BRUTE_DMG_MULTIPLIER
	incoming_burn_mult = ROBOTIC_BURN_DMG_MULTIPLIER
	incoming_pain_mult = ROBOTIC_PAIN_DMG_MULTIPLIER

	advanced_rendering = FALSE

/obj/item/bodypart/l_arm/robot
	name = "cyborg left arm"
	desc = "A skeletal limb wrapped in pseudomuscles, with a low-conductivity case."
	render_icon = DEFAULT_BODYPART_ICON_ROBOTIC
	icon_state = "borg_l_arm"
	inhand_icon_state = "buildpipe"
	flags_1 = CONDUCT_1
	status = BODYPART_ROBOTIC
	brute_reduction = 5
	burn_reduction = 5
	disable_threshold = 1

	light_brute_msg = ROBOTIC_LIGHT_BRUTE_MSG
	medium_brute_msg = ROBOTIC_MEDIUM_BRUTE_MSG
	heavy_brute_msg = ROBOTIC_HEAVY_BRUTE_MSG

	light_burn_msg = ROBOTIC_LIGHT_BURN_MSG
	medium_burn_msg = ROBOTIC_MEDIUM_BURN_MSG
	heavy_burn_msg = ROBOTIC_HEAVY_BURN_MSG

	incoming_brute_mult = ROBOTIC_BRUTE_DMG_MULTIPLIER
	incoming_burn_mult = ROBOTIC_BURN_DMG_MULTIPLIER
	incoming_pain_mult = ROBOTIC_PAIN_DMG_MULTIPLIER

	advanced_rendering = FALSE
	starting_children = list(/obj/item/bodypart/l_hand/robot)

/obj/item/bodypart/l_arm/robot/nochildren
	starting_children = null

/obj/item/bodypart/l_hand/robot
	name = "cyborg left hand"
	desc = "A skeletal limb wrapped in pseudomuscles, with a low-conductivity case."
	render_icon = DEFAULT_BODYPART_ICON_ROBOTIC
	icon_state = "borg_l_hand"
	inhand_icon_state = "buildpipe"
	flags_1 = CONDUCT_1
	status = BODYPART_ROBOTIC
	brute_reduction = 5
	burn_reduction = 5
	disable_threshold = 1

	light_brute_msg = ROBOTIC_LIGHT_BRUTE_MSG
	medium_brute_msg = ROBOTIC_MEDIUM_BRUTE_MSG
	heavy_brute_msg = ROBOTIC_HEAVY_BRUTE_MSG

	light_burn_msg = ROBOTIC_LIGHT_BURN_MSG
	medium_burn_msg = ROBOTIC_MEDIUM_BURN_MSG
	heavy_burn_msg = ROBOTIC_HEAVY_BURN_MSG

	incoming_brute_mult = ROBOTIC_BRUTE_DMG_MULTIPLIER
	incoming_burn_mult = ROBOTIC_BURN_DMG_MULTIPLIER
	incoming_pain_mult = ROBOTIC_PAIN_DMG_MULTIPLIER

/obj/item/bodypart/r_leg/robot
	name = "cyborg right leg"
	desc = "A skeletal limb wrapped in pseudomuscles, with a low-conductivity case."
	render_icon = DEFAULT_BODYPART_ICON_ROBOTIC
	icon_state = "borg_r_leg"
	inhand_icon_state = "buildpipe"
	flags_1 = CONDUCT_1
	status = BODYPART_ROBOTIC
	brute_reduction = 5
	burn_reduction = 5
	disable_threshold = 1

	light_brute_msg = ROBOTIC_LIGHT_BRUTE_MSG
	medium_brute_msg = ROBOTIC_MEDIUM_BRUTE_MSG
	heavy_brute_msg = ROBOTIC_HEAVY_BRUTE_MSG

	light_burn_msg = ROBOTIC_LIGHT_BURN_MSG
	medium_burn_msg = ROBOTIC_MEDIUM_BURN_MSG
	heavy_burn_msg = ROBOTIC_HEAVY_BURN_MSG

	incoming_brute_mult = ROBOTIC_BRUTE_DMG_MULTIPLIER
	incoming_burn_mult = ROBOTIC_BURN_DMG_MULTIPLIER
	incoming_pain_mult = ROBOTIC_PAIN_DMG_MULTIPLIER

	advanced_rendering = FALSE
	starting_children = list(/obj/item/bodypart/r_foot/robot)

/obj/item/bodypart/r_leg/robot/nochildren
	starting_children = null

/obj/item/bodypart/r_foot/robot
	name = "cyborg right foot"
	desc = "A skeletal limb wrapped in pseudomuscles, with a low-conductivity case."
	render_icon = DEFAULT_BODYPART_ICON_ROBOTIC
	icon_state = "borg_r_foot"
	inhand_icon_state = "buildpipe"
	flags_1 = CONDUCT_1
	status = BODYPART_ROBOTIC
	brute_reduction = 5
	burn_reduction = 5
	disable_threshold = 1

	light_brute_msg = ROBOTIC_LIGHT_BRUTE_MSG
	medium_brute_msg = ROBOTIC_MEDIUM_BRUTE_MSG
	heavy_brute_msg = ROBOTIC_HEAVY_BRUTE_MSG

	light_burn_msg = ROBOTIC_LIGHT_BURN_MSG
	medium_burn_msg = ROBOTIC_MEDIUM_BURN_MSG
	heavy_burn_msg = ROBOTIC_HEAVY_BURN_MSG

	incoming_brute_mult = ROBOTIC_BRUTE_DMG_MULTIPLIER
	incoming_burn_mult = ROBOTIC_BURN_DMG_MULTIPLIER
	incoming_pain_mult = ROBOTIC_PAIN_DMG_MULTIPLIER

	advanced_rendering = FALSE

/obj/item/bodypart/l_leg/robot
	name = "cyborg left leg"
	desc = "A skeletal limb wrapped in pseudomuscles, with a low-conductivity case."
	render_icon = DEFAULT_BODYPART_ICON_ROBOTIC
	icon_state = "borg_l_leg"
	inhand_icon_state = "buildpipe"
	flags_1 = CONDUCT_1
	status = BODYPART_ROBOTIC
	brute_reduction = 5
	burn_reduction = 5
	disable_threshold = 1

	light_brute_msg = ROBOTIC_LIGHT_BRUTE_MSG
	medium_brute_msg = ROBOTIC_MEDIUM_BRUTE_MSG
	heavy_brute_msg = ROBOTIC_HEAVY_BRUTE_MSG

	light_burn_msg = ROBOTIC_LIGHT_BURN_MSG
	medium_burn_msg = ROBOTIC_MEDIUM_BURN_MSG
	heavy_burn_msg = ROBOTIC_HEAVY_BURN_MSG

	incoming_brute_mult = ROBOTIC_BRUTE_DMG_MULTIPLIER
	incoming_burn_mult = ROBOTIC_BURN_DMG_MULTIPLIER
	incoming_pain_mult = ROBOTIC_PAIN_DMG_MULTIPLIER

	advanced_rendering = FALSE
	starting_children = list(/obj/item/bodypart/l_foot/robot)

/obj/item/bodypart/l_leg/robot/nochildren
	starting_children = null

/obj/item/bodypart/l_foot/robot
	name = "cyborg left foot"
	desc = "A skeletal limb wrapped in pseudomuscles, with a low-conductivity case."
	render_icon = DEFAULT_BODYPART_ICON_ROBOTIC
	icon_state = "borg_l_foot"
	inhand_icon_state = "buildpipe"
	flags_1 = CONDUCT_1
	status = BODYPART_ROBOTIC
	brute_reduction = 5
	burn_reduction = 5
	disable_threshold = 1

	light_brute_msg = ROBOTIC_LIGHT_BRUTE_MSG
	medium_brute_msg = ROBOTIC_MEDIUM_BRUTE_MSG
	heavy_brute_msg = ROBOTIC_HEAVY_BRUTE_MSG

	light_burn_msg = ROBOTIC_LIGHT_BURN_MSG
	medium_burn_msg = ROBOTIC_MEDIUM_BURN_MSG
	heavy_burn_msg = ROBOTIC_HEAVY_BURN_MSG

	incoming_brute_mult = ROBOTIC_BRUTE_DMG_MULTIPLIER
	incoming_burn_mult = ROBOTIC_BURN_DMG_MULTIPLIER
	incoming_pain_mult = ROBOTIC_PAIN_DMG_MULTIPLIER

	advanced_rendering = FALSE

/obj/item/bodypart/groin/robot
	name = "cyborg lower body"
	desc = "A skeletal limb wrapped in pseudomuscles, with a low-conductivity case."
	render_icon = DEFAULT_BODYPART_ICON_ROBOTIC
	icon_state = "borg_groin"
	inhand_icon_state = "buildpipe"
	flags_1 = CONDUCT_1
	status = BODYPART_ROBOTIC
	brute_reduction = 5
	burn_reduction = 5
	disable_threshold = 1

	light_brute_msg = ROBOTIC_LIGHT_BRUTE_MSG
	medium_brute_msg = ROBOTIC_MEDIUM_BRUTE_MSG
	heavy_brute_msg = ROBOTIC_HEAVY_BRUTE_MSG

	light_burn_msg = ROBOTIC_LIGHT_BURN_MSG
	medium_burn_msg = ROBOTIC_MEDIUM_BURN_MSG
	heavy_burn_msg = ROBOTIC_HEAVY_BURN_MSG

	incoming_brute_mult = ROBOTIC_BRUTE_DMG_MULTIPLIER
	incoming_burn_mult = ROBOTIC_BURN_DMG_MULTIPLIER
	incoming_pain_mult = ROBOTIC_PAIN_DMG_MULTIPLIER

	advanced_rendering = FALSE

/obj/item/bodypart/chest/robot
	name = "cyborg upper body"
	desc = "A heavily reinforced case containing cyborg logic boards, with space for a standard power cell."
	render_icon = DEFAULT_BODYPART_ICON_ROBOTIC
	icon_state = "borg_chest"
	inhand_icon_state = "buildpipe"
	flags_1 = CONDUCT_1
	status = BODYPART_ROBOTIC
	brute_reduction = 5
	burn_reduction = 5
	disable_threshold = 1

	light_brute_msg = ROBOTIC_LIGHT_BRUTE_MSG
	medium_brute_msg = ROBOTIC_MEDIUM_BRUTE_MSG
	heavy_brute_msg = ROBOTIC_HEAVY_BRUTE_MSG

	light_burn_msg = ROBOTIC_LIGHT_BURN_MSG
	medium_burn_msg = ROBOTIC_MEDIUM_BURN_MSG
	heavy_burn_msg = ROBOTIC_HEAVY_BURN_MSG

	incoming_brute_mult = ROBOTIC_BRUTE_DMG_MULTIPLIER
	incoming_burn_mult = ROBOTIC_BURN_DMG_MULTIPLIER
	incoming_pain_mult = ROBOTIC_PAIN_DMG_MULTIPLIER

	advanced_rendering = FALSE
	starting_children = list(/obj/item/bodypart/groin/robot)

	var/wired = FALSE
	var/obj/item/stock_parts/cell/cell = null

/obj/item/bodypart/chest/robot/nochildren
	starting_children = null

/obj/item/bodypart/chest/robot/get_cell()
	return cell

/obj/item/bodypart/chest/robot/handle_atom_del(atom/A)
	if(A == cell)
		cell = null
	return ..()

/obj/item/bodypart/chest/robot/Destroy()
	QDEL_NULL(cell)
	return ..()

/obj/item/bodypart/chest/robot/attackby(obj/item/W, mob/user, params)
	if(istype(W, /obj/item/stock_parts/cell))
		if(cell)
			to_chat(user, span_warning("There's already a cell installed!"))
			return
		else
			if(!user.transferItemToLoc(W, src))
				return
			cell = W
			to_chat(user, span_notice("I insert the cell."))
	else if(istype(W, /obj/item/stack/cable_coil))
		if(wired)
			to_chat(user, span_warning("It's already wired!"))
			return
		var/obj/item/stack/cable_coil/coil = W
		if (coil.use(1))
			wired = TRUE
			to_chat(user, span_notice("I insert the wire."))
		else
			to_chat(user, span_warning("I'd need at least one length of coil to wire it!"))
	else
		return ..()

/obj/item/bodypart/chest/robot/wirecutter_act(mob/living/user, obj/item/I)
	. = ..()
	if(!wired)
		to_chat(user, span_warning("There's no wiring installed in [src]!"))
		return
	. = TRUE
	I.play_tool_sound(src)
	to_chat(user, span_notice("I cut the wires out of [src]."))
	new /obj/item/stack/cable_coil(drop_location(), 1)
	wired = FALSE

/obj/item/bodypart/chest/robot/screwdriver_act(mob/living/user, obj/item/I)
	. = ..()
	if(!cell)
		to_chat(user, span_warning("There's no power cell installed in [src]!"))
		return
	. = TRUE
	I.play_tool_sound(src)
	to_chat(user, span_notice("I remove \the [cell] from [src]."))
	cell.forceMove(drop_location())
	cell = null

/obj/item/bodypart/chest/robot/examine(mob/user)
	. = ..()
	if(cell)
		. += "It has a [cell] inserted, secured in with a few screws."
	else
		. += span_info("It has an empty port for a power cell.")
	if(wired)
		. += "Its all wired up[cell ? " and ready for usage" : ""]."
	else
		. += span_info("It has a couple spots that still need to be wired.")

/obj/item/bodypart/chest/robot/drop_organs(mob/user, violent_removal)
	if(wired)
		new /obj/item/stack/cable_coil(drop_location(), 1)
		wired = FALSE
	if(cell)
		cell.forceMove(drop_location())
		cell = null
	. = ..()

/obj/item/bodypart/neck/robotic
	name = "cyborg neck"
	desc = "A bridge between the monitor and braincase thingmajig."
	icon_state = "vertebrae-c"
	status = BODYPART_ROBOTIC
	flags_1 = CONDUCT_1
	brute_reduction = 5
	burn_reduction = 5
	disable_threshold = 1

	light_brute_msg = ROBOTIC_LIGHT_BRUTE_MSG
	medium_brute_msg = ROBOTIC_MEDIUM_BRUTE_MSG
	heavy_brute_msg = ROBOTIC_HEAVY_BRUTE_MSG

	light_burn_msg = ROBOTIC_LIGHT_BURN_MSG
	medium_burn_msg = ROBOTIC_MEDIUM_BURN_MSG
	heavy_burn_msg = ROBOTIC_HEAVY_BURN_MSG

	incoming_brute_mult = ROBOTIC_BRUTE_DMG_MULTIPLIER
	incoming_burn_mult = ROBOTIC_BURN_DMG_MULTIPLIER
	incoming_pain_mult = ROBOTIC_PAIN_DMG_MULTIPLIER

	advanced_rendering = FALSE
	starting_children = list(/obj/item/bodypart/head/robot)

/obj/item/bodypart/neck/robotic/nochildren
	starting_children = null

/obj/item/bodypart/l_eyesocket/robotic
	name = "cyborg left eyesocket"
	desc = "My vision is augmented."
	icon_state = "eye-c"
	flags_1 = CONDUCT_1
	brute_reduction = 5
	burn_reduction = 5
	disable_threshold = 1

	light_brute_msg = ROBOTIC_LIGHT_BRUTE_MSG
	medium_brute_msg = ROBOTIC_MEDIUM_BRUTE_MSG
	heavy_brute_msg = ROBOTIC_HEAVY_BRUTE_MSG

	light_burn_msg = ROBOTIC_LIGHT_BURN_MSG
	medium_burn_msg = ROBOTIC_MEDIUM_BURN_MSG
	heavy_burn_msg = ROBOTIC_HEAVY_BURN_MSG

	incoming_brute_mult = ROBOTIC_BRUTE_DMG_MULTIPLIER
	incoming_burn_mult = ROBOTIC_BURN_DMG_MULTIPLIER
	incoming_pain_mult = ROBOTIC_PAIN_DMG_MULTIPLIER

	advanced_rendering = FALSE

/obj/item/bodypart/r_eyesocket/robotic
	name = "cyborg right eyesocket"
	desc = "My vision is augmented."
	icon_state = "eye-c"
	flags_1 = CONDUCT_1
	brute_reduction = 5 //bob moment?
	burn_reduction = 5
	disable_threshold = 1

	light_brute_msg = ROBOTIC_LIGHT_BRUTE_MSG
	medium_brute_msg = ROBOTIC_MEDIUM_BRUTE_MSG
	heavy_brute_msg = ROBOTIC_HEAVY_BRUTE_MSG

	light_burn_msg = ROBOTIC_LIGHT_BURN_MSG
	medium_burn_msg = ROBOTIC_MEDIUM_BURN_MSG
	heavy_burn_msg = ROBOTIC_HEAVY_BURN_MSG

	incoming_brute_mult = ROBOTIC_BRUTE_DMG_MULTIPLIER
	incoming_burn_mult = ROBOTIC_BURN_DMG_MULTIPLIER
	incoming_pain_mult = ROBOTIC_PAIN_DMG_MULTIPLIER

	advanced_rendering = FALSE

/obj/item/bodypart/face/robotic
	name = "cyborg face"
	desc = "A standard reinforced flap of metal."
	icon_state = "face-c"
	flags_1 = CONDUCT_1
	brute_reduction = 5
	burn_reduction = 5
	disable_threshold = 1

	light_brute_msg = ROBOTIC_LIGHT_BRUTE_MSG
	medium_brute_msg = ROBOTIC_MEDIUM_BRUTE_MSG
	heavy_brute_msg = ROBOTIC_HEAVY_BRUTE_MSG

	light_burn_msg = ROBOTIC_LIGHT_BURN_MSG
	medium_burn_msg = ROBOTIC_MEDIUM_BURN_MSG
	heavy_burn_msg = ROBOTIC_HEAVY_BURN_MSG

	incoming_brute_mult = ROBOTIC_BRUTE_DMG_MULTIPLIER
	incoming_burn_mult = ROBOTIC_BURN_DMG_MULTIPLIER
	incoming_pain_mult = ROBOTIC_PAIN_DMG_MULTIPLIER

	advanced_rendering = FALSE

/obj/item/bodypart/mouth/robotic
	name = "cyborg jaw"
	desc = "A standard reinforced tonguecase."
	icon_state = "jaw-c"
	flags_1 = CONDUCT_1
	brute_reduction = 5
	burn_reduction = 5
	disable_threshold = 1

	light_brute_msg = ROBOTIC_LIGHT_BRUTE_MSG
	medium_brute_msg = ROBOTIC_MEDIUM_BRUTE_MSG
	heavy_brute_msg = ROBOTIC_HEAVY_BRUTE_MSG

	light_burn_msg = ROBOTIC_LIGHT_BURN_MSG
	medium_burn_msg = ROBOTIC_MEDIUM_BURN_MSG
	heavy_burn_msg = ROBOTIC_HEAVY_BURN_MSG

	incoming_brute_mult = ROBOTIC_BRUTE_DMG_MULTIPLIER
	incoming_burn_mult = ROBOTIC_BURN_DMG_MULTIPLIER
	incoming_pain_mult = ROBOTIC_PAIN_DMG_MULTIPLIER

	advanced_rendering = FALSE

/obj/item/bodypart/head/robot
	name = "cyborg head"
	desc = "A standard reinforced braincase, with spine-plugged neural socket and sensor gimbals."
	render_icon = DEFAULT_BODYPART_ICON_ROBOTIC
	icon_state = "borg_head"
	inhand_icon_state = "buildpipe"
	flags_1 = CONDUCT_1
	status = BODYPART_ROBOTIC
	brute_reduction = 5
	burn_reduction = 5
	disable_threshold = 1

	light_brute_msg = ROBOTIC_LIGHT_BRUTE_MSG
	medium_brute_msg = ROBOTIC_MEDIUM_BRUTE_MSG
	heavy_brute_msg = ROBOTIC_HEAVY_BRUTE_MSG

	light_burn_msg = ROBOTIC_LIGHT_BURN_MSG
	medium_burn_msg = ROBOTIC_MEDIUM_BURN_MSG
	heavy_burn_msg = ROBOTIC_HEAVY_BURN_MSG

	incoming_brute_mult = ROBOTIC_BRUTE_DMG_MULTIPLIER
	incoming_burn_mult = ROBOTIC_BURN_DMG_MULTIPLIER
	incoming_pain_mult = ROBOTIC_PAIN_DMG_MULTIPLIER

	advanced_rendering = FALSE
	starting_children = list(/obj/item/bodypart/face/robotic)

	var/obj/item/assembly/flash/handheld/flash1 = null
	var/obj/item/assembly/flash/handheld/flash2 = null

/obj/item/bodypart/head/robot/handle_atom_del(atom/A)
	if(A == flash1)
		flash1 = null
	if(A == flash2)
		flash2 = null
	return ..()

/obj/item/bodypart/head/robot/Destroy()
	QDEL_NULL(flash1)
	QDEL_NULL(flash2)
	return ..()

/obj/item/bodypart/head/robot/examine(mob/user)
	. = ..()
	if(!flash1 && !flash2)
		. += span_info("It has two empty eye sockets for flashes.")
	else
		var/single_flash = FALSE
		if(!flash1 || !flash2)
			single_flash = TRUE
			. += "One of its eye sockets is currently occupied by a flash."
		else
			. += "It has two eye sockets occupied by flashes."
		. += span_notice("It shouldn't be hard to pry [single_flash ? "it" : "them"] out.")

/obj/item/bodypart/head/robot/attackby(obj/item/W, mob/user, params)
	if(istype(W, /obj/item/assembly/flash/handheld))
		var/obj/item/assembly/flash/handheld/F = W
		if(flash1 && flash2)
			to_chat(user, span_warning("I've already inserted the eyes!"))
			return
		else if(F.burnt_out)
			to_chat(user, span_warning("I can't use a broken flash!"))
			return
		else
			if(!user.transferItemToLoc(F, src))
				return
			if(flash1)
				flash2 = F
			else
				flash1 = F
			to_chat(user, span_notice("I insert the flash into the eye socket."))
			return
	return ..()

/obj/item/bodypart/head/robot/crowbar_act(mob/living/user, obj/item/I)
	. = ..()
	if(flash1 || flash2)
		I.play_tool_sound(src)
		to_chat(user, span_notice("I remove the flash from [src]."))
		if(flash1)
			flash1.forceMove(drop_location())
			flash1 = null
		if(flash2)
			flash2.forceMove(drop_location())
			flash2 = null
	else
		to_chat(user, span_warning("There is no flash to remove from [src]."))
	return TRUE

/obj/item/bodypart/head/robot/drop_organs(mob/user, violent_removal)
	if(flash1)
		flash1.forceMove(user.loc)
		flash1 = null
	if(flash2)
		flash2.forceMove(user.loc)
		flash2 = null
	. = ..()


code:
/obj/item/bodypart/r_eyesocket/robot/weak
	brute_reduction = 0
	burn_reduction = 0
	incoming_brute_mult = 1
	incoming_burn_mult = 1
	incoming_pain_mult = 1
	disable_threshold = 0.9
	starting_children = null

/obj/item/bodypart/l_eyesocket/robot/weak
	brute_reduction = 0
	burn_reduction = 0
	incoming_brute_mult = 1
	incoming_burn_mult = 1
	incoming_pain_mult = 1
	disable_threshold = 0.9
	starting_children = null

/obj/item/bodypart/face/robot/weak
	brute_reduction = 0
	burn_reduction = 0
	incoming_brute_mult = 1
	incoming_burn_mult = 1
	incoming_pain_mult = 1
	disable_threshold = 0.9
	starting_children = null

/obj/item/bodypart/mouth/robot/weak
	brute_reduction = 0
	burn_reduction = 0
	incoming_brute_mult = 1
	incoming_burn_mult = 1
	incoming_pain_mult = 1
	disable_threshold = 0.9
	starting_children = null

/obj/item/bodypart/head/robot/weak
	brute_reduction = 0
	burn_reduction = 0
	incoming_brute_mult = 1
	incoming_burn_mult = 1
	incoming_pain_mult = 1
	disable_threshold = 0.9
	starting_children = null

/obj/item/bodypart/neck/robot/weak
	brute_reduction = 0
	burn_reduction = 0
	incoming_brute_mult = 1
	incoming_burn_mult = 1
	incoming_pain_mult = 1
	disable_threshold = 0.9
	starting_children = null

/obj/item/bodypart/chest/robot/weak
	brute_reduction = 0
	burn_reduction = 0
	incoming_brute_mult = 1
	incoming_burn_mult = 1
	incoming_pain_mult = 1
	disable_threshold = 0.9
	starting_children = null

/obj/item/bodypart/groin/robot/weak
	brute_reduction = 0
	burn_reduction = 0
	incoming_brute_mult = 1
	incoming_burn_mult = 1
	incoming_pain_mult = 1
	disable_threshold = 0.9
	starting_children = null

/obj/item/bodypart/r_arm/robot/weak
	brute_reduction = 0
	burn_reduction = 0
	incoming_brute_mult = 1
	incoming_burn_mult = 1
	incoming_pain_mult = 1
	disable_threshold = 0.9
	starting_children = null

/obj/item/bodypart/r_hand/robot/weak
	brute_reduction = 0
	burn_reduction = 0
	incoming_brute_mult = 1
	incoming_burn_mult = 1
	incoming_pain_mult = 1
	disable_threshold = 0.9

/obj/item/bodypart/l_arm/robot/weak
	brute_reduction = 0
	burn_reduction = 0
	incoming_brute_mult = 1
	incoming_burn_mult = 1
	incoming_pain_mult = 1
	disable_threshold = 0.9

/obj/item/bodypart/l_hand/robot/weak
	brute_reduction = 0
	burn_reduction = 0
	incoming_brute_mult = 1
	incoming_burn_mult = 1
	incoming_pain_mult = 1
	disable_threshold = 0.9

/obj/item/bodypart/r_leg/robot/weak
	brute_reduction = 0
	burn_reduction = 0
	incoming_brute_mult = 1
	incoming_burn_mult = 1
	incoming_pain_mult = 1
	disable_threshold = 0.9
	starting_children = null

/obj/item/bodypart/r_foot/robot/weak
	brute_reduction = 0
	burn_reduction = 0
	incoming_brute_mult = 1
	incoming_burn_mult = 1
	incoming_pain_mult = 1
	disable_threshold = 0.9
	starting_children = null

/obj/item/bodypart/l_leg/robot/weak
	brute_reduction = 0
	burn_reduction = 0
	incoming_brute_mult = 1
	incoming_burn_mult = 1
	incoming_pain_mult = 1
	disable_threshold = 0.9
	starting_children = null

/obj/item/bodypart/l_foot/robot/weak
	brute_reduction = 0
	burn_reduction = 0
	incoming_brute_mult = 1
	incoming_burn_mult = 1
	incoming_pain_mult = 1
	disable_threshold = 0.9
	starting_children = null


code:
/obj/item/bodypart/head/larva
	icon = 'icons/mob/animal_parts.dmi'
	icon_state = "larva_head"
	can_be_disabled = FALSE
	dismemberable = FALSE
	max_damage = 50
	animal_origin = LARVA_BODYPART

/obj/item/bodypart/l_eyesocket/larva
	can_be_disabled = FALSE
	dismemberable = FALSE
	animal_origin = LARVA_BODYPART

/obj/item/bodypart/r_eyesocket/larva
	can_be_disabled = FALSE
	dismemberable = FALSE
	animal_origin = LARVA_BODYPART

/obj/item/bodypart/face/larva
	can_be_disabled = FALSE
	dismemberable = FALSE
	animal_origin = LARVA_BODYPART

/obj/item/bodypart/mouth/larva
	can_be_disabled = FALSE
	dismemberable = FALSE
	animal_origin = LARVA_BODYPART

/obj/item/bodypart/neck/larva
	icon = 'icons/mob/animal_parts.dmi'
	icon_state = "larva_head"
	can_be_disabled = FALSE
	dismemberable = FALSE
	animal_origin = LARVA_BODYPART

/obj/item/bodypart/chest/larva
	icon = 'icons/mob/animal_parts.dmi'
	icon_state = "larva_chest"
	can_be_disabled = FALSE
	dismemberable = FALSE
	max_damage = 50
	animal_origin = LARVA_BODYPART

/obj/item/bodypart/groin/larva
	can_be_disabled = FALSE
	dismemberable = FALSE
	max_damage = 50
	animal_origin = LARVA_BODYPART


code:
/obj/item/bodypart/head/monkey
	icon = DEFAULT_BODYPART_ICON_ANIMAL
	icon_state = "default_monkey_head"
	animal_origin = MONKEY_BODYPART
	wound_resistance = -10

/obj/item/bodypart/l_eyesocket/monkey
	animal_origin = MONKEY_BODYPART

/obj/item/bodypart/r_eyesocket/monkey
	animal_origin = MONKEY_BODYPART

/obj/item/bodypart/face/monkey
	animal_origin = MONKEY_BODYPART

/obj/item/bodypart/mouth/monkey
	animal_origin = MONKEY_BODYPART

/obj/item/bodypart/neck/monkey
	animal_origin = MONKEY_BODYPART

/obj/item/bodypart/chest/monkey
	icon = DEFAULT_BODYPART_ICON_ANIMAL
	icon_state = "default_monkey_chest"
	animal_origin = MONKEY_BODYPART
	wound_resistance = -10

/obj/item/bodypart/groin/monkey
	icon = DEFAULT_BODYPART_ICON_ANIMAL
	icon_state = "default_monkey_groin"
	animal_origin = MONKEY_BODYPART
	wound_resistance = -10

/obj/item/bodypart/r_arm/monkey
	icon = DEFAULT_BODYPART_ICON_ANIMAL
	icon_state = "default_monkey_r_arm"
	animal_origin = MONKEY_BODYPART
	wound_resistance = -10
	px_x = -5
	px_y = -1

/obj/item/bodypart/r_hand/monkey
	icon = DEFAULT_BODYPART_ICON_ANIMAL
	icon_state = "default_monkey_r_hand"
	animal_origin = MONKEY_BODYPART
	wound_resistance = -10
	px_x = -5
	px_y = -1

/obj/item/bodypart/l_arm/monkey
	icon = DEFAULT_BODYPART_ICON_ANIMAL
	icon_state = "default_monkey_l_arm"
	animal_origin = MONKEY_BODYPART
	wound_resistance = -10
	px_x = -5
	px_y = -3

/obj/item/bodypart/l_hand/monkey
	icon = DEFAULT_BODYPART_ICON_ANIMAL
	icon_state = "default_monkey_l_hand"
	animal_origin = MONKEY_BODYPART
	wound_resistance = -10
	px_x = -5
	px_y = -1

/obj/item/bodypart/r_leg/monkey
	icon = DEFAULT_BODYPART_ICON_ANIMAL
	icon_state = "default_monkey_r_leg"
	animal_origin = MONKEY_BODYPART
	wound_resistance = -10
	px_y = 4

/obj/item/bodypart/r_foot/monkey
	icon = DEFAULT_BODYPART_ICON_ANIMAL
	icon_state = "default_monkey_r_foot"
	animal_origin = MONKEY_BODYPART
	wound_resistance = -10
	px_y = 6

/obj/item/bodypart/l_leg/monkey
	icon = DEFAULT_BODYPART_ICON_ANIMAL
	icon_state = "default_monkey_l_leg"
	animal_origin = MONKEY_BODYPART
	wound_resistance = -10
	px_y = 4

/obj/item/bodypart/l_foot/monkey
	icon = DEFAULT_BODYPART_ICON_ANIMAL
	icon_state = "default_monkey_l_foot"
	animal_origin = MONKEY_BODYPART
	wound_resistance = -10
	px_y = 6


code:
/obj/item/bodypart/r_arm/robot/surplus
	name = "surplus prosthetic right arm"
	desc = "A skeletal, robotic limb. Outdated and fragile, but it's still better than nothing."
	icon = 'icons/mob/augmentation/surplus_augments.dmi'
	brute_reduction = 0
	burn_reduction = 0
	incoming_brute_mult = 1
	incoming_burn_mult = 1
	incoming_pain_mult = 1
	disable_threshold = 0.75
	starting_children = list(/obj/item/bodypart/r_hand/robot/surplus)

/obj/item/bodypart/r_hand/robot/surplus
	name = "surplus prosthetic right hand"
	desc = "A skeletal, robotic limb. Outdated and fragile, but it's still better than nothing."
	icon = 'icons/mob/augmentation/surplus_augments.dmi'
	brute_reduction = 0
	burn_reduction = 0
	incoming_brute_mult = 1
	incoming_burn_mult = 1
	incoming_pain_mult = 1
	disable_threshold = 0.75

/obj/item/bodypart/l_arm/robot/surplus
	name = "surplus prosthetic left arm"
	desc = "A skeletal, robotic limb. Outdated and fragile, but it's still better than nothing."
	icon = 'icons/mob/augmentation/surplus_augments.dmi'
	brute_reduction = 0
	burn_reduction = 0
	incoming_brute_mult = 1
	incoming_burn_mult = 1
	incoming_pain_mult = 1
	disable_threshold = 0.75
	starting_children = list(/obj/item/bodypart/l_hand/robot/surplus)

/obj/item/bodypart/l_hand/robot/surplus
	name = "surplus prosthetic left hand"
	desc = "A skeletal, robotic limb. Outdated and fragile, but it's still better than nothing."
	icon = 'icons/mob/augmentation/surplus_augments.dmi'
	brute_reduction = 0
	burn_reduction = 0
	incoming_brute_mult = 1
	incoming_burn_mult = 1
	incoming_pain_mult = 1
	disable_threshold = 0.75

/obj/item/bodypart/r_leg/robot/surplus
	name = "surplus prosthetic right leg"
	desc = "A skeletal, robotic limb. Outdated and fragile, but it's still better than nothing."
	icon = 'icons/mob/augmentation/surplus_augments.dmi'
	brute_reduction = 0
	burn_reduction = 0
	incoming_brute_mult = 1
	incoming_burn_mult = 1
	incoming_pain_mult = 1
	disable_threshold = 0.75
	starting_children = list(/obj/item/bodypart/r_foot/robot/surplus)

/obj/item/bodypart/r_foot/robot/surplus
	name = "surplus prosthetic right foot"
	desc = "A skeletal, robotic limb. Outdated and fragile, but it's still better than nothing."
	icon = 'icons/mob/augmentation/surplus_augments.dmi'
	brute_reduction = 0
	burn_reduction = 0
	incoming_brute_mult = 1
	incoming_burn_mult = 1
	incoming_pain_mult = 1
	disable_threshold = 0.75

/obj/item/bodypart/l_leg/robot/surplus
	name = "surplus prosthetic left leg"
	desc = "A skeletal, robotic limb. Outdated and fragile, but it's still better than nothing."
	icon = 'icons/mob/augmentation/surplus_augments.dmi'
	brute_reduction = 0
	burn_reduction = 0
	incoming_brute_mult = 1
	incoming_burn_mult = 1
	incoming_pain_mult = 1
	disable_threshold = 0.75
	starting_children = list(/obj/item/bodypart/l_foot/robot/surplus)

/obj/item/bodypart/l_foot/robot/surplus
	name = "surplus prosthetic left foot"
	desc = "A skeletal, robotic limb. Outdated and fragile, but it's still better than nothing."
	icon = 'icons/mob/augmentation/surplus_augments.dmi'
	brute_reduction = 0
	burn_reduction = 0
	incoming_brute_mult = 1
	incoming_burn_mult = 1
	incoming_pain_mult = 1
	disable_threshold = 0.75


code:
/obj/item/bodypart/stump
	name = "limb stump"
	desc = "If you're reading this, you should be stumped."
	limb_flags = (BODYPART_NO_STUMP)
	limb_efficiency = 0
	max_damage = 25 //placeholder to avoid runtimes, actually set on inherit_from_limb()
	render_icon = 'modular_septic/icons/mob/human/overlays/stump.dmi'
	no_update = TRUE
	gender_rendering = FALSE

/obj/item/bodypart/stump/transfer_to_limb(obj/item/bodypart/new_limb, mob/living/carbon/was_owner)
	qdel(src)
	return FALSE

/obj/item/bodypart/stump/update_limb(dropping_limb, mob/living/carbon/source)
	return

/obj/item/bodypart/stump/get_limb_icon(dropped)
	if(!is_organic_limb())
		return
	. = list()
	var/image/stump = image(layer = -render_layer)
	if(dropped)
		stump = image(layer = -render_layer, dir = SOUTH)
	else
		stump = image(layer = -render_layer)
	stump.icon = render_icon
	stump.icon_state = "stump_[body_zone]"
	. += stump

/obj/item/bodypart/stump/get_mangled_state()
	return BODYPART_MANGLED_BOTH

/obj/item/bodypart/stump/drop_limb(special, dismembered, ignore_children, destroyed, wounding_type = WOUND_SLASH)
	return ..(destroyed = TRUE)

/obj/item/bodypart/stump/get_shock(painkiller_included, nerve_included)
	nerve_included = FALSE
	return ..()

/obj/item/bodypart/stump/is_stump()
	return TRUE

/obj/item/bodypart/stump/proc/inherit_from_limb(obj/item/bodypart/parent)
	name = "stump of a [parse_zone(parent.body_zone)]"
	parent_body_zone = parent.parent_body_zone
	body_zone = parent.body_zone
	body_part = parent.body_part
	max_cavity_item_size = parent.max_cavity_item_size
	max_cavity_volume = parent.max_cavity_volume
	amputation_point_name = parent.amputation_point_name
	bone_type = parent.bone_type
	artery_type = parent.artery_type
	tendon_type = parent.tendon_type
	nerve_type = parent.nerve_type
	cavity_name = parent.cavity_name
	dismemberment_sounds = parent.dismemberment_sounds?.Copy()
	hit_modifier = parent.hit_modifier
	hit_zone_modifier = parent.hit_zone_modifier
	max_damage = parent.max_damage
	max_pain_damage = parent.max_pain_damage
	max_stamina_damage = parent.max_stamina_damage
	status = parent.status
	limb_flags = parent.limb_flags
	limb_flags &= ~(BODYPART_HAS_BONE|BODYPART_HAS_TENDON|BODYPART_HAS_NERVE|BODYPART_VITAL)
	animal_origin = parent.animal_origin
	for(var/obj/item/organ/artery/artery in parent.getorganslotlist(ORGAN_SLOT_ARTERY))
		var/obj/item/organ/artery/copycat = new artery.type(src)
		copycat.name = "mangled [artery.name]"
		copycat.organ_efficiency = list(ORGAN_SLOT_ARTERY = 0)
		copycat.applyOrganDamage(artery.maxHealth)
		break


code:
/obj/item/bodypart
	/// Maximum amount of teeth this limb can hae
	var/max_teeth = 0
	/// Lisp modifier for when this limb is missing teeth
	var/datum/speech_modifier/lisp/teeth_mod
	/// Stack of teeth of the limb
	var/obj/item/stack/teeth/teeth_object

/// Proc for knocking teeth off from suitable bodyparts
/obj/item/bodypart/proc/knock_out_teeth(amount = 1, throw_dir = SOUTH)
	return

/// Returns how many teeth we currently have
/obj/item/bodypart/proc/get_teeth_amount()
	return 0

/// Updates our lisp and other teeth related stuff
/obj/item/bodypart/proc/update_teeth()
	return FALSE

/// Fills the bodypart with it's maximum amount of teeth
/obj/item/bodypart/proc/fill_teeth()
	if(max_teeth)
		if(!teeth_object)
			teeth_object = new(src)
		teeth_object.amount = max_teeth
		return TRUE

//Teeth object, used by the head limb to do teeth stuff
/obj/item/stack/teeth
	name = "teeth"
	singular_name = "tooth"
	desc = "Something that british people don't have."
	icon = 'modular_septic/icons/obj/surgery.dmi'
	icon_state = "tooth_4"
	max_amount = 32
	throwforce = 0
	force = 0

/obj/item/stack/teeth/Initialize(mapload, new_amount, merge)
	. = ..()
	icon_state = "tooth_[rand(1,4)]"

/obj/item/stack/teeth/proc/do_knock_out_animation(shrink_time = 5)
	transform = transform.Scale(2, 2)
	var/turned = rand(0, 360)
	transform = transform.Turn(rand(0, 360))
	var/new_transform = transform.Scale(0.5, 0.5)
	new_transform = transform.Turn(-turned)
	animate(src, transform = new_transform, time = shrink_time)

//many teethe
/obj/item/stack/teeth/full
	amount = 32


code:
/*
	Wounds are specific medical complications that can arise and be applied to (currently) carbons, with a focus on humans. All of the code for and related to this is heavily WIP,
	and the documentation will be slanted towards explaining what each part/piece is leading up to, until such a time as I finish the core implementations. The original design doc
	can be found at https://hackmd.io/@Ryll/r1lb4SOwU

	Wounds are datums that operate like a mix of diseases, brain traumas, and components, and are applied to a /obj/item/bodypart (preferably attached to a carbon) when they take large spikes of damage
	or under other certain conditions (thrown hard against a wall, sustained exposure to plasma fire, etc). Wounds are categorized by the three following criteria:
		1. Severity: Either MODERATE, SEVERE, or CRITICAL. See the hackmd for more details
		2. Viable zones: What body parts the wound is applicable to. Generic wounds like broken bones and severe burns can apply to every zone, but you may want to add special wounds for certain limbs
			like a twisted ankle for legs only, or open air exposure of the organs for particularly gruesome chest wounds. Wounds should be able to function for every zone they are marked viable for.
		3. Damage type: Currently either BRUTE or BURN. Again, see the hackmd for a breakdown of my plans for each type.

	When a body part suffers enough damage to get a wound, the severity (determined by a roll or something, worse damage leading to worse wounds), affected limb, and damage type sustained are factored into
	deciding what specific wound will be applied. I'd like to have a few different types of wounds for at least some of the choices, but I'm just doing rough generals for now. Expect polishing
*/

/datum/wound
	/// What it's named
	var/name = "Wound"
	/// The description shown on the scanners
	var/desc = ""
	/// The basic treatment suggested by health analyzers
	var/treat_text = ""
	/// What the limb looks like on a cursory examine
	var/examine_desc = "is badly hurt"

	/// needed for "your arm has a compound fracture" vs "your arm has some third degree burns"
	var/a_or_from = "a"
	/// The visible message when this happens
	var/occur_text = ""
	/// This sound will be played upon the wound being applied
	var/sound_effect

	/// Either WOUND_SEVERITY_TRIVIAL (meme wounds like stubbed toe), WOUND_SEVERITY_MODERATE, WOUND_SEVERITY_SEVERE, or WOUND_SEVERITY_CRITICAL (or maybe WOUND_SEVERITY_LOSS)
	var/severity = WOUND_SEVERITY_MODERATE
	/// The type of wound (WOUND_BLUNT, WOUND_ARTERY, etc)
	var/wound_type

	/// What body zones can we affect
	var/list/viable_zones = ALL_BODYPARTS
	/// Who owns the body part that we're wounding
	var/mob/living/carbon/victim = null
	/// The bodypart we're parented to
	var/obj/item/bodypart/limb = null
	/// What kind of limb status we can apply on - set to NONE if there is no status requirement
	var/required_status = BODYPART_ORGANIC

	/// Specific items such as bandages or sutures that can try directly treating this wound
	var/list/treatable_by
	/// Specific items such as bandages or sutures that can try directly treating this wound only if the user has the victim in an aggressive grab or higher
	var/list/treatable_by_grabbed
	/// Tools with the specified tool flag will also be able to try directly treating this wound
	var/treatable_tool
	/// How long it will take to treat this wound with a standard effective tool, assuming it doesn't need surgery
	var/base_treat_time = 5 SECONDS // Please remember that this is heavily affected by skills

	/// How much this reduces the limb's efficiency
	var/limb_efficiency_reduction = 0
	/// Using this limb in a do_after interaction will multiply the length by this duration (arms and hands)
	var/interaction_efficiency_penalty = 1
	/// Incoming damage on this limb will be multiplied by this, to simulate tenderness and vulnerability
	var/damage_multiplier_penalty = 1
	/// If set and this wound is applied to a leg/foot, we take this many deciseconds extra per step on this leg/foot
	var/limp_slowdown = 0
	/// How much we're contributing to this limb's bleed_rate
	var/blood_flow = 0

	/// Will apply this amount of damage to attached organs if set
	var/apply_organ_damage = 0
	/// How much this reduces an attached organ's efficiency, if it does it at all
	var/list/organ_efficiency_reduction

	/// The minimum we need to roll on [/obj/item/bodypart/proc/check_wounding] to begin suffering this wound, see check_wounding_mods() for more
	var/threshold_minimum
	/// How much having this wound will add to all future check_wounding() rolls on this limb, to allow progression to worse injuries with repeated damage
	var/threshold_penalty
	/// If we need to process each life tick
	var/processes = FALSE

	/// If having this wound makes currently makes the parent bodypart unusable
	var/disabling
	/// How much pain this wound causes
	var/pain_amount = 10
	/// How much this wound increases the damage on organ damage rolls
	var/organ_damage_increase = 0
	/// How much this wound reduces organ_damage_minimum in /obj/item/bodypart/damage_internal_organs()
	var/organ_minimum_reduction = 0
	/// How much this wound reduces organ_damaged_required in /obj/item/bodypart/damage_internal_organs()
	var/organ_required_reduction = 0

	/// What status effect we assign on application
	var/status_effect_type
	/// if you're a lazy git and just throw them in cryo, the wound will go away after accumulating severity * 25 power
	var/cryo_progress

	/// What we add to the carbon mob's descriptive wound string once acquired
	var/descriptive = ""
	/// What kind of scars this wound will create description wise once healed
	var/scar_keyword
	/// If we've already tried scarring while removing (since remove_wound calls qdel, and qdel calls remove wound, .....) TODO: make this cleaner
	var/already_scarred = FALSE
	/// If we forced this wound through badmin smite, we won't count it towards the round totals
	var/from_smite

	/// What flags apply to this wound
	var/wound_flags = (WOUND_SOUND_HINTS|WOUND_ACCEPTS_STUMP|WOUND_VISIBLE_THROUGH_CLOTHING)

/datum/wound/Destroy()
	if(limb?.wounds && (src in limb.wounds)) // destroy can call remove_wound() and remove_wound() calls qdel, so we check to make sure there's anything to remove first
		remove_wound()
	set_limb(null)
	victim = null
	return ..()

/**
 * Whether we should show an interactable topic in examines of the wound. href_list["wound_topic"]
 */
/datum/wound/proc/show_wound_topic(mob/user)
	return FALSE

/**
 * Gets the name of the wound with any interactable topic if possible
 */
/datum/wound/proc/get_topic_name(mob/user)
	return (show_wound_topic(user) ? "[lowertext(name)]" : lowertext(name))

/**
 * can_afflict() is used to check if a wound can even be applied on the victim and bodypart specified
 *
 * Arguments
 * L: The limb being wounded - We can get the owner via the limb itself.
 */
/datum/wound/proc/can_afflict(obj/item/bodypart/new_limb, datum/wound/old_wound = null)
	. = FALSE
	if(!istype(new_limb))
		return
	if(!(new_limb.owner))
		return
	if(!(new_limb.body_zone in viable_zones))
		return
	if(required_status && (new_limb.status != required_status))
		return
	if(new_limb.is_stump() && !(CHECK_BITFIELD(wound_flags, WOUND_ACCEPTS_STUMP)))
		return
	if(HAS_TRAIT(new_limb, TRAIT_NEVER_WOUNDED) || HAS_TRAIT(new_limb.owner, TRAIT_NEVER_WOUNDED))
		return
	var/epic_fail = TRUE
	switch(wound_type)
		if(WOUND_BLUNT)
			switch(severity)
				if(WOUND_SEVERITY_MODERATE)
					for(var/thing in new_limb.getorganslotlist(ORGAN_SLOT_BONE))
						var/obj/item/organ/bone/bone = thing
						if((bone.bone_flags & BONE_JOINTED) && (bone.damage < bone.low_threshold))
							epic_fail = FALSE
				if(WOUND_SEVERITY_SEVERE)
					for(var/thing in new_limb.getorganslotlist(ORGAN_SLOT_BONE))
						var/obj/item/organ/bone/bone = thing
						if(bone.damage < bone.medium_threshold)
							epic_fail = FALSE
				else
					for(var/thing in new_limb.getorganslotlist(ORGAN_SLOT_BONE))
						var/obj/item/organ/bone/bone = thing
						if(!bone.damage < bone.high_threshold)
							epic_fail = FALSE
		if(WOUND_ARTERY)
			for(var/thing in new_limb.getorganslotlist(ORGAN_SLOT_ARTERY))
				var/obj/item/organ/artery/artery = thing
				if(artery.damage < artery.maxHealth)
					epic_fail = FALSE
		if(WOUND_TENDON)
			for(var/thing in new_limb.getorganslotlist(ORGAN_SLOT_TENDON))
				var/obj/item/organ/tendon/tendon = thing
				if(tendon.damage < tendon.maxHealth)
					epic_fail = FALSE
		if(WOUND_NERVE)
			for(var/thing in new_limb.getorganslotlist(ORGAN_SLOT_NERVE))
				var/obj/item/organ/nerve/nerve = thing
				if(nerve.damage < nerve.maxHealth)
					epic_fail = FALSE
		else
			epic_fail = FALSE
	if(epic_fail)
		return
	// we accept promotions and demotions, but no point in redundancy.
	// This should have already been checked wherever the wound was rolled and applied for (see: bodypart damage code), but we do an extra check
	// in case we ever directly add wounds.
	// This check is avoided if our wound type has WOUND_STACKING as a flag.
	if(!CHECK_BITFIELD(wound_flags, WOUND_STACKABLE))
		for(var/thing in new_limb.wounds)
			var/datum/wound/preexisting_wound = thing
			if((preexisting_wound.type == type) && (preexisting_wound != old_wound))
				return
	return TRUE

/**
 * apply_wound() is used once a wound type is instantiated to assign it to a bodypart, and actually come into play.
 *
 *
 * Arguments:
 * * L: The bodypart we're wounding, we don't care about the person, we can get them through the limb
 * * silent: Not actually necessary I don't think, was originally used for demoting wounds so they wouldn't make new messages, but I believe old_wound took over that, I may remove this shortly
 * * old_wound: If our new wound is a replacement for one of the same time (promotion or demotion), we can reference the old one just before it's removed to copy over necessary vars
 * * smited- If this is a smite, we don't care about this wound for stat tracking purposes (not yet implemented)
 */
/datum/wound/proc/apply_wound(obj/item/bodypart/new_limb, silent = FALSE, datum/wound/old_wound = null, smited = FALSE, add_descriptive = TRUE)
	if(!can_afflict(new_limb, old_wound))
		qdel(src)
		return

	victim = new_limb.owner
	RegisterSignal(victim, COMSIG_PARENT_QDELETING, .proc/null_victim)
	set_limb(new_limb)
	LAZYADD(victim.all_wounds, src)
	LAZYADD(limb.wounds, src)
	limb.update_wounds()
	if(status_effect_type)
		victim.apply_status_effect(status_effect_type, src)
	SEND_SIGNAL(victim, COMSIG_CARBON_GAIN_WOUND, src, limb)

	var/demoted
	if(old_wound)
		demoted = (severity <= old_wound.severity)

	if(!silent && !demoted && add_descriptive)
		if(descriptive)
			SEND_SIGNAL(victim, COMSIG_CARBON_ADD_TO_WOUND_MESSAGE, " [descriptive]")
		if(sound_effect)
			playsound(new_limb.owner, pick(sound_effect), 70 + 20 * severity, TRUE)
	else if(!silent && !demoted)
		victim.visible_message(span_danger("[victim]'s [limb.name] [occur_text]!"), \
				span_userdanger("Your [limb.name] [occur_text]!"), \
				vision_distance = COMBAT_MESSAGE_RANGE)
		if(sound_effect)
			playsound(new_limb.owner, pick(sound_effect), 70 + 20 * severity, TRUE)

	if(!demoted)
		wound_injury(old_wound)
		second_wind()

	return TRUE

/datum/wound/proc/null_victim()
	SIGNAL_HANDLER
	victim = null

/datum/wound/proc/source_died()
	SIGNAL_HANDLER
	qdel(src)

/// Remove the wound from whatever it's afflicting, and cleans up whateverstatus effects it had or modifiers it had on interaction times. ignore_limb is used for detachments where we only want to forget the victim
/datum/wound/proc/remove_wound(ignore_limb, replaced = FALSE)
	//TODO: have better way to tell if we're getting removed without replacement (full heal) scar stuff
	set_disabling(FALSE)
	if(limb && !already_scarred && !replaced)
		already_scarred = TRUE
		if(scar_keyword)
			var/datum/scar/new_scar = new
			new_scar.generate(limb, src)
	if(victim)
		LAZYREMOVE(victim.all_wounds, src)
		if(!victim.all_wounds)
			victim.clear_alert("wound")
		SEND_SIGNAL(victim, COMSIG_CARBON_LOSE_WOUND, src, limb)
	if(limb && !ignore_limb)
		LAZYREMOVE(limb.wounds, src)
		limb.update_wounds(replaced)
		limb.update_limb_efficiency()

/**
 * replace_wound() is used when you want to replace the current wound with a new wound, presumably of the same category, just of a different severity (either up or down counts)
 *
 * This proc actually instantiates the new wound based off the specific type path passed, then returns the new instantiated wound datum.
 *
 * Arguments:
 * * new_type- The TYPE PATH of the wound you want to replace this, like /datum/wound/slash/severe
 * * smited- If this is a smite, we don't care about this wound for stat tracking purposes (not yet implemented)
 */
/datum/wound/proc/replace_wound(new_type, smited = FALSE)
	var/datum/wound/new_wound = new new_type
	already_scarred = TRUE
	remove_wound(replaced=TRUE)
	new_wound.apply_wound(limb, TRUE, old_wound = src, smited = smited)
	. = new_wound
	qdel(src)

/// The immediate negative effects faced as a result of the wound
/datum/wound/proc/wound_injury(datum/wound/old_wound = null)
	return

/// Proc called to change the variable `limb` and react to the event.
/datum/wound/proc/set_limb(new_value)
	if(limb == new_value)
		return FALSE //Limb can either be a reference to something or `null`. Returning the number variable makes it clear no change was made.
	. = limb
	if(limb)
		UnregisterSignal(limb, COMSIG_PARENT_QDELETING)
	limb = new_value
	RegisterSignal(new_value, COMSIG_PARENT_QDELETING, .proc/source_died)
	if(. && disabling)
		var/obj/item/bodypart/old_limb = .
		REMOVE_TRAIT(old_limb, TRAIT_PARALYSIS, src)
		REMOVE_TRAIT(old_limb, TRAIT_DISABLED_BY_WOUND, src)
	if(limb)
		if(disabling)
			ADD_TRAIT(limb, TRAIT_PARALYSIS, src)
			ADD_TRAIT(limb, TRAIT_DISABLED_BY_WOUND, src)

/// Proc called to change the variable `disabling` and react to the event.
/datum/wound/proc/set_disabling(new_value)
	if(disabling == new_value)
		return
	. = disabling
	disabling = new_value
	if(disabling)
		if(!. && limb) //Gained disabling.
			ADD_TRAIT(limb, TRAIT_PARALYSIS, src)
			ADD_TRAIT(limb, TRAIT_DISABLED_BY_WOUND, src)
	else if(. && limb) //Lost disabling.
		REMOVE_TRAIT(limb, TRAIT_PARALYSIS, src)
		REMOVE_TRAIT(limb, TRAIT_DISABLED_BY_WOUND, src)
	if(limb?.can_be_disabled)
		limb.update_disabled()

/// Additional beneficial effects when the wound is gained, in case you want to give a temporary boost to allow the victim to try an escape or last stand
/datum/wound/proc/second_wind()
	switch(severity)
		if(WOUND_SEVERITY_MODERATE)
			victim.reagents.add_reagent(/datum/reagent/determination, WOUND_DETERMINATION_MODERATE)
		if(WOUND_SEVERITY_SEVERE)
			victim.reagents.add_reagent(/datum/reagent/determination, WOUND_DETERMINATION_SEVERE)
		if(WOUND_SEVERITY_CRITICAL)
			victim.reagents.add_reagent(/datum/reagent/determination, WOUND_DETERMINATION_CRITICAL)
		if(WOUND_SEVERITY_LOSS)
			victim.reagents.add_reagent(/datum/reagent/determination, WOUND_DETERMINATION_LOSS)

/**
 * try_treating() is an intercept run from [/mob/living/carbon/proc/attackby] right after surgeries but before anything else. Return TRUE here if the item is something that is relevant to treatment to take over the interaction.
 *
 * This proc leads into [/datum/wound/proc/treat] and probably shouldn't be added onto in children types. You can specify what items or tools you want to be intercepted
 * with var/list/treatable_by and var/treatable_tool, then if an item fulfills one of those requirements and our wound claims it first, it goes over to treat() and treat_self().
 *
 * Arguments:
 * * I: The item we're trying to use
 * * user: The mob trying to use it on us
 */
/datum/wound/proc/try_treating(obj/item/I, mob/user)
	// first we weed out if we're not dealing with our wound's bodypart, or if it might be an attack
	if(!I || limb.body_zone != user.zone_selected)
		return FALSE

	if(isliving(user))
		var/mob/living/tendee = user
		if(I.force && !IS_HELP_INTENT(tendee, null))
			return FALSE

	var/allowed = FALSE

	// check if we have a valid treatable tool
	if(I.tool_behaviour == treatable_tool)
		allowed = TRUE
	else if(treatable_tool == TOOL_CAUTERY && I.get_temperature() && user == victim) // allow improvised cauterization on yourself without an aggro grab
		allowed = TRUE
	// failing that, see if we're aggro grabbing them and if we have an item that works for aggro grabs only
	else if(user.pulling == victim && user.grab_state >= GRAB_AGGRESSIVE && check_grab_treatments(I, user))
		allowed = TRUE
	// failing THAT, we check if we have a generally allowed item
	else
		for(var/allowed_type in treatable_by)
			if(istype(I, allowed_type))
				allowed = TRUE
				break

	// if none of those apply, we return false to avoid interrupting
	if(!allowed)
		return FALSE

	// now that we've determined we have a valid attempt at treating, we can stomp on their dreams if we're already interacting with the patient or if their part is obscured
	if(DOING_INTERACTION_WITH_TARGET(user, victim))
		to_chat(user, span_warning("You're already interacting with [victim]!"))
		return TRUE

	// next we check if the bodypart in actually accessible (not under thick clothing). We skip the species trait check since skellies
	// & such may need to use bone gel but may be wearing a space suit for..... whatever reason a skeleton would wear a space suit for
	if(ishuman(victim))
		var/mob/living/carbon/human/victim_human = victim
		if(!victim_human.try_inject(user, injection_flags = INJECT_CHECK_IGNORE_SPECIES | INJECT_TRY_SHOW_ERROR_MESSAGE))
			return TRUE

	// lastly, treat them
	treat(I, user)
	return TRUE

/// Return TRUE if we have an item that can only be used while aggro grabbed (unhanded aggro grab treatments go in [/datum/wound/proc/try_handling]). Treatment is still is handled in [/datum/wound/proc/treat]
/datum/wound/proc/check_grab_treatments(obj/item/I, mob/user)
	return FALSE

/// Like try_treating() but for unhanded interactions from humans, used by joint dislocations for manual bodypart chiropractice for example. Ignores thick material checks since you can pop an arm into place through a thick suit unlike using sutures
/datum/wound/proc/try_handling(mob/living/carbon/human/user)
	return FALSE

/// Someone is using something that might be used for treating the wound on this limb
/datum/wound/proc/treat(obj/item/I, mob/user)
	return

/// If var/processing is TRUE, this is run on each life tick
/datum/wound/proc/handle_process(delta_time, times_fired)
	return

/// For use in do_after callback checks
/datum/wound/proc/still_exists()
	return (!QDELETED(src) && limb)

/// When our parent bodypart is hurt
/datum/wound/proc/receive_damage(wounding_type, wounding_dmg, wound_bonus)
	return

/// Called from cryoxadone and pyroxadone when they're proc'ing. Wounds will slowly be fixed separately from other methods when these are in effect. crappy name but eh
/datum/wound/proc/on_xadone(power)
	cryo_progress += power
	if(cryo_progress > 33 * severity)
		qdel(src)

/// When synthflesh is applied to the victim, we call this. No sense in setting up an entire chem reaction system for wounds when we only care for a few chems. Probably will change in the future
/datum/wound/proc/on_synthflesh(power)
	return

/// Called when the patient is undergoing stasis, so that having fully treated a wound doesn't make you sit there helplessly until you think to unbuckle them
/datum/wound/proc/on_stasis(delta_time, times_fired)
	return

/// Used when we're being dragged while bleeding, the value we return is how much bloodloss this wound causes from being dragged. Since it's a proc, you can let bandages soak some of the blood
/datum/wound/proc/drag_bleed_amount()
	return

/**
 * get_bleed_rate_of_change() is used in [/mob/living/carbon/proc/bleed_warn] to gauge whether this wound (if bleeding) is becoming worse, better, or staying the same over time
 *
 * Returns BLOOD_FLOW_STEADY if we're not bleeding or there's no change (like piercing), BLOOD_FLOW_DECREASING if we're clotting (non-critical slashes, gauzed, coagulant, etc), BLOOD_FLOW_INCREASING if we're opening up (crit slashes/heparin)
 */
/datum/wound/proc/get_bleed_rate_of_change()
	if(blood_flow && HAS_TRAIT(victim, TRAIT_BLOODY_MESS))
		return BLOOD_FLOW_INCREASING
	return BLOOD_FLOW_STEADY

/**
 * get_examine_description() is used in carbon/examine and human/examine to show the status of this wound. Useful if you need to show some status like the wound being splinted or bandaged.
 *
 * Return the full string line you want to show, note that we're already dealing with the 'warning' span at this point, and that \n is already appended for you in the place this is called from
 *
 * Arguments:
 * * mob/user: The user examining the wound's owner, if that matters
 */
/datum/wound/proc/get_examine_description(mob/user)
	if(!examine_desc)
		return
	. = "[victim.p_their(TRUE)] [limb.name] [examine_desc]"
	. = severity <= WOUND_SEVERITY_MODERATE ? "[.]." : "[.]!"
	. = span_danger("[.]")

/datum/wound/proc/get_scanner_description(mob/user)
	return "Type: [name]\nSeverity: [severity_text()]\nDescription: [desc]\nRecommended Treatment: [treat_text]"

/datum/wound/proc/severity_text()
	switch(severity)
		if(WOUND_SEVERITY_TRIVIAL)
			return "Trivial"
		if(WOUND_SEVERITY_MODERATE)
			return "Moderate"
		if(WOUND_SEVERITY_SEVERE)
			return "Severe"
		if(WOUND_SEVERITY_CRITICAL)
			return "Critical"


code:
/// Joint Dislocation (Moderate Blunt)
/datum/wound/blunt/moderate/mechanic
	name = "Joint Desynchronization"
	desc = "Parts of the patient's actuators have forcefully disconnected from each other, causing delayed and inefficient limb movement."
	treat_text = "Recommended wrenching of the affected limb, though manual synchronization by applying an aggressive grab to the patient and helpfully interacting with afflicted limb may suffice.  Use of synthetic healing chemicals may also help."
	examine_desc = "has visibly disconnected rotors"
	occur_text = "snaps and becomes unseated"
	descriptive = "A joint is snapped!"

	required_status = BODYPART_ROBOTIC
	treatable_tool = TOOL_WRENCH
	scar_keyword = null

/*
	Severe (Hairline Fracture)
*/
/datum/wound/blunt/severe/mechanic
	name = "Malfunctioning Actuators"
	desc = "Patient's actuators are malfunctioning, causing reduced limb functionality and performance."
	treat_text = "Recommended wrenching and taping of the affected limb. Use of synthetic healing chemicals may also help."
	examine_desc = "has loose and disconnected bits of metal"
	occur_text = "loudly hums as some loose nuts and bolts fall out"
	descriptive = "The exoskeleton is fractured!"

	required_status = BODYPART_ROBOTIC
	treatable_tool = TOOL_WRENCH
	scar_keyword = null

/// Compound Fracture (Critical Blunt)
/datum/wound/blunt/critical/mechanic
	name = "Broken Actuators"
	desc = "Patient's actuators have suffered severe dents and component losses, causing a severe decrease in limb functionality and performance."
	treat_text = "Recommended complete internal component repair and replacement, but wrenching and taping of the limb might suffice. Use of synthetic healing chemicals may also help."
	examine_desc = "is damaged at several spots, with protuding bits of metal"
	occur_text = "loudly hums as it's rotors scrapes away bits of metal"
	descriptive = "The exoskeleton is shattered!"

	required_status = BODYPART_ROBOTIC
	treatable_tool = TOOL_WRENCH
	scar_keyword = null


code:
/datum/wound/artery
	name = "Torn Artery"
	sound_effect = 'modular_septic/sound/gore/artery.ogg'
	base_treat_time = 3 SECONDS
	wound_type = WOUND_ARTERY
	severity = WOUND_SEVERITY_CRITICAL
	desc = "Patient's artery has been violently torn, causing severe hemorrhage."
	treat_text = "Immediate incision of the limb followed by suturing of the torn artery."
	examine_desc = "is bleeding profusely"
	occur_text = "is violently torn, severing an artery"

	threshold_minimum = 65
	treatable_by = list(/obj/item/stack/medical/suture, /obj/item/stack/medical/nervemend)
	wound_flags = (WOUND_SOUND_HINTS|WOUND_ACCEPTS_STUMP|WOUND_VISIBLE_THROUGH_CLOTHING)

/datum/wound/artery/apply_wound(obj/item/bodypart/new_limb, silent = FALSE, datum/wound/old_wound = null, smited = FALSE, add_descriptive = TRUE)
	. = ..()
	if(!.)
		return
	var/obj/item/organ/artery/artery
	for(var/thing in shuffle(new_limb.getorganslotlist(ORGAN_SLOT_ARTERY)))
		var/obj/item/organ/possible_artery = thing
		if(possible_artery.damage >= possible_artery.maxHealth)
			continue
		artery = possible_artery
		break
	var/dissection = FALSE
	if(artery?.damage >= (artery?.maxHealth * 0.5))
		dissection = TRUE
	if(artery)
		artery.tear()
	var/final_descriptive = "An artery is [dissection ? "torn" : "damaged"]!"
	// Carotid and aorta are pretty significantly dangerous
	if(istype(artery, ARTERY_NECK) || istype(artery, ARTERY_CHEST))
		final_descriptive = "\The [artery] is [dissection ? "dissected" : "damaged"]!"
	if(victim)
		if(sound_effect)
			playsound(new_limb.owner, pick(sound_effect), 70 + 20 * severity, TRUE)
		if(add_descriptive)
			SEND_SIGNAL(victim, COMSIG_CARBON_ADD_TO_WOUND_MESSAGE, span_flashingdanger(" [final_descriptive]"))
	qdel(src)