From 82589ad3e9fe18261167b593a08a44b873e51544 Mon Sep 17 00:00:00 2001 From: Superlagg Date: Tue, 20 Jun 2023 20:43:16 -0700 Subject: [PATCH] fixes melee ignoring mob armor --- code/_onclick/item_attack.dm | 22 ++++++++++++++++++- .../living/simple_animal/animal_defense.dm | 11 +--------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/code/_onclick/item_attack.dm b/code/_onclick/item_attack.dm index d2bcafc6b50..34589a24056 100644 --- a/code/_onclick/item_attack.dm +++ b/code/_onclick/item_attack.dm @@ -209,10 +209,30 @@ if((user != src) && mob_run_block(I, totitemdamage, "the [I.name]", ((attackchain_flags & ATTACK_IS_PARRY_COUNTERATTACK)? ATTACK_IS_PARRY_COUNTERATTACK : NONE) | ATTACK_TYPE_MELEE, I.armour_penetration, user, null, block_return) & BLOCK_SUCCESS) return FALSE totitemdamage = block_calculate_resultant_damage(totitemdamage, block_return) + var/armorcheck = "melee" + switch(I.damtype) + if(BRUTE) + armorcheck = "melee" + if(BURN) + armorcheck = "laser" + var/armor = run_armor_check(null, armorcheck, null, null, 0, null) + var/dt = max(run_armor_check(null, "damage_threshold", null, null, 0, null), 0) send_item_attack_message(I, user, null, totitemdamage) I.do_stagger_action(src, user, totitemdamage) if(I.force) - apply_damage(totitemdamage, I.damtype) + apply_damage( + totitemdamage, + I.damtype, + BODY_ZONE_CHEST, + armor, + FALSE, + FALSE, + 0, + 0, + I.sharpness, + dt, + TRUE + ) if(I.damtype == BRUTE) if(prob(33)) I.add_mob_blood(src) diff --git a/code/modules/mob/living/simple_animal/animal_defense.dm b/code/modules/mob/living/simple_animal/animal_defense.dm index f197e782786..615b8531b2b 100644 --- a/code/modules/mob/living/simple_animal/animal_defense.dm +++ b/code/modules/mob/living/simple_animal/animal_defense.dm @@ -120,18 +120,9 @@ return ..() /mob/living/simple_animal/proc/attack_threshold_check(damage, damagetype = BRUTE, armorcheck = "melee") - var/temp_damage = damage - if(!damage_coeff[damagetype]) - temp_damage = 0 - else - temp_damage *= damage_coeff[damagetype] - if(temp_damage <= 0) - visible_message(span_warning("[src] looks unharmed!")) - return FALSE - var/armor = run_armor_check(null, armorcheck, null, null, 0, null) var/dt = max(run_armor_check(null, "damage_threshold", null, null, 0, null), 0) - apply_damage(temp_damage, damagetype, null, armor, null, null, null, damage_threshold = dt) + apply_damage(damage, damagetype, null, armor, null, null, null, damage_threshold = dt) return TRUE /mob/living/simple_animal/bullet_act(obj/item/projectile/P)