Should fix the head and hair issues from the organ rewrite.

This commit is contained in:
Zuhayr
2015-04-03 05:41:33 -07:00
parent 4904f7737b
commit a3ed7fc033
9 changed files with 84 additions and 91 deletions
@@ -1,7 +1,7 @@
/mob/living/carbon/human/proc/update_eyes()
if(internal_organs_by_name["eyes"])
var/obj/item/organ/eyes/eyes = internal_organs_by_name["eyes"]
eyes.eye_colour = list(r_eyes,g_eyes,b_eyes)
var/obj/item/organ/eyes/eyes = internal_organs_by_name["eyes"]
if(eyes)
eyes.update_colour()
regenerate_icons()
/mob/living/carbon/var/list/internal_organs = list()
@@ -237,24 +237,30 @@ var/global/list/damage_icon_parts = list()
//CACHING: Generate an index key from visible bodyparts.
//0 = destroyed, 1 = normal, 2 = robotic, 3 = necrotic.
//Create a new, blank icon for our mob to use.
if(stand_icon)
del(stand_icon)
stand_icon = new(species.icon_template ? species.icon_template : 'icons/mob/human.dmi',"blank")
var/icon_key = "[species.race_key][g][s_tone][r_skin][g_skin][b_skin]"
var/obj/item/organ/eyes/eyes = internal_organs_by_name["eyes"]
var/icon_key = "[species.race_key][g][s_tone]"
for(var/obj/item/organ/external/part in organs)
if(part.is_stump() || (part.status & ORGAN_DESTROYED))
icon_key = "[icon_key]0"
if(eyes)
icon_key += "[rgb(eyes.eye_colour[1], eyes.eye_colour[2], eyes.eye_colour[3])]"
else
icon_key += "#000000"
for(var/organ_tag in species.has_limbs)
var/obj/item/organ/external/part = organs_by_name[organ_tag]
if(isnull(part) || part.is_stump() || (part.status & ORGAN_DESTROYED))
icon_key += "0"
else if(part.status & ORGAN_ROBOT)
icon_key = "[icon_key]2[part.model ? "-[part.model]": ""]"
icon_key += "2[part.model ? "-[part.model]": ""]"
else if(part.status & ORGAN_DEAD)
icon_key = "[icon_key]3"
icon_key += "3"
else
icon_key = "[icon_key]1"
icon_key += "1"
icon_key = "[icon_key][husk ? 1 : 0][fat ? 1 : 0][hulk ? 1 : 0][skeleton ? 1 : 0][s_tone]"
icon_key = "[icon_key][husk ? 1 : 0][fat ? 1 : 0][hulk ? 1 : 0][skeleton ? 1 : 0]"
var/icon/base_icon
if(human_icon_cache[icon_key])
@@ -784,11 +790,11 @@ var/global/list/damage_icon_parts = list()
/mob/living/carbon/human/update_inv_r_hand(var/update_icons=1)
if(r_hand)
r_hand.screen_loc = ui_rhand //TODO
var/t_icon = INV_R_HAND_DEF_ICON
if(r_hand.item_icons && (icon_r_hand in r_hand.item_icons))
t_icon = r_hand.item_icons[icon_r_hand]
var/t_state = r_hand.item_state //useful for clothing that changes icon_state but retains the same sprite on the mob when held in hand
if(!t_state) t_state = r_hand.icon_state
if(r_hand.icon_override)
@@ -800,18 +806,18 @@ var/global/list/damage_icon_parts = list()
if (handcuffed) drop_r_hand()
else
overlays_standing[R_HAND_LAYER] = null
if(update_icons) update_icons()
/mob/living/carbon/human/update_inv_l_hand(var/update_icons=1)
if(l_hand)
l_hand.screen_loc = ui_lhand //TODO
var/t_icon = INV_L_HAND_DEF_ICON
if(l_hand.item_icons && (icon_l_hand in l_hand.item_icons))
t_icon = l_hand.item_icons[icon_l_hand]
var/t_state = l_hand.item_state //useful for clothing that changes icon_state but retains the same sprite on the mob when held in hand
if(!t_state) t_state = l_hand.icon_state
if(l_hand.icon_override)
@@ -823,7 +829,7 @@ var/global/list/damage_icon_parts = list()
if (handcuffed) drop_l_hand()
else
overlays_standing[L_HAND_LAYER] = null
if(update_icons) update_icons()
/mob/living/carbon/human/proc/update_tail_showing(var/update_icons=1)
@@ -474,6 +474,7 @@
// Do the initial caching of the player's body icons.
new_character.force_update_limbs()
new_character.update_eyes()
new_character.regenerate_icons()
new_character.key = key //Manually transfer the key to log them in
+1 -1
View File
@@ -286,7 +286,7 @@ var/list/organ_cache = list()
target.r_eyes = eye_colour[1]
target.g_eyes = eye_colour[2]
target.b_eyes = eye_colour[3]
target.update_body()
target.update_eyes()
..()
/obj/item/organ/proc/bitten(mob/user)
+3 -3
View File
@@ -243,10 +243,10 @@
status &= ~ORGAN_BROKEN
perma_injury = 0
if((brute || burn) && children && children.len && (owner.species.flags & REGENERATES_LIMBS))
/*if((brute || burn) && children && children.len && (owner.species.flags & REGENERATES_LIMBS))
var/obj/item/organ/external/stump/S = locate() in children
if(S)
world << "Extra healing to go around ([brute+burn]) and [owner] needs a replacement limb."
world << "Extra healing to go around ([brute+burn]) and [owner] needs a replacement limb."*/
//Sync the organ's damage with its wounds
src.update_damages()
@@ -656,9 +656,9 @@ Note that amputating the affected organ does in fact remove the infection from t
parent = null
spawn(1)
owner.update_body()
owner.updatehealth()
owner.UpdateDamageIcon()
owner.regenerate_icons()
dir = 2
switch(disintegrate)
+43 -37
View File
@@ -23,6 +23,49 @@ var/global/list/limb_icon_cache = list()
if(human.species.flags & HAS_SKIN_COLOR)
s_col = list(human.r_skin, human.g_skin, human.b_skin)
/obj/item/organ/external/head/sync_colour_to_human(var/mob/living/carbon/human/human)
..()
var/obj/item/organ/eyes/eyes = owner.internal_organs_by_name["eyes"]
eyes.update_colour()
/obj/item/organ/external/head/removed()
get_icon()
..()
/obj/item/organ/external/head/get_icon()
..()
if(owner.species.has_organ["eyes"])
var/obj/item/organ/eyes/eyes = owner.internal_organs_by_name["eyes"]
if(owner.species.eyes)
var/icon/eyes_icon = new/icon('icons/mob/human_face.dmi', owner.species.eyes)
if(eyes)
eyes_icon.Blend(rgb(eyes.eye_colour[1], eyes.eye_colour[2], eyes.eye_colour[3]), ICON_ADD)
else
eyes_icon.Blend(rgb(128,0,0), ICON_ADD)
mob_icon.Blend(eyes_icon, ICON_OVERLAY)
if(owner.lip_style && (owner.species && (owner.species.flags & HAS_LIPS)))
mob_icon.Blend(new/icon('icons/mob/human_face.dmi', "lips_[owner.lip_style]_s"), ICON_OVERLAY)
if(owner.f_style)
var/datum/sprite_accessory/facial_hair_style = facial_hair_styles_list[owner.f_style]
if(facial_hair_style && facial_hair_style.species_allowed && (owner.species.name in facial_hair_style.species_allowed))
var/icon/facial_s = new/icon("icon" = facial_hair_style.icon, "icon_state" = "[facial_hair_style.icon_state]_s")
if(facial_hair_style.do_colouration)
facial_s.Blend(rgb(owner.r_facial, owner.g_facial, owner.b_facial), ICON_ADD)
overlays |= facial_s
if(owner.h_style && !(owner.head && (owner.head.flags & BLOCKHEADHAIR)))
var/datum/sprite_accessory/hair_style = hair_styles_list[owner.h_style]
if(hair_style && (owner.species.name in hair_style.species_allowed))
var/icon/hair_s = new/icon("icon" = hair_style.icon, "icon_state" = "[hair_style.icon_state]_s")
if(hair_style.do_colouration)
hair_s.Blend(rgb(owner.r_hair, owner.g_hair, owner.b_hair), ICON_ADD)
overlays |= hair_s
return mob_icon
/obj/item/organ/external/proc/get_icon(var/skeletal)
var/gender
@@ -66,43 +109,6 @@ var/global/list/limb_icon_cache = list()
return mob_icon
/obj/item/organ/external/head/get_icon(var/skeletal)
if(skeletal || !owner)
return
..()
if(owner.species.has_organ["eyes"])
var/obj/item/organ/eyes/eyes = owner.internal_organs_by_name["eyes"]
if(eyes && owner.species.eyes)
var/icon/eyes_icon = new/icon('icons/mob/human_face.dmi', owner.species.eyes)
eyes_icon.Blend(rgb(eyes.eye_colour[1], eyes.eye_colour[2], eyes.eye_colour[3]), ICON_ADD)
mob_icon.Blend(eyes_icon, ICON_OVERLAY)
if(owner.lip_style && (owner.species && (owner.species.flags & HAS_LIPS)))
mob_icon.Blend(new/icon('icons/mob/human_face.dmi', "lips_[owner.lip_style]_s"), ICON_OVERLAY)
if(owner.f_style)
var/datum/sprite_accessory/facial_hair_style = facial_hair_styles_list[owner.f_style]
if(facial_hair_style)
var/icon/facial = new/icon("icon" = facial_hair_style.icon, "icon_state" = "[facial_hair_style.icon_state]_s")
if(facial_hair_style.do_colouration)
facial.Blend(rgb(owner.r_facial, owner.g_facial, owner.b_facial), ICON_ADD)
mob_icon.Blend(facial, ICON_OVERLAY)
if(owner.h_style && !(owner.head && (owner.head.flags & BLOCKHEADHAIR)))
var/datum/sprite_accessory/hair_style = hair_styles_list[owner.h_style]
if(hair_style)
var/icon/hair = new/icon("icon" = hair_style.icon, "icon_state" = "[hair_style.icon_state]_s")
if(hair_style.do_colouration)
hair.Blend(rgb(owner.r_hair, owner.g_hair, owner.b_hair), ICON_ADD)
mob_icon.Blend(hair, ICON_OVERLAY)
icon = mob_icon
return mob_icon
// new damage icon system
// adjusted to set damage_state to brute/burn code only (without r_name0 as before)
/obj/item/organ/external/update_icon()
+9 -30
View File
@@ -69,6 +69,15 @@
parent_organ = "head"
var/list/eye_colour = list(0,0,0)
/obj/item/organ/eyes/proc/update_colour()
if(!owner)
return
eye_colour = list(
owner.r_eyes ? owner.r_eyes : 0,
owner.g_eyes ? owner.g_eyes : 0,
owner.b_eyes ? owner.b_eyes : 0
)
/obj/item/organ/eyes/process() //Eye damage replaces the old eye_stat var.
..()
if(!owner)
@@ -78,36 +87,6 @@
if(is_broken())
owner.eye_blind = 20
/obj/item/organ/eyes/New()
..()
if(owner)
eye_colour = list(
owner.r_eyes ? owner.r_eyes : 0,
owner.g_eyes ? owner.g_eyes : 0,
owner.b_eyes ? owner.b_eyes : 0
)
/obj/item/organ/eyes/removed(var/mob/living/target,var/mob/living/user)
if(!eye_colour)
eye_colour = list(0,0,0)
..() //Make sure target is set so we can steal their eye colour for later.
var/mob/living/carbon/human/H = target
if(istype(H))
eye_colour = list(
H.r_eyes ? H.r_eyes : 0,
H.g_eyes ? H.g_eyes : 0,
H.b_eyes ? H.b_eyes : 0
)
// Leave bloody red pits behind!
H.r_eyes = 128
H.g_eyes = 0
H.b_eyes = 0
H.update_body()
/obj/item/organ/liver
name = "liver"
icon_state = "liver"