From 5a3c7dc432121e8e76e8c47b221b4c8f5667530b Mon Sep 17 00:00:00 2001 From: mwerezak Date: Wed, 18 Jun 2014 10:05:04 -0400 Subject: [PATCH] Fixes human/checkarmor getting the armour... ...value for the wrong body part. Whoever put ran_zone() in there wasn't thinking straight, as it's not going to affect the part that actually gets damaged. --- .../mob/living/carbon/human/human_defense.dm | 13 +++++++------ code/modules/mob/living/living_defense.dm | 1 + .../modules/reagents/reagent_containers/syringes.dm | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index b5be2cae84..f9e31fd461 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -91,7 +91,7 @@ emp_act var/datum/organ/external/organ = get_organ(check_zone(def_zone)) - var/armor = checkarmor(organ, "bullet") + var/armor = getarmor_organ(organ, "bullet") if((P.embed && prob(20 + max(P.damage - armor, -10))) && P.damage_type == BRUTE) var/obj/item/weapon/shard/shrapnel/SP = new() @@ -113,19 +113,20 @@ emp_act if(def_zone) if(isorgan(def_zone)) - return checkarmor(def_zone, type) - var/datum/organ/external/affecting = get_organ(ran_zone(def_zone)) - return checkarmor(affecting, type) + return getarmor_organ(def_zone, type) + var/datum/organ/external/affecting = get_organ(def_zone) + return getarmor_organ(affecting, type) //If a specific bodypart is targetted, check how that bodypart is protected and return the value. //If you don't specify a bodypart, it checks ALL your bodyparts for protection, and averages out the values for(var/datum/organ/external/organ in organs) - armorval += checkarmor(organ, type) + armorval += getarmor_organ(organ, type) organnum++ return (armorval/max(organnum, 1)) -/mob/living/carbon/human/proc/checkarmor(var/datum/organ/external/def_zone, var/type) +//this proc returns the armour value for a particular external organ. +/mob/living/carbon/human/proc/getarmor_organ(var/datum/organ/external/def_zone, var/type) if(!type) return 0 var/protection = 0 var/list/body_parts = list(head, wear_mask, wear_suit, w_uniform) diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index c3075bcc13..172ca1fd35 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -32,6 +32,7 @@ return 0 +//if null is passed for def_zone, then this should return something appropriate for all zones (e.g. area effect damage) /mob/living/proc/getarmor(var/def_zone, var/type) return 0 diff --git a/code/modules/reagents/reagent_containers/syringes.dm b/code/modules/reagents/reagent_containers/syringes.dm index bed9a298fb..0c054a3d16 100644 --- a/code/modules/reagents/reagent_containers/syringes.dm +++ b/code/modules/reagents/reagent_containers/syringes.dm @@ -236,7 +236,7 @@ if(istype(target, /mob/living/carbon/human)) - var/target_zone = check_zone(user.zone_sel.selecting, target) + var/target_zone = ran_zone(check_zone(user.zone_sel.selecting, target)) var/datum/organ/external/affecting = target:get_organ(target_zone) if (!affecting)