From ddeb5c5af2f493e11468f6d4023c347501a1ac25 Mon Sep 17 00:00:00 2001 From: ShizCalev Date: Tue, 30 Oct 2018 04:13:06 -0400 Subject: [PATCH] Cleans up eye/mouth protection checks --- code/game/objects/items.dm | 21 ++++---------- code/modules/mining/ores_coins.dm | 10 ++----- code/modules/mob/living/brain/brain_item.dm | 6 ++-- code/modules/mob/living/living_defense.dm | 2 +- code/modules/paperwork/paperplane.dm | 2 +- .../chemistry/reagents/food_reagents.dm | 29 ++----------------- 6 files changed, 16 insertions(+), 54 deletions(-) diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 3a505464d38..497c8c7bbad 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -438,26 +438,17 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE) /obj/item/proc/eyestab(mob/living/carbon/M, mob/living/carbon/user) - var/is_human_victim = 0 + var/is_human_victim var/obj/item/bodypart/affecting = M.get_bodypart(BODY_ZONE_HEAD) if(ishuman(M)) if(!affecting) //no head! return - is_human_victim = 1 - var/mob/living/carbon/human/H = M - if((H.head && H.head.flags_cover & HEADCOVERSEYES) || \ - (H.wear_mask && H.wear_mask.flags_cover & MASKCOVERSEYES) || \ - (H.glasses && H.glasses.flags_cover & GLASSESCOVERSEYES)) - // you can't stab someone in the eyes wearing a mask! - to_chat(user, "You're going to need to remove that mask/helmet/glasses first!") - return + is_human_victim = TRUE - if(ismonkey(M)) - var/mob/living/carbon/monkey/Mo = M - if(Mo.wear_mask && Mo.wear_mask.flags_cover & MASKCOVERSEYES) - // you can't stab someone in the eyes wearing a mask! - to_chat(user, "You're going to need to remove that mask/helmet/glasses first!") - return + if(M.is_eyes_covered()) + // you can't stab someone in the eyes wearing a mask! + to_chat(user, "You're going to need to remove [M.p_their()] eye protection first!") + return if(isalien(M))//Aliens don't have eyes./N slimes also don't have eyes! to_chat(user, "You cannot locate any eyes on this creature!") diff --git a/code/modules/mining/ores_coins.dm b/code/modules/mining/ores_coins.dm index 59370237db6..59779e73251 100644 --- a/code/modules/mining/ores_coins.dm +++ b/code/modules/mining/ores_coins.dm @@ -103,14 +103,8 @@ GLOBAL_LIST_INIT(sand_recipes, list(\ if(..() || !ishuman(hit_atom)) return var/mob/living/carbon/human/C = hit_atom - if(C.head && C.head.flags_cover & HEADCOVERSEYES) - visible_message("[C]'s headgear blocks the sand!") - return - if(C.wear_mask && C.wear_mask.flags_cover & MASKCOVERSEYES) - visible_message("[C]'s mask blocks the sand!") - return - if(C.glasses && C.glasses.flags_cover & GLASSESCOVERSEYES) - visible_message("[C]'s glasses block the sand!") + if(C.is_eyes_covered()) + C.visible_message("[C]'s eye protection blocks the sand!", "Your eye protection blocks the sand!") return C.adjust_blurriness(6) C.adjustStaminaLoss(15)//the pain from your eyes burning does stamina damage diff --git a/code/modules/mob/living/brain/brain_item.dm b/code/modules/mob/living/brain/brain_item.dm index 235cfcf04c8..7c0a7578289 100644 --- a/code/modules/mob/living/brain/brain_item.dm +++ b/code/modules/mob/living/brain/brain_item.dm @@ -151,13 +151,15 @@ if(user.zone_selected != BODY_ZONE_HEAD) return ..() - if((C.head && (C.head.flags_cover & HEADCOVERSEYES)) || (C.wear_mask && (C.wear_mask.flags_cover & MASKCOVERSEYES)) || (C.glasses && (C.glasses.flags_1 & GLASSESCOVERSEYES))) + var/target_has_brain = C.getorgan(/obj/item/organ/brain) + + if(!target_has_brain && C.is_eyes_covered()) to_chat(user, "You're going to need to remove [C.p_their()] head cover first!") return //since these people will be dead M != usr - if(!C.getorgan(/obj/item/organ/brain)) + if(!target_has_brain) if(!C.get_bodypart(BODY_ZONE_HEAD) || !user.temporarilyRemoveItemFromInventory(src)) return var/msg = "[C] has [src] inserted into [C.p_their()] head by [user]." diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index 3a4da65d4fa..21150da54ed 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -238,7 +238,7 @@ to_chat(M, "You don't want to hurt anyone!") return FALSE - if(M.is_muzzled() || (M.wear_mask && M.wear_mask.flags_cover & MASKCOVERSMOUTH)) + if(M.is_muzzled() || M.is_mouth_covered(FALSE, TRUE)) to_chat(M, "You can't bite with your mouth covered!") return FALSE M.do_attack_animation(src, ATTACK_EFFECT_BITE) diff --git a/code/modules/paperwork/paperplane.dm b/code/modules/paperwork/paperplane.dm index 9d316dcf5c8..00ece5c05cf 100644 --- a/code/modules/paperwork/paperplane.dm +++ b/code/modules/paperwork/paperplane.dm @@ -90,7 +90,7 @@ return var/mob/living/carbon/human/H = hit_atom if(prob(2)) - if((H.head && H.head.flags_cover & HEADCOVERSEYES) || (H.wear_mask && H.wear_mask.flags_cover & MASKCOVERSEYES) || (H.glasses && H.glasses.flags_cover & GLASSESCOVERSEYES)) + if(H.is_eyes_covered()) return visible_message("\The [src] hits [H] in the eye!") H.adjust_blurriness(6) diff --git a/code/modules/reagents/chemistry/reagents/food_reagents.dm b/code/modules/reagents/chemistry/reagents/food_reagents.dm index d60ba67e9e6..e9a436b4243 100755 --- a/code/modules/reagents/chemistry/reagents/food_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/food_reagents.dm @@ -281,33 +281,8 @@ var/mob/living/carbon/victim = M if(method == TOUCH || method == VAPOR) //check for protection - var/mouth_covered = 0 - var/eyes_covered = 0 - var/obj/item/safe_thing = null - - //monkeys and humans can have masks - if( victim.wear_mask ) - if ( victim.wear_mask.flags_cover & MASKCOVERSEYES ) - eyes_covered = 1 - safe_thing = victim.wear_mask - if ( victim.wear_mask.flags_cover & MASKCOVERSMOUTH ) - mouth_covered = 1 - safe_thing = victim.wear_mask - - //only humans can have helmets and glasses - if(ishuman(victim)) - var/mob/living/carbon/human/H = victim - if( H.head ) - if ( H.head.flags_cover & HEADCOVERSEYES ) - eyes_covered = 1 - safe_thing = H.head - if ( H.head.flags_cover & HEADCOVERSMOUTH ) - mouth_covered = 1 - safe_thing = H.head - if(H.glasses) - eyes_covered = 1 - if ( !safe_thing ) - safe_thing = H.glasses + var/mouth_covered = victim.is_mouth_covered() + var/eyes_covered = victim.is_eyes_covered() //actually handle the pepperspray effects if ( eyes_covered && mouth_covered )