initial commit - cross reference with 5th port - obviously has compile errors
This commit is contained in:
@@ -0,0 +1,359 @@
|
||||
|
||||
/obj/item/bodypart
|
||||
name = "limb"
|
||||
desc = "why is it detached..."
|
||||
force = 3
|
||||
throwforce = 3
|
||||
icon_state = ""
|
||||
var/mob/living/carbon/human/owner = null
|
||||
var/status = ORGAN_ORGANIC
|
||||
var/body_zone //"chest", "l_arm", etc , used for def_zone
|
||||
var/body_part = null //bitflag used to check which clothes cover this bodypart
|
||||
var/brutestate = 0
|
||||
var/burnstate = 0
|
||||
var/brute_dam = 0
|
||||
var/burn_dam = 0
|
||||
var/max_damage = 0
|
||||
var/list/embedded_objects = list()
|
||||
|
||||
//Coloring and proper item icon update
|
||||
var/skin_tone = ""
|
||||
var/body_gender = ""
|
||||
var/species_id = ""
|
||||
var/should_draw_gender = FALSE
|
||||
var/should_draw_greyscale = FALSE
|
||||
var/species_color = ""
|
||||
var/mutation_color = ""
|
||||
var/no_update = 0
|
||||
|
||||
var/px_x = 0
|
||||
var/px_y = 0
|
||||
|
||||
var/state_flags
|
||||
|
||||
/obj/item/bodypart/examine(mob/user)
|
||||
..()
|
||||
if(brute_dam > 0)
|
||||
user << "<span class='warning'>This limb has [brute_dam > 30 ? "severe" : "minor"] bruising.</span>"
|
||||
if(burn_dam > 0)
|
||||
user << "<span class='warning'>This limb has [burn_dam > 30 ? "severe" : "minor"] burns.</span>"
|
||||
|
||||
|
||||
/obj/item/bodypart/Destroy()
|
||||
if(owner)
|
||||
owner.bodyparts -= src
|
||||
owner = null
|
||||
return ..()
|
||||
|
||||
/obj/item/bodypart/attack(mob/living/carbon/C, mob/user)
|
||||
if(ishuman(C))
|
||||
var/mob/living/carbon/human/H = C
|
||||
if(EASYLIMBATTACHMENT in H.dna.species.specflags)
|
||||
if(!H.get_bodypart(body_zone))
|
||||
if(H == user)
|
||||
H.visible_message("<span class='warning'>[H] jams [src] into \his empty socket!</span>",\
|
||||
"<span class='notice'>You force [src] into your empty socket, and it locks into place!</span>")
|
||||
else
|
||||
H.visible_message("<span class='warning'>[user] jams [src] into [H]'s empty socket!</span>",\
|
||||
"<span class='notice'>[user] forces [src] into your empty socket, and it locks into place!</span>")
|
||||
user.unEquip(src,1)
|
||||
attach_limb(C)
|
||||
return
|
||||
..()
|
||||
|
||||
/obj/item/bodypart/attackby(obj/item/W, mob/user, params)
|
||||
if(W.sharpness)
|
||||
add_fingerprint(user)
|
||||
if(!contents.len)
|
||||
user << "<span class='warning'>There is nothing left inside [src]!</span>"
|
||||
return
|
||||
playsound(loc, 'sound/weapons/slice.ogg', 50, 1, -1)
|
||||
user.visible_message("<span class='warning'>[user] begins to cut through the bone in [src].</span>",\
|
||||
"<span class='notice'>You begin to cut through the bone in [src]...</span>")
|
||||
if(do_after(user, 54, target = src))
|
||||
drop_organs(user)
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/item/bodypart/throw_impact(atom/hit_atom)
|
||||
..()
|
||||
playsound(get_turf(src), 'sound/misc/splort.ogg', 50, 1, -1)
|
||||
|
||||
/obj/item/bodypart/proc/drop_organs(mob/user)
|
||||
var/turf/T = get_turf(src)
|
||||
playsound(T, 'sound/misc/splort.ogg', 50, 1, -1)
|
||||
for(var/obj/item/I in src)
|
||||
I.loc = T
|
||||
|
||||
//Applies brute and burn damage to the organ. Returns 1 if the damage-icon states changed at all.
|
||||
//Damage will not exceed max_damage using this proc
|
||||
//Cannot apply negative damage
|
||||
/obj/item/bodypart/proc/take_damage(brute, burn)
|
||||
if(owner && (owner.status_flags & GODMODE))
|
||||
return 0 //godmode
|
||||
brute = max(brute,0)
|
||||
burn = max(burn,0)
|
||||
|
||||
|
||||
if(status == ORGAN_ROBOTIC) //This makes robolimbs not damageable by chems and makes it stronger
|
||||
brute = max(0, brute - 5)
|
||||
burn = max(0, burn - 4)
|
||||
|
||||
var/can_inflict = max_damage - (brute_dam + burn_dam)
|
||||
if(!can_inflict)
|
||||
return 0
|
||||
|
||||
if((brute + burn) < can_inflict)
|
||||
brute_dam += brute
|
||||
burn_dam += burn
|
||||
else
|
||||
if(brute > 0)
|
||||
if(burn > 0)
|
||||
brute = round( (brute/(brute+burn)) * can_inflict, 1 )
|
||||
burn = can_inflict - brute //gets whatever damage is left over
|
||||
brute_dam += brute
|
||||
burn_dam += burn
|
||||
else
|
||||
brute_dam += can_inflict
|
||||
else
|
||||
if(burn > 0)
|
||||
burn_dam += can_inflict
|
||||
else
|
||||
return 0
|
||||
if(owner)
|
||||
owner.updatehealth()
|
||||
return update_bodypart_damage_state()
|
||||
|
||||
|
||||
//Heals brute and burn damage for the organ. Returns 1 if the damage-icon states changed at all.
|
||||
//Damage cannot go below zero.
|
||||
//Cannot remove negative damage (i.e. apply damage)
|
||||
/obj/item/bodypart/proc/heal_damage(brute, burn, robotic)
|
||||
|
||||
if(robotic && status != ORGAN_ROBOTIC) //This makes organic limbs not heal when the proc is in Robotic mode.
|
||||
return
|
||||
|
||||
if(!robotic && status == ORGAN_ROBOTIC) //This makes robolimbs not healable by chems.
|
||||
return
|
||||
|
||||
brute_dam = max(brute_dam - brute, 0)
|
||||
burn_dam = max(burn_dam - burn, 0)
|
||||
if(owner)
|
||||
owner.updatehealth()
|
||||
return update_bodypart_damage_state()
|
||||
|
||||
|
||||
//Returns total damage...kinda pointless really
|
||||
/obj/item/bodypart/proc/get_damage()
|
||||
return brute_dam + burn_dam
|
||||
|
||||
|
||||
//Updates an organ's brute/burn states for use by update_damage_overlays()
|
||||
//Returns 1 if we need to update overlays. 0 otherwise.
|
||||
/obj/item/bodypart/proc/update_bodypart_damage_state()
|
||||
if(status == ORGAN_ORGANIC) //Robotic limbs show no damage - RR
|
||||
var/tbrute = round( (brute_dam/max_damage)*3, 1 )
|
||||
var/tburn = round( (burn_dam/max_damage)*3, 1 )
|
||||
if((tbrute != brutestate) || (tburn != burnstate))
|
||||
brutestate = tbrute
|
||||
burnstate = tburn
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
|
||||
//Change organ status
|
||||
/obj/item/bodypart/proc/change_bodypart_status(new_limb_status, heal_limb)
|
||||
status = new_limb_status
|
||||
if(heal_limb)
|
||||
burn_dam = 0
|
||||
brute_dam = 0
|
||||
brutestate = 0
|
||||
burnstate = 0
|
||||
if(owner)
|
||||
owner.updatehealth()
|
||||
owner.update_body() //if our head becomes robotic, we remove the lizard horns and human hair.
|
||||
owner.update_hair()
|
||||
owner.update_damage_overlays()
|
||||
|
||||
//we inform the bodypart of the changes that happened to the owner, or give it the informations from a source mob.
|
||||
/obj/item/bodypart/proc/update_limb(dropping_limb, mob/living/carbon/human/source)
|
||||
var/mob/living/carbon/human/H
|
||||
if(source)
|
||||
H = source
|
||||
else
|
||||
H = owner
|
||||
if(!istype(H))
|
||||
return
|
||||
|
||||
should_draw_greyscale = FALSE
|
||||
|
||||
var/datum/species/S = H.dna.species
|
||||
species_id = S.limbs_id
|
||||
|
||||
if(S.use_skintones)
|
||||
skin_tone = H.skin_tone
|
||||
should_draw_greyscale = TRUE
|
||||
else
|
||||
skin_tone = ""
|
||||
|
||||
body_gender = H.gender
|
||||
should_draw_gender = S.sexes
|
||||
|
||||
if(MUTCOLORS in S.specflags)
|
||||
if(S.fixed_mut_color)
|
||||
species_color = S.fixed_mut_color
|
||||
else
|
||||
species_color = H.dna.features["mcolor"]
|
||||
should_draw_greyscale = TRUE
|
||||
else
|
||||
species_color = ""
|
||||
|
||||
if(H.disabilities & HUSK)
|
||||
species_id = "husk"
|
||||
should_draw_gender = FALSE
|
||||
should_draw_greyscale = FALSE
|
||||
|
||||
if(!dropping_limb && H.dna.check_mutation(HULK))
|
||||
mutation_color = "00aa00"
|
||||
else
|
||||
mutation_color = ""
|
||||
|
||||
if(dropping_limb)
|
||||
no_update = 1 //when attached, the limb won't be affected by the appearance changes of its mob owner.
|
||||
|
||||
//to update the bodypart's icon when not attached to a mob
|
||||
/obj/item/bodypart/proc/update_icon_dropped()
|
||||
cut_overlays()
|
||||
var/image/I = get_limb_icon(1)
|
||||
if(I)
|
||||
I.pixel_x = px_x
|
||||
I.pixel_y = px_y
|
||||
add_overlay(I)
|
||||
|
||||
//Gives you a proper icon appearance for the dismembered limb
|
||||
/obj/item/bodypart/proc/get_limb_icon(dropped)
|
||||
var/image/I
|
||||
|
||||
var/icon_gender = (body_gender == FEMALE) ? "f" : "m" //gender of the icon, if applicable
|
||||
|
||||
if((body_zone != "head" && body_zone != "chest"))
|
||||
should_draw_gender = FALSE
|
||||
|
||||
var/image_dir
|
||||
if(dropped)
|
||||
image_dir = SOUTH
|
||||
if(status == ORGAN_ORGANIC)
|
||||
if(should_draw_greyscale)
|
||||
if(should_draw_gender)
|
||||
I = image("icon"='icons/mob/human_parts_greyscale.dmi', "icon_state"="[species_id]_[body_zone]_[icon_gender]_s", "layer"=-BODYPARTS_LAYER, "dir"=image_dir)
|
||||
else
|
||||
I = image("icon"='icons/mob/human_parts_greyscale.dmi', "icon_state"="[species_id]_[body_zone]_s", "layer"=-BODYPARTS_LAYER, "dir"=image_dir)
|
||||
else
|
||||
if(should_draw_gender)
|
||||
I = image("icon"='icons/mob/human_parts.dmi', "icon_state"="[species_id]_[body_zone]_[icon_gender]_s", "layer"=-BODYPARTS_LAYER, "dir"=image_dir)
|
||||
else
|
||||
I = image("icon"='icons/mob/human_parts.dmi', "icon_state"="[species_id]_[body_zone]_s", "layer"=-BODYPARTS_LAYER, "dir"=image_dir)
|
||||
else
|
||||
if(should_draw_gender)
|
||||
I = image("icon"='icons/mob/augments.dmi', "icon_state"="[body_zone]_[icon_gender]_s", "layer"=-BODYPARTS_LAYER, "dir"=image_dir)
|
||||
else
|
||||
I = image("icon"='icons/mob/augments.dmi', "icon_state"="[body_zone]_s", "layer"=-BODYPARTS_LAYER, "dir"=image_dir)
|
||||
return I
|
||||
|
||||
|
||||
if(!should_draw_greyscale)
|
||||
return I
|
||||
|
||||
//Greyscale Colouring
|
||||
var/draw_color
|
||||
|
||||
if(skin_tone) //Limb has skin color variable defined, use it
|
||||
draw_color = skintone2hex(skin_tone)
|
||||
if(species_color)
|
||||
draw_color = species_color
|
||||
if(mutation_color)
|
||||
draw_color = mutation_color
|
||||
|
||||
if(draw_color)
|
||||
I.color = "#[draw_color]"
|
||||
//End Greyscale Colouring
|
||||
|
||||
return I
|
||||
|
||||
|
||||
|
||||
/obj/item/bodypart/chest
|
||||
name = "chest"
|
||||
desc = "It's impolite to stare at a person's chest."
|
||||
max_damage = 200
|
||||
body_zone = "chest"
|
||||
body_part = CHEST
|
||||
px_x = 0
|
||||
px_y = 0
|
||||
var/obj/item/cavity_item
|
||||
|
||||
/obj/item/bodypart/chest/Destroy()
|
||||
if(cavity_item)
|
||||
qdel(cavity_item)
|
||||
return ..()
|
||||
|
||||
/obj/item/bodypart/l_arm
|
||||
name = "left arm"
|
||||
desc = "Did you know that 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."
|
||||
attack_verb = list("slapped", "punched")
|
||||
max_damage = 50
|
||||
body_zone ="l_arm"
|
||||
body_part = ARM_LEFT
|
||||
px_x = -6
|
||||
px_y = 0
|
||||
|
||||
/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."
|
||||
attack_verb = list("slapped", "punched")
|
||||
max_damage = 50
|
||||
body_zone = "r_arm"
|
||||
body_part = ARM_RIGHT
|
||||
px_x = 6
|
||||
px_y = 0
|
||||
|
||||
/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."
|
||||
attack_verb = list("kicked", "stomped")
|
||||
max_damage = 50
|
||||
body_zone = "l_leg"
|
||||
body_part = LEG_LEFT
|
||||
px_x = -2
|
||||
px_y = 12
|
||||
|
||||
/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 apparently then it detaches.\n\
|
||||
The hokey pokey has certainly changed a lot since space colonisation."
|
||||
// alternative spellings of 'pokey' are availible
|
||||
attack_verb = list("kicked", "stomped")
|
||||
max_damage = 50
|
||||
body_zone = "r_leg"
|
||||
body_part = LEG_RIGHT
|
||||
px_x = 2
|
||||
px_y = 12
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/obj/item/severedtail
|
||||
name = "tail"
|
||||
desc = "A severed tail. Somewhere, no doubt, a lizard hater is very \
|
||||
pleased with themselves."
|
||||
icon = 'icons/obj/surgery.dmi'
|
||||
icon_state = "severedtail"
|
||||
color = "#161"
|
||||
var/markings = "Smooth"
|
||||
@@ -0,0 +1,322 @@
|
||||
|
||||
/obj/item/bodypart/proc/can_dismember(obj/item/I)
|
||||
. = (get_damage() >= (max_damage - I.armour_penetration/2))
|
||||
|
||||
//Dismember a limb
|
||||
/obj/item/bodypart/proc/dismember(dam_type = BRUTE)
|
||||
var/mob/living/carbon/human/H = owner
|
||||
if(!istype(H) || (NODISMEMBER in H.dna.species.specflags)) // species don't allow dismemberment
|
||||
return 0
|
||||
|
||||
var/obj/item/bodypart/affecting = H.get_bodypart("chest")
|
||||
affecting.take_damage(Clamp(brute_dam/2, 15, 50), Clamp(burn_dam/2, 0, 50)) //Damage the chest based on limb's existing damage
|
||||
H.visible_message("<span class='danger'><B>[H]'s [src.name] has been violently dismembered!</B></span>")
|
||||
H.emote("scream")
|
||||
drop_limb()
|
||||
|
||||
if(dam_type == BURN)
|
||||
burn()
|
||||
return 1
|
||||
add_mob_blood(H)
|
||||
var/turf/location = H.loc
|
||||
if(istype(location))
|
||||
H.add_splatter_floor(location)
|
||||
var/direction = pick(cardinal)
|
||||
var/t_range = rand(2,max(throw_range/2, 2))
|
||||
var/turf/target_turf = get_turf(src)
|
||||
for(var/i in 1 to t_range-1)
|
||||
var/turf/new_turf = get_step(target_turf, direction)
|
||||
target_turf = new_turf
|
||||
if(new_turf.density)
|
||||
break
|
||||
throw_at_fast(target_turf, throw_range, throw_speed)
|
||||
return 1
|
||||
|
||||
|
||||
/obj/item/bodypart/chest/dismember()
|
||||
var/mob/living/carbon/human/H = owner
|
||||
if(!istype(H) || (NODISMEMBER in H.dna.species.specflags)) //human's species don't allow dismemberment
|
||||
return 0
|
||||
|
||||
var/organ_spilled = 0
|
||||
var/turf/T = get_turf(H)
|
||||
H.add_splatter_floor(T)
|
||||
playsound(get_turf(owner), 'sound/misc/splort.ogg', 80, 1)
|
||||
for(var/X in owner.internal_organs)
|
||||
var/obj/item/organ/O = X
|
||||
if(O.zone != "chest")
|
||||
continue
|
||||
O.Remove(owner)
|
||||
O.loc = T
|
||||
organ_spilled = 1
|
||||
if(cavity_item)
|
||||
cavity_item.loc = T
|
||||
cavity_item = null
|
||||
organ_spilled = 1
|
||||
|
||||
if(organ_spilled)
|
||||
owner.visible_message("<span class='danger'><B>[owner]'s internal organs spill out onto the floor!</B></span>")
|
||||
return 1
|
||||
|
||||
|
||||
|
||||
//limb removal. The "special" argument is used for swapping a limb with a new one without the effects of losing a limb kicking in.
|
||||
/obj/item/bodypart/proc/drop_limb(special)
|
||||
if(!ishuman(owner))
|
||||
return
|
||||
var/turf/T = get_turf(owner)
|
||||
var/mob/living/carbon/human/H = owner
|
||||
if(!no_update)
|
||||
update_limb(1)
|
||||
H.bodyparts -= src
|
||||
owner = null
|
||||
|
||||
for(var/X in H.surgeries) //if we had an ongoing surgery on that limb, we stop it.
|
||||
var/datum/surgery/S = X
|
||||
if(S.organ == src)
|
||||
H.surgeries -= S
|
||||
qdel(S)
|
||||
break
|
||||
|
||||
for(var/obj/item/I in embedded_objects)
|
||||
embedded_objects -= I
|
||||
I.loc = src
|
||||
if(!H.has_embedded_objects())
|
||||
H.clear_alert("embeddedobject")
|
||||
|
||||
if(!special)
|
||||
for(var/X in H.dna.mutations) //some mutations require having specific limbs to be kept.
|
||||
var/datum/mutation/human/MT = X
|
||||
if(MT.limb_req && MT.limb_req == body_zone)
|
||||
MT.force_lose(H)
|
||||
|
||||
for(var/X in H.internal_organs) //internal organs inside the dismembered limb are dropped.
|
||||
var/obj/item/organ/O = X
|
||||
var/org_zone = check_zone(O.zone)
|
||||
if(org_zone != body_zone)
|
||||
continue
|
||||
O.transfer_to_limb(src, H)
|
||||
|
||||
update_icon_dropped()
|
||||
src.loc = T
|
||||
H.update_health_hud() //update the healthdoll
|
||||
H.update_body()
|
||||
H.update_hair()
|
||||
H.update_canmove()
|
||||
|
||||
|
||||
//when a limb is dropped, the internal organs are removed from the mob and put into the limb
|
||||
/obj/item/organ/proc/transfer_to_limb(obj/item/bodypart/LB, mob/living/carbon/human/H)
|
||||
Remove(H)
|
||||
loc = LB
|
||||
|
||||
/obj/item/organ/brain/transfer_to_limb(obj/item/bodypart/head/LB, mob/living/carbon/human/H)
|
||||
if(H.mind && H.mind.changeling)
|
||||
LB.brain = new //changeling doesn't lose its real brain organ, we drop a decoy.
|
||||
LB.brain.loc = LB
|
||||
else //if not a changeling, we put the brain organ inside the dropped head
|
||||
Remove(H) //and put the player in control of the brainmob
|
||||
loc = LB
|
||||
LB.brain = src
|
||||
LB.brainmob = brainmob
|
||||
brainmob = null
|
||||
LB.brainmob.loc = LB
|
||||
LB.brainmob.container = LB
|
||||
LB.brainmob.stat = DEAD
|
||||
|
||||
|
||||
/obj/item/bodypart/chest/drop_limb(special)
|
||||
return
|
||||
|
||||
/obj/item/bodypart/r_arm/drop_limb(special)
|
||||
var/mob/living/carbon/human/H = owner
|
||||
..()
|
||||
if(istype(H) && !special)
|
||||
if(H.handcuffed)
|
||||
H.handcuffed.loc = H.loc
|
||||
H.handcuffed.dropped(H)
|
||||
H.handcuffed = null
|
||||
H.update_handcuffed()
|
||||
if(H.hud_used)
|
||||
var/obj/screen/inventory/R = H.hud_used.inv_slots[slot_r_hand]
|
||||
if(R)
|
||||
R.update_icon()
|
||||
if(H.r_hand)
|
||||
H.unEquip(H.r_hand, 1)
|
||||
if(H.gloves)
|
||||
H.unEquip(H.gloves, 1)
|
||||
H.update_inv_gloves() //to remove the bloody hands overlay
|
||||
|
||||
|
||||
/obj/item/bodypart/l_arm/drop_limb(special)
|
||||
var/mob/living/carbon/human/H = owner
|
||||
..()
|
||||
if(istype(H) && !special)
|
||||
if(H.handcuffed)
|
||||
H.handcuffed.loc = H.loc
|
||||
H.handcuffed.dropped(H)
|
||||
H.handcuffed = null
|
||||
H.update_handcuffed()
|
||||
if(H.hud_used)
|
||||
var/obj/screen/inventory/L = H.hud_used.inv_slots[slot_l_hand]
|
||||
if(L)
|
||||
L.update_icon()
|
||||
if(H.l_hand)
|
||||
H.unEquip(H.l_hand, 1)
|
||||
if(H.gloves)
|
||||
H.unEquip(H.gloves, 1)
|
||||
H.update_inv_gloves() //to remove the bloody hands overlay
|
||||
|
||||
|
||||
/obj/item/bodypart/r_leg/drop_limb(special)
|
||||
if(owner && !special)
|
||||
owner.Weaken(2)
|
||||
if(owner.legcuffed)
|
||||
owner.legcuffed.loc = owner.loc
|
||||
owner.legcuffed.dropped(owner)
|
||||
owner.legcuffed = null
|
||||
owner.update_inv_legcuffed()
|
||||
if(ishuman(owner))
|
||||
var/mob/living/carbon/human/H = owner
|
||||
if(H.shoes)
|
||||
H.unEquip(H.shoes, 1)
|
||||
..()
|
||||
|
||||
/obj/item/bodypart/l_leg/drop_limb(special) //copypasta
|
||||
if(owner && !special)
|
||||
owner.Weaken(2)
|
||||
if(owner.legcuffed)
|
||||
owner.legcuffed.loc = owner.loc
|
||||
owner.legcuffed.dropped(owner)
|
||||
owner.legcuffed = null
|
||||
owner.update_inv_legcuffed()
|
||||
if(ishuman(owner))
|
||||
var/mob/living/carbon/human/H = owner
|
||||
if(H.shoes)
|
||||
H.unEquip(H.shoes, 1)
|
||||
..()
|
||||
|
||||
/obj/item/bodypart/head/drop_limb(special)
|
||||
var/mob/living/carbon/human/H = owner
|
||||
if(istype(H))
|
||||
if(!special)
|
||||
//Drop all worn head items
|
||||
for(var/X in list(H.glasses, H.ears, H.wear_mask, H.head))
|
||||
var/obj/item/I = X
|
||||
H.unEquip(I, 1)
|
||||
name = "[H]'s head"
|
||||
..()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//Attach a limb to a human and drop any existing limb of that type.
|
||||
/obj/item/bodypart/proc/replace_limb(mob/living/carbon/human/H, special)
|
||||
if(!istype(H))
|
||||
return
|
||||
var/obj/item/bodypart/O = locate(src.type) in H.bodyparts
|
||||
|
||||
if(O)
|
||||
O.drop_limb(1)
|
||||
attach_limb(H, special)
|
||||
|
||||
/obj/item/bodypart/head/replace_limb(mob/living/carbon/human/H, special)
|
||||
if(!istype(H))
|
||||
return
|
||||
var/obj/item/bodypart/head/O = locate(src.type) in H.bodyparts
|
||||
if(O)
|
||||
if(!special)
|
||||
return
|
||||
else
|
||||
O.drop_limb(1)
|
||||
attach_limb(H, special)
|
||||
|
||||
/obj/item/bodypart/proc/attach_limb(mob/living/carbon/human/H, special)
|
||||
loc = null
|
||||
owner = H
|
||||
H.bodyparts += src
|
||||
|
||||
if(special) //non conventional limb attachment
|
||||
for(var/X in H.surgeries) //if we had an ongoing surgery to attach a new limb, we stop it.
|
||||
var/datum/surgery/S = X
|
||||
var/surgery_zone = check_zone(S.location)
|
||||
if(surgery_zone == body_zone)
|
||||
H.surgeries -= S
|
||||
qdel(S)
|
||||
break
|
||||
|
||||
update_bodypart_damage_state()
|
||||
H.updatehealth()
|
||||
H.update_body()
|
||||
H.update_hair()
|
||||
H.update_damage_overlays()
|
||||
H.update_canmove()
|
||||
|
||||
|
||||
/obj/item/bodypart/r_arm/attach_limb(mob/living/carbon/human/H, special)
|
||||
..()
|
||||
if(H.hud_used)
|
||||
var/obj/screen/inventory/R = H.hud_used.inv_slots[slot_r_hand]
|
||||
if(R)
|
||||
R.update_icon()
|
||||
|
||||
/obj/item/bodypart/l_arm/attach_limb(mob/living/carbon/human/H, special)
|
||||
..()
|
||||
if(H.hud_used)
|
||||
var/obj/screen/inventory/L = H.hud_used.inv_slots[slot_l_hand]
|
||||
if(L)
|
||||
L.update_icon()
|
||||
|
||||
/obj/item/bodypart/head/attach_limb(mob/living/carbon/human/H, special)
|
||||
//Transfer some head appearance vars over
|
||||
if(brain)
|
||||
brainmob.container = null //Reset brainmob head var.
|
||||
brainmob.loc = brain //Throw mob into brain.
|
||||
brain.brainmob = brainmob //Set the brain to use the brainmob
|
||||
brainmob = null //Set head brainmob var to null
|
||||
brain.Insert(H) //Now insert the brain proper
|
||||
brain = null //No more brain in the head
|
||||
|
||||
H.hair_color = hair_color
|
||||
H.hair_style = hair_style
|
||||
H.facial_hair_color = facial_hair_color
|
||||
H.facial_hair_style = facial_hair_style
|
||||
H.eye_color = eye_color
|
||||
H.lip_style = lip_style
|
||||
H.lip_color = lip_color
|
||||
if(real_name)
|
||||
H.real_name = real_name
|
||||
real_name = ""
|
||||
name = initial(name)
|
||||
..()
|
||||
|
||||
|
||||
//Regenerates all limbs. Returns amount of limbs regenerated
|
||||
/mob/living/proc/regenerate_limbs(noheal, excluded_limbs)
|
||||
return 0
|
||||
|
||||
/mob/living/carbon/human/regenerate_limbs(noheal, list/excluded_limbs)
|
||||
var/list/limb_list = list("head", "chest", "r_arm", "l_arm", "r_leg", "l_leg")
|
||||
if(excluded_limbs)
|
||||
limb_list -= excluded_limbs
|
||||
for(var/Z in limb_list)
|
||||
. += regenerate_limb(Z, noheal)
|
||||
|
||||
/mob/living/proc/regenerate_limb(limb_zone, noheal)
|
||||
return
|
||||
|
||||
/mob/living/carbon/human/regenerate_limb(limb_zone, noheal)
|
||||
var/obj/item/bodypart/L
|
||||
if(get_bodypart(limb_zone))
|
||||
return 0
|
||||
L = newBodyPart(limb_zone, 0, 0, src)
|
||||
if(L)
|
||||
if(!noheal)
|
||||
L.brute_dam = 0
|
||||
L.burn_dam = 0
|
||||
L.burn_state = 0
|
||||
|
||||
L.attach_limb(src, 1)
|
||||
return 1
|
||||
@@ -0,0 +1,165 @@
|
||||
/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."
|
||||
max_damage = 200
|
||||
body_zone = "head"
|
||||
body_part = HEAD
|
||||
layer = ABOVE_MOB_LAYER //so it isn't hidden behind some objects when on the floor
|
||||
w_class = 4 //Quite a hefty load
|
||||
slowdown = 1 //Balancing measure
|
||||
throw_range = 2 //No head bowling
|
||||
px_x = 0
|
||||
px_y = -8
|
||||
|
||||
var/mob/living/carbon/brain/brainmob = null //The current occupant.
|
||||
var/obj/item/organ/brain/brain = null //The brain organ
|
||||
|
||||
//Limb appearance info:
|
||||
var/real_name = "" //Replacement name
|
||||
//Hair colour and style
|
||||
var/hair_color = "000"
|
||||
var/hair_style = "Bald"
|
||||
var/hair_alpha = 255
|
||||
//Facial hair colour and style
|
||||
var/facial_hair_color = "000"
|
||||
var/facial_hair_style = "Shaved"
|
||||
//Eye Colouring
|
||||
var/eyes = "eyes"
|
||||
var/eye_color = ""
|
||||
var/lip_style = null
|
||||
var/lip_color = "white"
|
||||
|
||||
/obj/item/bodypart/head/drop_organs(mob/user)
|
||||
var/turf/T = get_turf(src)
|
||||
playsound(T, 'sound/misc/splort.ogg', 50, 1, -1)
|
||||
for(var/obj/item/I in src)
|
||||
if(I == brain)
|
||||
if(user)
|
||||
user.visible_message("<span class='warning'>[user] saws [src] open and pulls out a brain!</span>", "<span class='notice'>You saw [src] open and pull out a brain.</span>")
|
||||
if(brainmob)
|
||||
brainmob.container = null
|
||||
brainmob.loc = brain
|
||||
brain.brainmob = brainmob
|
||||
brainmob = null
|
||||
brain.loc = T
|
||||
brain = null
|
||||
update_icon_dropped()
|
||||
else
|
||||
I.loc = T
|
||||
|
||||
/obj/item/bodypart/head/update_limb(dropping_limb, mob/living/carbon/human/source)
|
||||
var/mob/living/carbon/human/H
|
||||
if(source)
|
||||
H = source
|
||||
else
|
||||
H = owner
|
||||
if(!istype(H))
|
||||
return
|
||||
var/datum/species/S = H.dna.species
|
||||
//First of all, name.
|
||||
real_name = H.real_name
|
||||
|
||||
//Facial hair
|
||||
if(H.facial_hair_style && (FACEHAIR in S.specflags))
|
||||
facial_hair_style = H.facial_hair_style
|
||||
if(S.hair_color)
|
||||
if(S.hair_color == "mutcolor")
|
||||
facial_hair_color = H.dna.features["mcolor"]
|
||||
else
|
||||
facial_hair_color = S.hair_color
|
||||
else
|
||||
facial_hair_color = H.facial_hair_color
|
||||
hair_alpha = S.hair_alpha
|
||||
else
|
||||
facial_hair_style = "Shaved"
|
||||
facial_hair_color = "000"
|
||||
hair_alpha = 255
|
||||
//Hair
|
||||
if(H.hair_style && (HAIR in S.specflags))
|
||||
hair_style = H.hair_style
|
||||
if(S.hair_color)
|
||||
if(S.hair_color == "mutcolor")
|
||||
hair_color = H.dna.features["mcolor"]
|
||||
else
|
||||
hair_color = S.hair_color
|
||||
else
|
||||
hair_color = H.hair_color
|
||||
hair_alpha = S.hair_alpha
|
||||
else
|
||||
hair_style = "Bald"
|
||||
hair_color = "000"
|
||||
hair_alpha = initial(hair_alpha)
|
||||
// lipstick
|
||||
if(H.lip_style && (LIPS in S.specflags))
|
||||
lip_style = H.lip_style
|
||||
lip_color = H.lip_color
|
||||
else
|
||||
lip_style = null
|
||||
lip_color = "white"
|
||||
// eyes
|
||||
if(EYECOLOR in S.specflags)
|
||||
eyes = S.eyes
|
||||
eye_color = H.eye_color
|
||||
else
|
||||
eyes = "eyes"
|
||||
eye_color = ""
|
||||
..()
|
||||
|
||||
/obj/item/bodypart/head/update_icon_dropped()
|
||||
var/list/standing = get_limb_icon(1)
|
||||
if(!standing)
|
||||
return
|
||||
for(var/image/I in standing)
|
||||
I.pixel_x = px_x
|
||||
I.pixel_y = px_y
|
||||
add_overlay(standing)
|
||||
|
||||
/obj/item/bodypart/head/get_limb_icon(dropped)
|
||||
cut_overlays()
|
||||
var/image/I = ..()
|
||||
var/list/standing = list()
|
||||
standing += I
|
||||
if(dropped) //certain overlays only appear when the limb is being detached from its owner.
|
||||
var/datum/sprite_accessory/S
|
||||
|
||||
if(status != ORGAN_ROBOTIC) //having a robotic head hides certain features.
|
||||
//facial hair
|
||||
if(facial_hair_style)
|
||||
S = facial_hair_styles_list[facial_hair_style]
|
||||
if(S)
|
||||
var/image/img_facial_s = image("icon" = S.icon, "icon_state" = "[S.icon_state]_s", "layer" = -HAIR_LAYER, "dir"=SOUTH)
|
||||
img_facial_s.color = "#" + facial_hair_color
|
||||
img_facial_s.alpha = hair_alpha
|
||||
standing += img_facial_s
|
||||
|
||||
//Applies the debrained overlay if there is no brain
|
||||
if(!brain)
|
||||
standing += image("icon"='icons/mob/human_face.dmi', "icon_state" = "debrained_s", "layer" = -HAIR_LAYER, "dir"=SOUTH)
|
||||
else
|
||||
if(hair_style)
|
||||
S = hair_styles_list[hair_style]
|
||||
if(S)
|
||||
var/image/img_hair_s = image("icon" = S.icon, "icon_state" = "[S.icon_state]_s", "layer" = -HAIR_LAYER, "dir"=SOUTH)
|
||||
img_hair_s.color = "#" + hair_color
|
||||
img_hair_s.alpha = hair_alpha
|
||||
standing += img_hair_s
|
||||
|
||||
|
||||
// lipstick
|
||||
if(lip_style)
|
||||
var/image/lips = image("icon"='icons/mob/human_face.dmi', "icon_state"="lips_[lip_style]_s", "layer" = -BODY_LAYER, "dir"=SOUTH)
|
||||
lips.color = lip_color
|
||||
standing += lips
|
||||
|
||||
// eyes
|
||||
if(eye_color)
|
||||
var/image/img_eyes_s = image("icon" = 'icons/mob/human_face.dmi', "icon_state" = "[eyes]_s", "layer" = -BODY_LAYER, "dir"=SOUTH)
|
||||
img_eyes_s.color = "#" + eye_color
|
||||
standing += img_eyes_s
|
||||
|
||||
if(standing.len)
|
||||
return standing
|
||||
|
||||
/obj/item/bodypart/head/burn()
|
||||
drop_organs()
|
||||
..()
|
||||
@@ -0,0 +1,165 @@
|
||||
|
||||
/mob/living/proc/get_bodypart(zone)
|
||||
return
|
||||
|
||||
/mob/living/carbon/get_bodypart(zone)
|
||||
if(!zone)
|
||||
zone = "chest"
|
||||
for(var/X in bodyparts)
|
||||
var/obj/item/bodypart/L = X
|
||||
if(L.body_zone == zone)
|
||||
return L
|
||||
|
||||
//Mob has their active hand
|
||||
/mob/proc/has_active_hand()
|
||||
return 1
|
||||
|
||||
/mob/living/carbon/human/has_active_hand()
|
||||
var/obj/item/bodypart/L
|
||||
if(hand)
|
||||
L = get_bodypart("l_arm")
|
||||
else
|
||||
L = get_bodypart("r_arm")
|
||||
if(!L)
|
||||
return 0
|
||||
return 1
|
||||
|
||||
/mob/proc/has_left_hand()
|
||||
return 1
|
||||
|
||||
/mob/living/carbon/human/has_left_hand()
|
||||
var/obj/item/bodypart/L
|
||||
L = get_bodypart("l_arm")
|
||||
if(!L)
|
||||
return 0
|
||||
return 1
|
||||
|
||||
/mob/proc/has_right_hand()
|
||||
return 1
|
||||
|
||||
/mob/living/carbon/human/has_right_hand()
|
||||
var/obj/item/bodypart/L
|
||||
L = get_bodypart("r_arm")
|
||||
if(!L)
|
||||
return 0
|
||||
return 1
|
||||
|
||||
|
||||
//Limb numbers
|
||||
/mob/proc/get_num_arms()
|
||||
return 2
|
||||
/mob/proc/get_num_legs()
|
||||
return 2
|
||||
|
||||
/mob/proc/get_leg_ignore()
|
||||
return 0
|
||||
|
||||
/mob/living/carbon/human/get_leg_ignore()
|
||||
if(FLYING in dna.species.specflags)
|
||||
return 1
|
||||
|
||||
/mob/living/carbon/human/get_num_arms()
|
||||
. = 0
|
||||
for(var/X in bodyparts)
|
||||
var/obj/item/bodypart/affecting = X
|
||||
if(affecting.body_part == ARM_RIGHT)
|
||||
.++
|
||||
if(affecting.body_part == ARM_LEFT)
|
||||
.++
|
||||
|
||||
/mob/living/carbon/human/get_num_legs()
|
||||
. = 0
|
||||
for(var/X in bodyparts)
|
||||
var/obj/item/bodypart/affecting = X
|
||||
if(affecting.body_part == LEG_RIGHT)
|
||||
.++
|
||||
if(affecting.body_part == LEG_LEFT)
|
||||
.++
|
||||
|
||||
/mob/living/proc/get_missing_limbs()
|
||||
return list()
|
||||
|
||||
/mob/living/carbon/human/get_missing_limbs()
|
||||
var/list/full = list("head", "chest", "r_arm", "l_arm", "r_leg", "l_leg")
|
||||
for(var/zone in full)
|
||||
if(get_bodypart(zone))
|
||||
full -= zone
|
||||
return full
|
||||
|
||||
|
||||
//Remove all embedded objects from all limbs on the human mob
|
||||
/mob/living/carbon/human/proc/remove_all_embedded_objects()
|
||||
var/turf/T = get_turf(src)
|
||||
|
||||
for(var/X in bodyparts)
|
||||
var/obj/item/bodypart/L = X
|
||||
for(var/obj/item/I in L.embedded_objects)
|
||||
L.embedded_objects -= I
|
||||
I.loc = T
|
||||
|
||||
clear_alert("embeddedobject")
|
||||
|
||||
/mob/living/carbon/human/proc/has_embedded_objects()
|
||||
. = 0
|
||||
for(var/X in bodyparts)
|
||||
var/obj/item/bodypart/L = X
|
||||
for(var/obj/item/I in L.embedded_objects)
|
||||
return 1
|
||||
|
||||
|
||||
//Helper for quickly creating a new limb - used by augment code in species.dm spec_attacked_by
|
||||
/proc/newBodyPart(zone, robotic, fixed_icon, mob/living/carbon/human/source)
|
||||
var/obj/item/bodypart/L
|
||||
switch(zone)
|
||||
if("l_arm")
|
||||
L = new /obj/item/bodypart/l_arm()
|
||||
if("r_arm")
|
||||
L = new /obj/item/bodypart/r_arm()
|
||||
if("head")
|
||||
L = new /obj/item/bodypart/head()
|
||||
if("l_leg")
|
||||
L = new /obj/item/bodypart/l_leg()
|
||||
if("r_leg")
|
||||
L = new /obj/item/bodypart/r_leg()
|
||||
if("chest")
|
||||
L = new /obj/item/bodypart/chest()
|
||||
if(L)
|
||||
if(source)
|
||||
L.update_limb(fixed_icon, source)
|
||||
else if(fixed_icon)
|
||||
L.no_update = 1//when attached, the limb won't be affected by the appearance changes of its mob owner.
|
||||
if(robotic)
|
||||
L.change_bodypart_status(ORGAN_ROBOTIC)
|
||||
|
||||
. = L
|
||||
|
||||
|
||||
/proc/skintone2hex(skin_tone)
|
||||
. = 0
|
||||
switch(skin_tone)
|
||||
if("caucasian1")
|
||||
. = "ffe0d1"
|
||||
if("caucasian2")
|
||||
. = "fcccb3"
|
||||
if("caucasian3")
|
||||
. = "e8b59b"
|
||||
if("latino")
|
||||
. = "d9ae96"
|
||||
if("mediterranean")
|
||||
. = "c79b8b"
|
||||
if("asian1")
|
||||
. = "ffdeb3"
|
||||
if("asian2")
|
||||
. = "e3ba84"
|
||||
if("arab")
|
||||
. = "c4915e"
|
||||
if("indian")
|
||||
. = "b87840"
|
||||
if("african1")
|
||||
. = "754523"
|
||||
if("african2")
|
||||
. = "471c18"
|
||||
if("albino")
|
||||
. = "fff4e6"
|
||||
if("orange")
|
||||
. = "ffc905"
|
||||
Reference in New Issue
Block a user