Skip to content

Commit f2b0532

Browse files
authored
Fix some odd edge-cases with head/face protection (#6523)
## About The Pull Request This refactors `/mob/living/carbon/is_mouth_covered`, `/mob/living/carbon/is_eyes_covered`, and `/mob/living/carbon/is_pepper_proof` to check ALL slots for the desired protection. If a mask has the `HEADCOVERSMOUTH` flag, _it will still count as covering their mouth like a helmet would_. The first example I could think of is the damned rabbit mask - it had `HEADCOVERSMOUTH`, and the examine would say it would protect against facehuggers, but it does not. ## Why It's Good For The Game bugfix ## Changelog :cl: fix: Fixed some weird edge cases with helmets/masks/etc that are supposed to cover your eyes or mouth. fix: The Damned Rabbit Mask now actually blocks facehuggers like the examine says it should. /:cl:
1 parent 9ca3ebc commit f2b0532

File tree

2 files changed

+26
-24
lines changed

2 files changed

+26
-24
lines changed

code/modules/mob/living/carbon/alien/special/facehugger.dm

+4-3
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,10 @@
156156
span_userdanger("[src] leaps at your face!"))
157157

158158
// probiscis-blocker handling
159-
if(target.is_mouth_covered(ITEM_SLOT_HEAD))
160-
target.visible_message(span_danger("[src] smashes against [target]'s [target.head]!"), \
161-
span_userdanger("[src] smashes against your [target.head]!"))
159+
var/obj/item/blocking_item = target.is_mouth_covered(ITEM_SLOT_HEAD)
160+
if(blocking_item)
161+
target.visible_message(span_danger("[src] smashes against [target]'s [blocking_item]!"), \
162+
span_userdanger("[src] smashes against your [blocking_item]!"))
162163
Die()
163164
return FALSE
164165

code/modules/mob/living/carbon/carbon_defense.dm

+22-21
Original file line numberDiff line numberDiff line change
@@ -27,34 +27,35 @@
2727
else
2828
. += E.bang_protect
2929

30-
/mob/living/carbon/is_mouth_covered(check_flags = ALL)
31-
if((check_flags & ITEM_SLOT_HEAD) && head && (head.flags_cover & HEADCOVERSMOUTH))
32-
return head
33-
if((check_flags & ITEM_SLOT_MASK) && wear_mask && (wear_mask.flags_cover & MASKCOVERSMOUTH))
34-
return wear_mask
35-
30+
/mob/living/carbon/proc/check_equipment_cover_flags(flags = NONE)
31+
for(var/obj/item/thing in get_equipped_items())
32+
if(thing.flags_cover & flags)
33+
return thing
3634
return null
3735

38-
/mob/living/carbon/is_eyes_covered(check_flags = ALL)
39-
if((check_flags & ITEM_SLOT_HEAD) && head && (head.flags_cover & HEADCOVERSEYES))
40-
return head
41-
if((check_flags & ITEM_SLOT_MASK) && wear_mask && (wear_mask.flags_cover & MASKCOVERSEYES))
42-
return wear_mask
43-
if((check_flags & ITEM_SLOT_EYES) && glasses && (glasses.flags_cover & GLASSESCOVERSEYES))
44-
return glasses
36+
/mob/living/carbon/is_mouth_covered(check_flags = ALL)
37+
var/needed_coverage = NONE
38+
if(check_flags & ITEM_SLOT_HEAD)
39+
needed_coverage |= HEADCOVERSMOUTH
40+
if(check_flags & ITEM_SLOT_MASK)
41+
needed_coverage |= MASKCOVERSMOUTH
42+
return check_equipment_cover_flags(needed_coverage)
4543

46-
return null
44+
/mob/living/carbon/is_eyes_covered(check_flags = ALL)
45+
var/needed_coverage = NONE
46+
if(check_flags & ITEM_SLOT_HEAD)
47+
needed_coverage |= HEADCOVERSEYES
48+
if(check_flags & ITEM_SLOT_MASK)
49+
needed_coverage |= MASKCOVERSEYES
50+
if(check_flags & ITEM_SLOT_EYES)
51+
needed_coverage |= GLASSESCOVERSEYES
52+
return check_equipment_cover_flags(needed_coverage)
4753

4854
/mob/living/carbon/is_pepper_proof(check_flags = ALL)
4955
var/obj/item/organ/internal/eyes/eyes = get_organ_by_type(/obj/item/organ/internal/eyes)
50-
if(eyes && eyes.pepperspray_protect)
56+
if(eyes?.pepperspray_protect)
5157
return eyes
52-
if((check_flags & ITEM_SLOT_HEAD) && head && (head.flags_cover & PEPPERPROOF))
53-
return head
54-
if((check_flags & ITEM_SLOT_MASK) && wear_mask && (wear_mask.flags_cover & PEPPERPROOF))
55-
return wear_mask
56-
57-
return null
58+
return check_equipment_cover_flags(PEPPERPROOF)
5859

5960
/mob/living/carbon/check_projectile_dismemberment(obj/projectile/P, def_zone)
6061
var/obj/item/bodypart/affecting = get_bodypart(def_zone)

0 commit comments

Comments
 (0)