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 6 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
35 changes: 32 additions & 3 deletions code/game/objects/items/cigs_lighters.dm
Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,38 @@ 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 mob
if(!istype(smoker))
Momo8289 marked this conversation as resolved.
Show resolved Hide resolved
// If not, check if it's a gas mask
if(!istype(smoker, /obj/item/clothing/mask/gas))
reagents.remove_any(to_smoke)
return
// If it is, check if that mask is on a mob
if(!istype(smoker.loc, /mob/living/carbon))
Momo8289 marked this conversation as resolved.
Show resolved Hide resolved
reagents.remove_any(to_smoke)
return
// If it is, check if that mob is actually wearing the mask
var/mob/living/carbon/mask_holder = smoker.loc
if(!mask_holder.wear_mask == smoker)
Momo8289 marked this conversation as resolved.
Show resolved Hide resolved
reagents.remove_any(to_smoke)
return

// Update smoker to the wearer of the mask
smoker = smoker.loc

// Check if the smoker is actually wearing the cig
if(src != smoker.wear_mask)
// If they're not, check if the mask is a gas mask
if(istype(smoker.wear_mask, /obj/item/clothing/mask/gas))
// If it is, check if the cig is being held by that gas mask
var/obj/item/clothing/mask/gas/mask = smoker.wear_mask
if(src != mask.cig)
reagents.remove_any(to_smoke)
return
else
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
82 changes: 81 additions & 1 deletion code/modules/clothing/masks/gasmask.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,19 @@ 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')
else
cut_overlays()
Momo8289 marked this conversation as resolved.
Show resolved Hide resolved

/obj/item/clothing/mask/gas/Initialize(mapload)
. = ..()
init_fov()
Expand All @@ -45,15 +54,73 @@ GLOBAL_LIST_INIT(clown_mask_options, list(
QDEL_LAZYLIST(gas_filters)
return..()

/obj/item/clothing/mask/gas/equipped(mob/equipee, slot)
if(cig)
cig.equipped(equipee, slot)
return ..()

/obj/item/clothing/mask/gas/adjustmask(mob/living/carbon/user)
if(cig)
user.visible_message(
span_warning("You need to remove [cig] before you can adjust the mask")
)
return
return ..()
Momo8289 marked this conversation as resolved.
Show resolved Hide resolved


/obj/item/clothing/mask/gas/examine(mob/user)
. = ..()
if(max_filters > 0)
if(cig)
. += "<span class='notice'>There is a [cig.name] jammed into the filter slot</span>"
Momo8289 marked this conversation as resolved.
Show resolved Hide resolved
if(max_filters > 0 && !cig)
. += "<span class='notice'>[src] has [max_filters] slot\s for filters.</span>"
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>"

/obj/item/clothing/mask/gas/proc/on_cig_destroyed()
SIGNAL_HANDLER
if(cig)
cig = null
if(istype(src.loc, /mob))
Momo8289 marked this conversation as resolved.
Show resolved Hide resolved
var/mob/wearer = src.loc
wearer.update_worn_mask()
Momo8289 marked this conversation as resolved.
Show resolved Hide resolved

/obj/item/clothing/mask/gas/attackby(obj/item/tool, mob/user)
if(istype(tool, /obj/item/clothing/mask/cigarette))
var/valid_wearer = istype(src.loc, /mob)
Momo8289 marked this conversation as resolved.
Show resolved Hide resolved

if(flags_cover & MASKCOVERSMOUTH)
user.visible_message(
span_warning("You can't do that while the mask's mouth is covered")
)
return ..()

if(max_filters <= 0 || cig)
user.visible_message(
span_warning("There's nowhere for that to fit")
)
return ..()
if(has_filter)
user.visible_message(
span_warning("You can't fit that in while there are filters in the mask")
)
Momo8289 marked this conversation as resolved.
Show resolved Hide resolved
return ..()

cig = tool
if(valid_wearer)
cig.equipped(src.loc, ITEM_SLOT_MASK)
Momo8289 marked this conversation as resolved.
Show resolved Hide resolved
Momo8289 marked this conversation as resolved.
Show resolved Hide resolved
RegisterSignal(cig, COMSIG_QDELETING, PROC_REF(on_cig_destroyed))
cig.forceMove(src)
var/mob/wearer = src.loc
Momo8289 marked this conversation as resolved.
Show resolved Hide resolved
wearer.update_worn_mask()
return TRUE

if(cig)
var/c = cig.attackby(tool, user)
Momo8289 marked this conversation as resolved.
Show resolved Hide resolved
var/mob/wearer = src.loc
Momo8289 marked this conversation as resolved.
Show resolved Hide resolved
Momo8289 marked this conversation as resolved.
Show resolved Hide resolved
wearer.update_worn_mask()
return c
if(!istype(tool, /obj/item/gas_filter))
return ..()
if(LAZYLEN(gas_filters) >= max_filters)
Expand All @@ -64,7 +131,20 @@ GLOBAL_LIST_INIT(clown_mask_options, list(
has_filter = TRUE
return TRUE

/obj/item/clothing/mask/gas/equipped(mob/M, slot)
. = ..()
if(cig)
cig.equipped(M, slot)
Momo8289 marked this conversation as resolved.
Show resolved Hide resolved
Momo8289 marked this conversation as resolved.
Show resolved Hide resolved

/obj/item/clothing/mask/gas/attack_hand_secondary(mob/user, list/modifiers)
if(cig)
user.put_in_hands(cig)
UnregisterSignal(cig, COMSIG_QDELETING)
cig = null
if(istype(src.loc, /mob))
Momo8289 marked this conversation as resolved.
Show resolved Hide resolved
var/mob/wearer = src.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