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.
This commit is contained in:
mwerezak
2014-06-18 10:05:04 -04:00
parent 1be8fd948f
commit 5a3c7dc432
3 changed files with 9 additions and 7 deletions

View File

@@ -91,7 +91,7 @@ emp_act
var/datum/organ/external/organ = get_organ(check_zone(def_zone)) 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) if((P.embed && prob(20 + max(P.damage - armor, -10))) && P.damage_type == BRUTE)
var/obj/item/weapon/shard/shrapnel/SP = new() var/obj/item/weapon/shard/shrapnel/SP = new()
@@ -113,19 +113,20 @@ emp_act
if(def_zone) if(def_zone)
if(isorgan(def_zone)) if(isorgan(def_zone))
return checkarmor(def_zone, type) return getarmor_organ(def_zone, type)
var/datum/organ/external/affecting = get_organ(ran_zone(def_zone)) var/datum/organ/external/affecting = get_organ(def_zone)
return checkarmor(affecting, type) return getarmor_organ(affecting, type)
//If a specific bodypart is targetted, check how that bodypart is protected and return the value. //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 //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) for(var/datum/organ/external/organ in organs)
armorval += checkarmor(organ, type) armorval += getarmor_organ(organ, type)
organnum++ organnum++
return (armorval/max(organnum, 1)) 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 if(!type) return 0
var/protection = 0 var/protection = 0
var/list/body_parts = list(head, wear_mask, wear_suit, w_uniform) var/list/body_parts = list(head, wear_mask, wear_suit, w_uniform)

View File

@@ -32,6 +32,7 @@
return 0 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) /mob/living/proc/getarmor(var/def_zone, var/type)
return 0 return 0

View File

@@ -236,7 +236,7 @@
if(istype(target, /mob/living/carbon/human)) 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) var/datum/organ/external/affecting = target:get_organ(target_zone)
if (!affecting) if (!affecting)