diff --git a/code/game/objects/items/cigs_lighters.dm b/code/game/objects/items/cigs_lighters.dm index f86f2de5a306..7dca839105e9 100644 --- a/code/game/objects/items/cigs_lighters.dm +++ b/code/game/objects/items/cigs_lighters.dm @@ -333,9 +333,20 @@ CIGARETTE PACKETS ARE IN FANCY.DM return var/to_smoke = smoke_all ? (reagents.total_volume * (dragtime / smoketime)) : REAGENTS_METABOLISM var/mob/living/carbon/smoker = loc - if(!istype(smoker) || src != smoker.wear_mask) - reagents.remove_any(to_smoke) - return + // These checks are a bit messy but at least they're fairly readable + // Check if the smoker is a carbon mob, since it needs to have wear_mask + if(!istype(smoker)) + // If not, check if it's a gas mask + if(!istype(smoker, /obj/item/clothing/mask/gas)) + reagents.remove_any(to_smoke) + return + + smoker = smoker.loc + + // If it is, check if that mask is on a carbon mob + if(!istype(smoker) || smoker.get_item_by_slot(ITEM_SLOT_MASK) != loc) + reagents.remove_any(to_smoke) + return reagents.expose(smoker, INGEST, min(to_smoke / reagents.total_volume, 1)) var/obj/item/organ/internal/lungs/lungs = smoker.get_organ_slot(ORGAN_SLOT_LUNGS) diff --git a/code/modules/clothing/masks/gasmask.dm b/code/modules/clothing/masks/gasmask.dm index 08cd51942f20..c1d9d1f35e7c 100644 --- a/code/modules/clothing/masks/gasmask.dm +++ b/code/modules/clothing/masks/gasmask.dm @@ -27,10 +27,17 @@ GLOBAL_LIST_INIT(clown_mask_options, list( var/starting_filter_type = /obj/item/gas_filter ///Does the mask have an FOV? var/has_fov = FALSE + ///Cigarette in the mask + var/obj/item/clothing/mask/cigarette/cig /datum/armor/mask_gas bio = 100 +/obj/item/clothing/mask/gas/worn_overlays(mutable_appearance/standing, isinhands) + . = ..() + if(!isinhands && cig) + . += cig.build_worn_icon(default_layer = FACEMASK_LAYER, default_icon_file = 'icons/mob/clothing/mask.dmi') + /obj/item/clothing/mask/gas/Initialize(mapload) . = ..() init_fov() @@ -46,15 +53,64 @@ GLOBAL_LIST_INIT(clown_mask_options, list( QDEL_LAZYLIST(gas_filters) return..() +/obj/item/clothing/mask/gas/equipped(mob/equipee, slot) + cig?.equipped(equipee, slot) + return ..() + +/obj/item/clothing/mask/gas/adjustmask(mob/living/carbon/user) + if(isnull(cig)) + return ..() + balloon_alert(user, "there's a cig in the way!") + + /obj/item/clothing/mask/gas/examine(mob/user) . = ..() - if(max_filters > 0) - . += "[src] has [max_filters] slot\s for filters." + if(cig) + . += span_notice("There is a [cig.name] jammed into the filter slot.") + if(max_filters > 0 && !cig) + . += span_notice("[src] has [max_filters] slot\s for filters.") if(LAZYLEN(gas_filters) > 0) - . += "Currently there [LAZYLEN(gas_filters) == 1 ? "is" : "are"] [LAZYLEN(gas_filters)] filter\s with [get_filter_durability()]% durability." - . += "The filters can be removed by right-clicking with an empty hand on [src]." + . += span_notice("Currently there [LAZYLEN(gas_filters) == 1 ? "is" : "are"] [LAZYLEN(gas_filters)] filter\s with [get_filter_durability()]% durability.") + . += span_notice("The filters can be removed by right-clicking with an empty hand on [src].") + +/obj/item/clothing/mask/gas/Exited(atom/movable/gone) + . = ..() + if(gone == cig) + cig = null + if(ismob(loc)) + var/mob/wearer = loc + wearer.update_worn_mask() /obj/item/clothing/mask/gas/attackby(obj/item/tool, mob/user) + var/valid_wearer = ismob(loc) + var/mob/wearer = loc + if(istype(tool, /obj/item/clothing/mask/cigarette)) + if(flags_cover & MASKCOVERSMOUTH) + balloon_alert(user, "mask's mouth is covered!") + return ..() + + if(max_filters <= 0 || cig) + balloon_alert(user, "can't hold that!") + return ..() + + if(has_filter) + balloon_alert(user, "filters in the mask!") + return ..() + + cig = tool + if(valid_wearer) + cig.equipped(loc, wearer.get_slot_by_item(cig)) + + cig.forceMove(src) + if(valid_wearer) + wearer.update_worn_mask() + return TRUE + + if(cig) + var/cig_attackby = cig.attackby(tool, user) + if(valid_wearer) + wearer.update_worn_mask() + return cig_attackby if(!istype(tool, /obj/item/gas_filter)) return ..() if(LAZYLEN(gas_filters) >= max_filters) @@ -66,6 +122,13 @@ GLOBAL_LIST_INIT(clown_mask_options, list( return TRUE /obj/item/clothing/mask/gas/attack_hand_secondary(mob/user, list/modifiers) + if(cig) + user.put_in_hands(cig) + cig = null + if(ismob(loc)) + var/mob/wearer = loc + wearer.update_worn_mask() + return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN if(!has_filter || !max_filters) return SECONDARY_ATTACK_CONTINUE_CHAIN for(var/i in 1 to max_filters)