diff --git a/code/modules/mob/living/carbon/human/human_damage.dm b/code/modules/mob/living/carbon/human/human_damage.dm index b7368ac2cf2..094a8064287 100644 --- a/code/modules/mob/living/carbon/human/human_damage.dm +++ b/code/modules/mob/living/carbon/human/human_damage.dm @@ -261,20 +261,20 @@ This function restores all organs. /mob/living/carbon/human/apply_damage(var/damage = 0, var/damagetype = BRUTE, var/def_zone = null, var/blocked = 0, var/sharp = 0, var/edge = 0, var/obj/used_weapon = null) //visible_message("Hit debug. [damage] | [damagetype] | [def_zone] | [blocked] | [sharp] | [used_weapon]") - + //Handle other types of damage if((damagetype != BRUTE) && (damagetype != BURN)) if(damagetype == HALLOSS) if ((damage > 25 && prob(20)) || (damage > 50 && prob(60))) emote("scream") - - + + ..(damage, damagetype, def_zone, blocked) return 1 //Handle BRUTE and BURN damage handle_suit_punctures(damagetype, damage) - + if(blocked >= 2) return 0 var/datum/organ/external/organ = null @@ -316,21 +316,6 @@ This function restores all organs. // Will set our damageoverlay icon to the next level, which will then be set back to the normal level the next mob.Life(). updatehealth() hud_updateflag |= 1 << HEALTH_HUD - - //Embedded object code. - if(!organ) return - if(istype(used_weapon,/obj/item)) - var/obj/item/W = used_weapon - if (!W.is_robot_module()) - //blunt objects should really not be embedding in things unless a huge amount of force is involved - var/embed_chance = sharp? damage/W.w_class : damage/(W.w_class*3) - var/embed_threshold = sharp? 5*W.w_class : 15*W.w_class - - //Sharp objects will always embed if they do enough damage. - //Thrown objects have some momentum already and have a small chance to embed even if the damage is below the threshold - if((sharp && damage > (10*W.w_class)) || (sharp && !ismob(W.loc) && prob(damage/(10*W.w_class)*100)) || (damage > embed_threshold && prob(embed_chance))) - organ.embed(W) - return 1 diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index 3d959ebfdd1..6992a9db2e7 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -329,6 +329,20 @@ emp_act if(bloody) bloody_body(src) + + //Melee weapon embedded object code. + if (I.damtype == BRUTE && !I.is_robot_module()) + var/damage = I.force + if (armor) + damage /= armor+1 + + //blunt objects should really not be embedding in things unless a huge amount of force is involved + var/embed_chance = weapon_sharp? damage/I.w_class : damage/(I.w_class*3) + var/embed_threshold = weapon_sharp? 5*I.w_class : 15*I.w_class + + //Sharp objects will always embed if they do enough damage. + if((weapon_sharp && damage > (10*I.w_class)) || (damage > embed_threshold && prob(embed_chance))) + affecting.embed(I) return 1 //this proc handles being hit by a thrown atom @@ -382,6 +396,24 @@ emp_act if(!istype(src,/mob/living/simple_animal/mouse)) msg_admin_attack("[src.name] ([src.ckey]) was hit by a [O], thrown by [M.name] ([assailant.ckey]) (JMP)") + //thrown weapon embedded object code. + if(dtype == BRUTE && istype(O,/obj/item)) + var/obj/item/I = O + if (!I.is_robot_module()) + var/sharp = is_sharp(I) + var/damage = throw_damage + if (armor) + damage /= armor+1 + + //blunt objects should really not be embedding in things unless a huge amount of force is involved + var/embed_chance = sharp? damage/I.w_class : damage/(I.w_class*3) + var/embed_threshold = sharp? 5*I.w_class : 15*I.w_class + + //Sharp objects will always embed if they do enough damage. + //Thrown sharp objects have some momentum already and have a small chance to embed even if the damage is below the threshold + if((sharp && prob(damage/(10*I.w_class)*100)) || (damage > embed_threshold && prob(embed_chance))) + affecting.embed(I) + // Begin BS12 momentum-transfer code. if(O.throw_source && speed >= 15) var/obj/item/weapon/W = O @@ -402,6 +434,7 @@ emp_act src.anchored = 1 src.pinned += O + /mob/living/carbon/human/proc/bloody_hands(var/mob/living/source, var/amount = 2) if (gloves)