From d70f064b1b25ed630302ffe2876d4cf328cfaa4d Mon Sep 17 00:00:00 2001 From: mwerezak Date: Sat, 11 Jul 2015 01:00:55 -0400 Subject: [PATCH] Adjusts phoron exposure to use body_parts_covered --- code/ZAS/Phoron.dm | 19 ++++++++++++------- code/_helpers/unsorted.dm | 3 +++ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/code/ZAS/Phoron.dm b/code/ZAS/Phoron.dm index d3b7b19fdd8..ff03f947e19 100644 --- a/code/ZAS/Phoron.dm +++ b/code/ZAS/Phoron.dm @@ -141,13 +141,18 @@ obj/var/contaminated = 0 /mob/living/carbon/human/proc/pl_suit_protected() //Checks if the suit is adequately sealed. - if(wear_suit) - if(vsc.plc.PHORONGUARD_ONLY) - if(wear_suit.flags & PHORONGUARD) return 1 - else - if(wear_suit.flags_inv & HIDEJUMPSUIT) return 1 - //should check HIDETAIL as well, but for the moment tails are not a part that can be damaged separately - return 0 + var/coverage = 0 + for(var/obj/item/protection in list(wear_suit, gloves, shoes)) + if(!protection) + continue + if(vsc.plc.PHORONGUARD_ONLY && !(protection.flags & PHORONGUARD)) + return 0 + coverage |= protection.body_parts_covered + + if(vsc.plc.PHORONGUARD_ONLY) + return 1 + + return BIT_TEST_ALL(coverage, UPPER_TORSO|LOWER_TORSO|LEGS|FEET|ARMS|HANDS) /mob/living/carbon/human/proc/suit_contamination() //Runs over the things that can be contaminated and does so. diff --git a/code/_helpers/unsorted.dm b/code/_helpers/unsorted.dm index 940c8b5ab5b..d84f98ad251 100644 --- a/code/_helpers/unsorted.dm +++ b/code/_helpers/unsorted.dm @@ -4,6 +4,9 @@ * A large number of misc global procs. */ +//Checks if all high bits in req_mask are set in bitfield +#define BIT_TEST_ALL(bitfield, req_mask) ((~(bitfield) & (req_mask)) == 0) + //Inverts the colour of an HTML string /proc/invertHTML(HTMLstring)