Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds the ability to jam cigarettes into the filter slot of a gas mask #76881

Merged
merged 31 commits into from Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
6f5d3cc
sttuff
Momo8289 Jul 2, 2023
b308eab
Merge branch 'tgstation:master' into cig-masks
Momo8289 Jul 15, 2023
d9fb621
Made visuals work
Momo8289 Jul 15, 2023
fb2ca3a
Can now actually smoke the cig
Momo8289 Jul 15, 2023
f32db8e
I don't even know but it all works now
Momo8289 Jul 16, 2023
0409fce
Merge branch 'tgstation:master' into cig-masks
Momo8289 Jul 16, 2023
41e3c89
Update code/modules/clothing/masks/gasmask.dm
Momo8289 Jul 17, 2023
c41f862
Switched some text to use span_notice
Momo8289 Jul 18, 2023
fe29696
switched over to balloon alerts
Momo8289 Jul 18, 2023
db5abfe
uses ismob
Momo8289 Jul 18, 2023
629a10c
Fixes a syntax error
Momo8289 Jul 18, 2023
c3a15b9
changed single letter var
Momo8289 Jul 18, 2023
2fcff06
Hopefully makes some code more clear
Momo8289 Jul 18, 2023
9b58704
updated balloon alerts to be more concise
Momo8289 Jul 18, 2023
61ca5ff
Merge branch 'master' into cig-masks
Momo8289 Jul 18, 2023
bdbf5e1
updated balloon text
Momo8289 Jul 18, 2023
c719cae
made not misleading
Momo8289 Jul 23, 2023
0f0cfd9
removed redundancy
Momo8289 Jul 23, 2023
3f30fbe
changed misleading balloon alert
Momo8289 Jul 23, 2023
c73d101
added sanity check
Momo8289 Jul 23, 2023
3f779ac
Merge branch 'master' into cig-masks
Momo8289 Jul 23, 2023
098a3a8
removed duplicate equipped
Momo8289 Jul 23, 2023
5dfabe2
started using Exited
Momo8289 Jul 23, 2023
980be25
minor, mostly redundancy fixes
Momo8289 Jul 23, 2023
70a338f
removes unneeded cut_overlay
Momo8289 Jul 23, 2023
bd2cbac
Merge branch 'master' into cig-masks
Momo8289 Jul 23, 2023
94a0d6b
fixed indentation
Momo8289 Jul 24, 2023
7410f3d
Merge branch 'master' into cig-masks
Momo8289 Jul 24, 2023
3911b8e
fixes
Momo8289 Jul 24, 2023
86a030a
better checks
Momo8289 Aug 9, 2023
b3045d6
Merge branch 'master' into cig-masks
Momo8289 Aug 9, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 14 additions & 3 deletions code/game/objects/items/cigs_lighters.dm
Expand Up @@ -322,9 +322,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)
Expand Down
71 changes: 67 additions & 4 deletions code/modules/clothing/masks/gasmask.dm
Expand Up @@ -26,10 +26,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 = TRUE
///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()
Expand All @@ -45,15 +52,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)
. += "<span class='notice'>[src] has [max_filters] slot\s for filters.</span>"
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)
. += "<span class='notice'>Currently there [LAZYLEN(gas_filters) == 1 ? "is" : "are"] [LAZYLEN(gas_filters)] filter\s with [get_filter_durability()]% durability.</span>"
. += "<span class='notice'>The filters can be removed by right-clicking with an empty hand on [src].</span>"
. += 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)
Expand All @@ -65,6 +121,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)
Expand Down