From 59791159429607d7bfe8d005289f2e4daec09de5 Mon Sep 17 00:00:00 2001 From: CIB123 Date: Wed, 19 Sep 2012 21:47:36 +0000 Subject: [PATCH] More fixes for the organ system. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4731 316c924e-a436-60f5-8080-3fe189b3f50e --- code/game/objects/items/stacks/medical.dm | 19 ++++++++-- code/modules/mob/living/carbon/human/human.dm | 8 +++++ .../mob/living/carbon/human/update_icons.dm | 36 +++++++++++++------ 3 files changed, 51 insertions(+), 12 deletions(-) diff --git a/code/game/objects/items/stacks/medical.dm b/code/game/objects/items/stacks/medical.dm index 31882fca83..57ffa47730 100644 --- a/code/game/objects/items/stacks/medical.dm +++ b/code/game/objects/items/stacks/medical.dm @@ -50,8 +50,23 @@ if(!istype(affecting, /datum/organ/external) || affecting:burn_dam <= 0) affecting = H.get_organ("head") - if (affecting.heal_damage(src.heal_brute, src.heal_burn)) - H.UpdateDamageIcon() + // If we're targetting arms or legs, also heal the respective hand/foot + if(affecting.name in list("l_arm","r_arm","l_leg","r_leg")) + var/datum/organ/external/child + if(affecting.name == "l_arm") + child = H.get_organ("l_hand") + else if(affecting.name == "r_arm") + child = H.get_organ("r_hand") + else if(affecting.name == "r_leg") + child = H.get_organ("r_foot") + else if(affecting.name == "l_leg") + child = H.get_organ("l_foot") + + if (affecting.heal_damage(src.heal_brute, src.heal_burn) || child.heal_damage(src.heal_brute, src.heal_burn)) + H.UpdateDamageIcon() + else + if (affecting.heal_damage(src.heal_brute, src.heal_burn)) + H.UpdateDamageIcon() M.updatehealth() else M.heal_organ_damage((src.heal_brute/2), (src.heal_burn/2)) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 84b96f9c62..69a35d8574 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -253,6 +253,14 @@ update |= temp.take_damage(b_loss * 0.05, f_loss * 0.05) if("r_leg") update |= temp.take_damage(b_loss * 0.05, f_loss * 0.05) + if("r_foot") + update |= temp.take_damage(b_loss * 0.05, f_loss * 0.05) + if("l_foot") + update |= temp.take_damage(b_loss * 0.05, f_loss * 0.05) + if("r_arm") + update |= temp.take_damage(b_loss * 0.05, f_loss * 0.05) + if("l_arm") + update |= temp.take_damage(b_loss * 0.05, f_loss * 0.05) if(update) UpdateDamageIcon() diff --git a/code/modules/mob/living/carbon/human/update_icons.dm b/code/modules/mob/living/carbon/human/update_icons.dm index 37def85c43..b06f776e5c 100644 --- a/code/modules/mob/living/carbon/human/update_icons.dm +++ b/code/modules/mob/living/carbon/human/update_icons.dm @@ -160,7 +160,15 @@ Please contact me on #coderbus IRC. ~Carn x for(var/image/I in overlays_standing) overlays += I - +var/global/list/damage_icon_parts = list() +proc/get_damage_icon_part(damage_state, body_part) + if(damage_icon_parts["[damage_state]/[body_part]"] == null) + var/icon/DI = new /icon('icons/mob/dam_human.dmi', damage_state) // the damage icon for whole human + DI.Blend(new /icon('dam_mask.dmi', body_part), ICON_MULTIPLY) // mask with this organ's pixels + damage_icon_parts["[damage_state]/[body_part]"] = DI + return DI + else + return damage_icon_parts["[damage_state]/[body_part]"] //DAMAGE OVERLAYS //constructs damage icon for each organ from mask * damage field and saves it in our overlays_ lists @@ -182,21 +190,23 @@ Please contact me on #coderbus IRC. ~Carn x var/icon/standing = new /icon('dam_human.dmi', "00") var/icon/lying = new /icon('dam_human.dmi', "00-2") + var/image/standing_image = new /image("icon" = standing) + var/image/lying_image = new /image("icon" = lying) + + // blend the individual damage states with our icons for(var/datum/organ/external/O in organs) if(!(O.status & ORGAN_DESTROYED)) O.update_icon() - var/icon/DI = new /icon('icons/mob/dam_human.dmi', O.damage_state) // the damage icon for whole human - DI.Blend(new /icon('dam_mask.dmi', O.icon_name), ICON_MULTIPLY) // mask with this organ's pixels + if(O.damage_state == "00") continue - standing.Blend(DI,ICON_OVERLAY) - DI = new /icon('icons/mob/dam_human.dmi', "[O.damage_state]-2") // repeat for lying icons - DI.Blend(new /icon('dam_mask.dmi', "[O.icon_name]2"), ICON_MULTIPLY) + var/icon/DI = get_damage_icon_part(O.damage_state, O.icon_name) - lying.Blend(DI,ICON_OVERLAY) + standing_image.overlays += DI + + DI = get_damage_icon_part("[O.damage_state]-2", "[O.icon_name]2") + lying_image.overlays += DI - var/image/standing_image = new /image("icon" = standing) - var/image/lying_image = new /image("icon" = lying) overlays_standing[DAMAGE_LAYER] = standing_image overlays_lying[DAMAGE_LAYER] = lying_image @@ -224,9 +234,15 @@ Please contact me on #coderbus IRC. ~Carn x stand_icon = new /icon('icons/mob/human.dmi', "fatbody_s") lying_icon = new /icon('icons/mob/human.dmi', "fatbody_l") individual_limbs = 0 - else + // If dismemberment is on, draw individual limbs + else if(config.limbs_can_break) stand_icon = new /icon('icons/mob/human.dmi', "torso_[g]_s") lying_icon = new /icon('icons/mob/human.dmi', "torso_[g]_l") + // Otherwise just draw the full body. + else + stand_icon = new /icon('icons/mob/human.dmi', "body_[g]_s") + lying_icon = new /icon('icons/mob/human.dmi', "body_[g]_l") + individual_limbs = 0 // Draw each individual limb if(individual_limbs)