From 55c553f535b50492a12ff08ac56d273f63b9aec5 Mon Sep 17 00:00:00 2001 From: Ater Ignis Date: Thu, 25 Oct 2012 20:00:44 +0400 Subject: [PATCH 1/4] 1) show dismemberments on player: erase limbs which are ORGAN_DESTROYED 2) if player is husk - still try to overlay robotic limbs if they are present, but not anything else 3) human without legs can't stay, right? but he can crawl if there exist any part of arm or leg - only fully delimbed body can't move --- code/modules/mob/living/carbon/human/life.dm | 94 +++++++++++++++---- .../mob/living/carbon/human/update_icons.dm | 48 +++++----- code/modules/mob/mob.dm | 6 +- code/modules/mob/mob_defines.dm | 3 + 4 files changed, 106 insertions(+), 45 deletions(-) diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 1975716f0ea..386ed1b9f29 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -258,6 +258,12 @@ number_wounds += E.number_wounds var/leg_tally = 2 + var/canstand_l = 1 + var/canstand_r = 1 + var/hasleg_l = 1 + var/hasleg_r = 1 + var/hasarm_l = 1 + var/hasarm_r = 1 for(var/datum/organ/external/E in organs) E.process() if(E.status & ORGAN_ROBOT && prob(E.brute_dam + E.burn_dam)) @@ -305,12 +311,38 @@ || E.name == "r_leg" || E.name == "r_foot" && !lying) if(!(E.status & ORGAN_SPLINTED)) leg_tally-- // let it fail even if just foot&leg + + var/datum/organ/external/E + E = get_organ("l_leg") + if(E.status & ORGAN_DESTROYED && !(E.status & ORGAN_SPLINTED)) + canstand_l = 0 + hasleg_l = 0 + E = get_organ("r_leg") + if(E.status & ORGAN_DESTROYED && !(E.status & ORGAN_SPLINTED)) + canstand_r = 0 + hasleg_r = 0 + E = get_organ("l_foot") + if(E.status & ORGAN_DESTROYED && !(E.status & ORGAN_SPLINTED)) + canstand_l = 0 + E = get_organ("r_foot") + if(E.status & ORGAN_DESTROYED && !(E.status & ORGAN_SPLINTED)) + canstand_r = 0 + E = get_organ("l_arm") + if(E.status & ORGAN_DESTROYED && !(E.status & ORGAN_SPLINTED)) + hasarm_l = 0 + E = get_organ("r_arm") + if(E.status & ORGAN_DESTROYED && !(E.status & ORGAN_SPLINTED)) + hasarm_r = 0 + // standing is poor if(leg_tally <= 0 && !paralysis && !(lying || resting) && prob(5)) emote("scream") emote("collapse") paralysis = 10 + can_stand = canstand_l||canstand_r + has_limbs = hasleg_l||hasleg_r||hasarm_l||hasarm_r + proc/handle_mutations_and_radiation() if(getFireLoss()) @@ -320,25 +352,49 @@ // Make nanoregen heal youu, -3 all damage types if(NANOREGEN in augmentations) var/healed = 0 - if(getToxLoss()) - adjustToxLoss(-3) - healed = 1 - if(getOxyLoss()) - adjustOxyLoss(-3) - healed = 1 - if(getCloneLoss()) - adjustCloneLoss(-3) - healed = 1 - if(getBruteLoss()) - heal_organ_damage(3,0) - healed = 1 - if(getFireLoss()) - heal_organ_damage(0,3) - healed = 1 - if(halloss > 0) - halloss -= 3 - if(halloss < 0) halloss = 0 - healed = 1 + var/hptoreg = 3 + if(stat==UNCONSCIOUS) hptoreg=1 + if(stat==DEAD) hptoreg=0 + for(var/i=0; i 0) + halloss -= 1 + if(halloss < 0) + halloss = 0 + healed = 1 + else + i=5 + if(healed) if(prob(5)) src << "\blue You feel your wounds mending..." diff --git a/code/modules/mob/living/carbon/human/update_icons.dm b/code/modules/mob/living/carbon/human/update_icons.dm index 08f423a9a00..4fff110880a 100644 --- a/code/modules/mob/living/carbon/human/update_icons.dm +++ b/code/modules/mob/living/carbon/human/update_icons.dm @@ -246,13 +246,26 @@ proc/get_damage_icon_part(damage_state, body_part) lying_icon = new /icon('icons/mob/human.dmi', "body_[g]_l") individual_limbs = 0 + for(var/datum/organ/external/part in organs) + if(!istype(part, /datum/organ/external/groin) \ + && !istype(part, /datum/organ/external/chest) \ + && (part.status & ORGAN_DESTROYED)) + var/icon/temp = new /icon('dam_mask.dmi', "[part.icon_name]") + temp.MapColors(-1,0,0,0, 0,-1,0,0, 0,0,-1,0, 0,0,0,-1, 1,1,1,1) + stand_icon.AddAlphaMask(temp) + + temp = new /icon('dam_mask.dmi', "[part.icon_name]2") + temp.MapColors(-1,0,0,0, 0,-1,0,0, 0,0,-1,0, 0,0,0,-1, 1,1,1,1) + lying_icon.AddAlphaMask(temp) + // Draw each individual limb if(individual_limbs) - stand_icon.Blend(new /icon('icons/mob/human.dmi', "chest_[g]_s"), ICON_OVERLAY) - lying_icon.Blend(new /icon('icons/mob/human.dmi', "chest_[g]_l"), ICON_OVERLAY) + if(!husk) + stand_icon.Blend(new /icon('icons/mob/human.dmi', "chest_[g]_s"), ICON_OVERLAY) + lying_icon.Blend(new /icon('icons/mob/human.dmi', "chest_[g]_l"), ICON_OVERLAY) var/datum/organ/external/head = get_organ("head") - if(head && !(head.status & ORGAN_DESTROYED)) + if(!husk && head && !(head.status & ORGAN_DESTROYED)) stand_icon.Blend(new /icon('icons/mob/human.dmi', "head_[g]_s"), ICON_OVERLAY) lying_icon.Blend(new /icon('icons/mob/human.dmi', "head_[g]_l"), ICON_OVERLAY) @@ -262,29 +275,18 @@ proc/get_damage_icon_part(damage_state, body_part) && !istype(part, /datum/organ/external/head) \ && !(part.status & ORGAN_DESTROYED)) var/icon/temp = new /icon('human.dmi', "[part.icon_name]_s") - if(part.status & ORGAN_ROBOT) temp.MapColors(rgb(77,77,77), rgb(150,150,150), rgb(28,28,28), rgb(0,0,0)) + if(part.status & ORGAN_ROBOT) + temp.MapColors(rgb(77,77,77,0), rgb(150,150,150), rgb(28,28,28), rgb(0,0,0)) stand_icon.Blend(temp, ICON_OVERLAY) + temp = new /icon('human.dmi', "[part.icon_name]_l") - if(part.status & ORGAN_ROBOT) temp.MapColors(rgb(77,77,77), rgb(150,150,150), rgb(28,28,28), rgb(0,0,0)) - lying_icon.Blend(temp , ICON_OVERLAY) + if(part.status & ORGAN_ROBOT) + temp.MapColors(rgb(77,77,77,0), rgb(150,150,150), rgb(28,28,28), rgb(0,0,0)) + lying_icon.Blend(temp, ICON_OVERLAY) - stand_icon.Blend(new /icon('human.dmi', "groin_[g]_s"), ICON_OVERLAY) - lying_icon.Blend(new /icon('human.dmi', "groin_[g]_l"), ICON_OVERLAY) - - if (husk) - var/icon/husk_s = new /icon('human.dmi', "husk_s") - var/icon/husk_l = new /icon('human.dmi', "husk_l") - - for(var/datum/organ/external/part in organs) - if(!istype(part, /datum/organ/external/groin) \ - && !istype(part, /datum/organ/external/chest) \ - && !istype(part, /datum/organ/external/head) \ - && (part.status & ORGAN_DESTROYED)) - husk_s.Blend(new /icon('dam_mask.dmi', "[part.icon_name]"), ICON_SUBTRACT) - husk_l.Blend(new /icon('dam_mask.dmi', "[part.icon_name]2"), ICON_SUBTRACT) - - stand_icon.Blend(husk_s, ICON_OVERLAY) - lying_icon.Blend(husk_l, ICON_OVERLAY) + if(!husk) + stand_icon.Blend(new /icon('human.dmi', "groin_[g]_s"), ICON_OVERLAY) + lying_icon.Blend(new /icon('human.dmi', "groin_[g]_l"), ICON_OVERLAY) //Skin tone if(!skeleton) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 73dac35e1a6..0d8a504c0e3 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -761,15 +761,15 @@ note dizziness decrements automatically in the mob's Life() proc. lying = 0 else lying = 1 - else if( stat || weakened || paralysis || resting || sleeping || (status_flags & FAKEDEATH) ) + else if( stat || weakened || paralysis || resting || sleeping || (status_flags & FAKEDEATH)) lying = 1 canmove = 0 else if( stunned ) // lying = 0 canmove = 0 else - lying = 0 - canmove = 1 + lying = !can_stand + canmove = has_limbs if(lying) density = 0 diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index dc14da1826e..348ae438e6c 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -220,3 +220,6 @@ var/tajaran_talk_understand = 0 var/soghun_talk_understand = 0 var/skrell_talk_understand = 0 + + var/has_limbs = 1 + var/can_stand = 1 From 61e16ee87f086745196fbd31541055134b90860a Mon Sep 17 00:00:00 2001 From: Ater Ignis Date: Sat, 27 Oct 2012 19:29:48 +0400 Subject: [PATCH 2/4] updated code to more readable --- .../mob/living/carbon/human/update_icons.dm | 40 +++++++++---------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/code/modules/mob/living/carbon/human/update_icons.dm b/code/modules/mob/living/carbon/human/update_icons.dm index 4fff110880a..a6654639206 100644 --- a/code/modules/mob/living/carbon/human/update_icons.dm +++ b/code/modules/mob/living/carbon/human/update_icons.dm @@ -259,34 +259,32 @@ proc/get_damage_icon_part(damage_state, body_part) lying_icon.AddAlphaMask(temp) // Draw each individual limb - if(individual_limbs) - if(!husk) - stand_icon.Blend(new /icon('icons/mob/human.dmi', "chest_[g]_s"), ICON_OVERLAY) - lying_icon.Blend(new /icon('icons/mob/human.dmi', "chest_[g]_l"), ICON_OVERLAY) + if(!husk && individual_limbs) + stand_icon.Blend(new /icon('icons/mob/human.dmi', "chest_[g]_s"), ICON_OVERLAY) + lying_icon.Blend(new /icon('icons/mob/human.dmi', "chest_[g]_l"), ICON_OVERLAY) var/datum/organ/external/head = get_organ("head") - if(!husk && head && !(head.status & ORGAN_DESTROYED)) + if(head && !(head.status & ORGAN_DESTROYED)) stand_icon.Blend(new /icon('icons/mob/human.dmi', "head_[g]_s"), ICON_OVERLAY) lying_icon.Blend(new /icon('icons/mob/human.dmi', "head_[g]_l"), ICON_OVERLAY) - for(var/datum/organ/external/part in organs) - if(!istype(part, /datum/organ/external/groin) \ - && !istype(part, /datum/organ/external/chest) \ - && !istype(part, /datum/organ/external/head) \ - && !(part.status & ORGAN_DESTROYED)) - var/icon/temp = new /icon('human.dmi', "[part.icon_name]_s") - if(part.status & ORGAN_ROBOT) - temp.MapColors(rgb(77,77,77,0), rgb(150,150,150), rgb(28,28,28), rgb(0,0,0)) - stand_icon.Blend(temp, ICON_OVERLAY) + stand_icon.Blend(new /icon('human.dmi', "groin_[g]_s"), ICON_OVERLAY) + lying_icon.Blend(new /icon('human.dmi', "groin_[g]_l"), ICON_OVERLAY) - temp = new /icon('human.dmi', "[part.icon_name]_l") - if(part.status & ORGAN_ROBOT) - temp.MapColors(rgb(77,77,77,0), rgb(150,150,150), rgb(28,28,28), rgb(0,0,0)) - lying_icon.Blend(temp, ICON_OVERLAY) + for(var/datum/organ/external/part in organs) + if(!istype(part, /datum/organ/external/groin) \ + && !istype(part, /datum/organ/external/chest) \ + && !istype(part, /datum/organ/external/head) \ + && !(part.status & ORGAN_DESTROYED)) + var/icon/temp = new /icon('human.dmi', "[part.icon_name]_s") + if(part.status & ORGAN_ROBOT) + temp.MapColors(rgb(77,77,77,0), rgb(150,150,150), rgb(28,28,28), rgb(0,0,0)) + stand_icon.Blend(temp, ICON_OVERLAY) - if(!husk) - stand_icon.Blend(new /icon('human.dmi', "groin_[g]_s"), ICON_OVERLAY) - lying_icon.Blend(new /icon('human.dmi', "groin_[g]_l"), ICON_OVERLAY) + temp = new /icon('human.dmi', "[part.icon_name]_l") + if(part.status & ORGAN_ROBOT) + temp.MapColors(rgb(77,77,77,0), rgb(150,150,150), rgb(28,28,28), rgb(0,0,0)) + lying_icon.Blend(temp, ICON_OVERLAY) //Skin tone if(!skeleton) From 6666e0cc3e69e6be806f92f52fef7fc572676db0 Mon Sep 17 00:00:00 2001 From: Ater Ignis Date: Mon, 29 Oct 2012 14:35:50 +0400 Subject: [PATCH 3/4] fixed i=5 crutch I accept, that was really silly --- code/modules/mob/living/carbon/human/life.dm | 49 ++++++++++---------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 386ed1b9f29..7171da3e95d 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -370,30 +370,31 @@ if(halloss != 0) damages+="hal" - switch(pick(damages)) - if("tox") - adjustToxLoss(-1) - healed = 1 - if("oxy") - adjustOxyLoss(-1) - healed = 1 - if("clone") - adjustCloneLoss(-1) - healed = 1 - if("brute") - heal_organ_damage(1,0) - healed = 1 - if("burn") - heal_organ_damage(0,1) - healed = 1 - if("hal") - if(halloss > 0) - halloss -= 1 - if(halloss < 0) - halloss = 0 - healed = 1 - else - i=5 + if(damages.len) + switch(pick(damages)) + if("tox") + adjustToxLoss(-1) + healed = 1 + if("oxy") + adjustOxyLoss(-1) + healed = 1 + if("clone") + adjustCloneLoss(-1) + healed = 1 + if("brute") + heal_organ_damage(1,0) + healed = 1 + if("burn") + heal_organ_damage(0,1) + healed = 1 + if("hal") + if(halloss > 0) + halloss -= 1 + if(halloss < 0) + halloss = 0 + healed = 1 + else + break if(healed) if(prob(5)) From fa1d74e435af1c8ea7134074143a89278312bf41 Mon Sep 17 00:00:00 2001 From: Ater Ignis Date: Mon, 29 Oct 2012 15:04:30 +0400 Subject: [PATCH 4/4] added comments --- code/modules/mob/living/carbon/human/life.dm | 28 +++++++++++-------- .../mob/living/carbon/human/update_icons.dm | 4 ++- code/modules/mob/mob_defines.dm | 4 +-- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 7171da3e95d..b451399e5be 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -258,12 +258,12 @@ number_wounds += E.number_wounds var/leg_tally = 2 - var/canstand_l = 1 - var/canstand_r = 1 - var/hasleg_l = 1 - var/hasleg_r = 1 - var/hasarm_l = 1 - var/hasarm_r = 1 + var/canstand_l = 1 //Can stand on left leg + var/canstand_r = 1 //Can stand on right leg + var/hasleg_l = 1 //Have left leg + var/hasleg_r = 1 //Have right leg + var/hasarm_l = 1 //Have left arm + var/hasarm_r = 1 //Have right arm for(var/datum/organ/external/E in organs) E.process() if(E.status & ORGAN_ROBOT && prob(E.brute_dam + E.burn_dam)) @@ -312,6 +312,14 @@ if(!(E.status & ORGAN_SPLINTED)) leg_tally-- // let it fail even if just foot&leg + // standing is poor + if(leg_tally <= 0 && !paralysis && !(lying || resting) && prob(5)) + emote("scream") + emote("collapse") + paralysis = 10 + + + //Check arms and legs for existence var/datum/organ/external/E E = get_organ("l_leg") if(E.status & ORGAN_DESTROYED && !(E.status & ORGAN_SPLINTED)) @@ -334,12 +342,8 @@ if(E.status & ORGAN_DESTROYED && !(E.status & ORGAN_SPLINTED)) hasarm_r = 0 - // standing is poor - if(leg_tally <= 0 && !paralysis && !(lying || resting) && prob(5)) - emote("scream") - emote("collapse") - paralysis = 10 - + // Can stand if have at least one full leg (with leg and foot parts present) + // Has limbs to move around if at least one arm or leg is at least partially there can_stand = canstand_l||canstand_r has_limbs = hasleg_l||hasleg_r||hasarm_l||hasarm_r diff --git a/code/modules/mob/living/carbon/human/update_icons.dm b/code/modules/mob/living/carbon/human/update_icons.dm index a6654639206..018c802b179 100644 --- a/code/modules/mob/living/carbon/human/update_icons.dm +++ b/code/modules/mob/living/carbon/human/update_icons.dm @@ -246,6 +246,7 @@ proc/get_damage_icon_part(damage_state, body_part) lying_icon = new /icon('icons/mob/human.dmi', "body_[g]_l") individual_limbs = 0 + //remove destroyed limbs from base icon for(var/datum/organ/external/part in organs) if(!istype(part, /datum/organ/external/groin) \ && !istype(part, /datum/organ/external/chest) \ @@ -258,7 +259,7 @@ proc/get_damage_icon_part(damage_state, body_part) temp.MapColors(-1,0,0,0, 0,-1,0,0, 0,0,-1,0, 0,0,0,-1, 1,1,1,1) lying_icon.AddAlphaMask(temp) - // Draw each individual limb + // Draw each individual limb (AterIgnis: not sure why this is needed at all - base icon have all of these, but that was before me) if(!husk && individual_limbs) stand_icon.Blend(new /icon('icons/mob/human.dmi', "chest_[g]_s"), ICON_OVERLAY) lying_icon.Blend(new /icon('icons/mob/human.dmi', "chest_[g]_l"), ICON_OVERLAY) @@ -271,6 +272,7 @@ proc/get_damage_icon_part(damage_state, body_part) stand_icon.Blend(new /icon('human.dmi', "groin_[g]_s"), ICON_OVERLAY) lying_icon.Blend(new /icon('human.dmi', "groin_[g]_l"), ICON_OVERLAY) + // Draw nondestroyed robotic limbs grayscale for(var/datum/organ/external/part in organs) if(!istype(part, /datum/organ/external/groin) \ && !istype(part, /datum/organ/external/chest) \ diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index 348ae438e6c..f28dc77e2e7 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -221,5 +221,5 @@ var/soghun_talk_understand = 0 var/skrell_talk_understand = 0 - var/has_limbs = 1 - var/can_stand = 1 + var/has_limbs = 1 //Whether this mob have any limbs he can move with + var/can_stand = 1 //Whether this mob have ability to stand