From 10cd7e255ffd467a8a990e3b4aa7861c13124820 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 29 Mar 2014 17:16:22 +0100 Subject: [PATCH] Initial Commit --- code/modules/clothing/clothing.dm | 1 + code/modules/clothing/masks/gasmask.dm | 6 +++++ code/modules/reagents/reagent_containers.dm | 25 ++++++++++++++++++- .../reagent_containers/food/condiment.dm | 3 +++ .../reagent_containers/food/drinks.dm | 3 +++ .../reagent_containers/food/snacks.dm | 3 +++ .../reagents/reagent_containers/pill.dm | 3 +++ 7 files changed, 43 insertions(+), 1 deletion(-) diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm index c880db33edd..2338f39e431 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -76,6 +76,7 @@ BLIND // can't see anything icon = 'icons/obj/clothing/masks.dmi' body_parts_covered = HEAD slot_flags = SLOT_MASK + var/alloweat = 0 //Override this to modify speech like luchador masks. diff --git a/code/modules/clothing/masks/gasmask.dm b/code/modules/clothing/masks/gasmask.dm index 74a3eab0ac7..ba1c8689c70 100644 --- a/code/modules/clothing/masks/gasmask.dm +++ b/code/modules/clothing/masks/gasmask.dm @@ -224,30 +224,35 @@ /obj/item/clothing/mask/gas/clown_hat name = "clown wig and mask" desc = "A true prankster's facial attire. A clown is incomplete without his wig and mask." + alloweat = 1 icon_state = "clown" item_state = "clown_hat" /obj/item/clothing/mask/gas/sexyclown name = "sexy-clown wig and mask" desc = "A feminine clown mask for the dabbling crossdressers or female entertainers." + alloweat = 1 icon_state = "sexyclown" item_state = "sexyclown" /obj/item/clothing/mask/gas/mime name = "mime mask" desc = "The traditional mime's mask. It has an eerie facial posture." + alloweat = 1 icon_state = "mime" item_state = "mime" /obj/item/clothing/mask/gas/monkeymask name = "monkey mask" desc = "A mask used when acting as a monkey." + alloweat = 1 icon_state = "monkeymask" item_state = "monkeymask" /obj/item/clothing/mask/gas/sexymime name = "sexy mime mask" desc = "A traditional female mime's mask." + alloweat = 1 icon_state = "sexymime" item_state = "sexymime" @@ -264,4 +269,5 @@ /obj/item/clothing/mask/gas/owl_mask name = "owl mask" desc = "Twoooo!" + alloweat = 1 icon_state = "owl" \ No newline at end of file diff --git a/code/modules/reagents/reagent_containers.dm b/code/modules/reagents/reagent_containers.dm index 6f55530469d..e23270bafc3 100644 --- a/code/modules/reagents/reagent_containers.dm +++ b/code/modules/reagents/reagent_containers.dm @@ -44,4 +44,27 @@ for (var/datum/reagent/R in snack.reagents.reagent_list) //no reagents will be left behind data += "[R.id]([R.volume] units); " //Using IDs because SOME chemicals(I'm looking at you, chlorhydrate-beer) have the same names as other chemicals. return data - else return "No reagents" \ No newline at end of file + else return "No reagents" + +/obj/item/weapon/reagent_containers/proc/canconsume(mob/eater, mob/user) + //Check for covering mask + var/obj/item/clothing/cover = eater.get_item_by_slot(slot_wear_mask) + + if(isnull(cover)) // No mask, do we have any helmet? + cover = eater.get_item_by_slot(slot_head) + else + var/obj/item/clothing/mask/covermask = cover + if(covermask.alloweat) // Specific cases, clownmask for example. + return 1 + + if(!isnull(cover)) + if((cover.flags & HEADCOVERSMOUTH) || (cover.flags & MASKCOVERSMOUTH)) + var/who = (isnull(user) || eater == user) ? "your" : "their" + + if(istype(cover, /obj/item/clothing/mask/)) + user << "You have to remove [who] mask first!" + else + user << "You have to remove [who] helmet first!" + + return 0 + return 1 \ No newline at end of file diff --git a/code/modules/reagents/reagent_containers/food/condiment.dm b/code/modules/reagents/reagent_containers/food/condiment.dm index 48fc1e39ff6..3d4c6664809 100644 --- a/code/modules/reagents/reagent_containers/food/condiment.dm +++ b/code/modules/reagents/reagent_containers/food/condiment.dm @@ -29,6 +29,9 @@ user << "None of [src] left, oh no!" return 0 + if(!canconsume(M, user)) + return 0 + if(M == user) M << "You swallow some of contents of the [src]." if(reagents.total_volume) diff --git a/code/modules/reagents/reagent_containers/food/drinks.dm b/code/modules/reagents/reagent_containers/food/drinks.dm index 84836d8a96d..c7619dafcd0 100644 --- a/code/modules/reagents/reagent_containers/food/drinks.dm +++ b/code/modules/reagents/reagent_containers/food/drinks.dm @@ -26,6 +26,9 @@ user << " None of [src] left, oh no!" return 0 + if(!canconsume(M, user)) + return 0 + if(M == user) M << "You swallow a gulp of [src]." if(reagents.total_volume) diff --git a/code/modules/reagents/reagent_containers/food/snacks.dm b/code/modules/reagents/reagent_containers/food/snacks.dm index 3eab46a037b..4b3e6edda3e 100644 --- a/code/modules/reagents/reagent_containers/food/snacks.dm +++ b/code/modules/reagents/reagent_containers/food/snacks.dm @@ -46,6 +46,9 @@ qdel(src) return 0 if(istype(M, /mob/living/carbon)) + if(!canconsume(M, user)) + return 0 + if(M == user) //If you're eating it yourself. var/fullness = M.nutrition + (M.reagents.get_reagent_amount("nutriment") * 25) if(wrapped) diff --git a/code/modules/reagents/reagent_containers/pill.dm b/code/modules/reagents/reagent_containers/pill.dm index 5aae7951a6d..fa20ddfd3ef 100644 --- a/code/modules/reagents/reagent_containers/pill.dm +++ b/code/modules/reagents/reagent_containers/pill.dm @@ -19,6 +19,9 @@ return attack(mob/M, mob/user, def_zone) + if(!canconsume(M, user)) + return 0 + if(M == user) M << "You swallow [src]." M.unEquip(src) //icon update