Merge pull request #20601 from optimumtact/missinglimbs

carbon mob bullet act now checks it's target zone exists before continuing
This commit is contained in:
Cheridan
2016-09-24 18:42:09 -05:00
committed by GitHub
2 changed files with 11 additions and 2 deletions
@@ -9,6 +9,14 @@
if(head && (head.flags & HEADBANGPROTECT))
return 1
//Overridden so we can handle when it hits a limb that doesn't exist
mob/living/carbon/bullet_act(obj/item/projectile/P, def_zone)
var/obj/item/bodypart/affecting = get_bodypart(def_zone)
if(!affecting) //that zone is dismembered
. = bullet_act(P, "chest")//act on chest instead
else
. = ..()//Proceed with standard handling
/mob/living/carbon/check_projectile_dismemberment(obj/item/projectile/P, def_zone)
var/obj/item/bodypart/affecting = get_bodypart(def_zone)
if(affecting && affecting.dismemberable && affecting.get_damage() >= (affecting.max_damage - P.dismemberment))
@@ -3,11 +3,12 @@
var/organnum = 0
if(def_zone)
//Can pass in a bodypart or zone, so lets shortcut that handling
if(islimb(def_zone))
return checkarmor(def_zone, type)
var/obj/item/bodypart/affecting = get_bodypart(ran_zone(def_zone))
//Note the check_zone call, this changes UI target values to bodypart zones
var/obj/item/bodypart/affecting = get_bodypart(check_zone(def_zone))
return checkarmor(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/X in bodyparts)