diff --git a/code/datums/components/clothing_dirt.dm b/code/datums/components/clothing_dirt.dm new file mode 100644 index 00000000000..40f0ddb07e2 --- /dev/null +++ b/code/datums/components/clothing_dirt.dm @@ -0,0 +1,88 @@ +/// This component applies tint to clothing when its exposed to pepperspray, used in /obj/item/clothing/mask/gas. + +/datum/component/clothing_dirt + /// Amount of dirt stacks on the clothing + var/dirtiness = 0 + +/datum/component/clothing_dirt/Initialize() + if(!isclothing(parent)) + return COMPONENT_INCOMPATIBLE + +/datum/component/clothing_dirt/RegisterWithParent() + RegisterSignal(parent, COMSIG_ATOM_EXAMINE, PROC_REF(on_examine)) + RegisterSignal(parent, COMSIG_ITEM_EQUIPPED, PROC_REF(on_equip)) + RegisterSignal(parent, COMSIG_ITEM_DROPPED, PROC_REF(on_drop)) + RegisterSignal(parent, COMSIG_COMPONENT_CLEAN_ACT, PROC_REF(on_clean)) + RegisterSignal(parent, COMSIG_ATOM_EXPOSE_REAGENTS, PROC_REF(on_expose), TRUE) + +/datum/component/clothing_dirt/UnregisterFromParent() + var/obj/item/clothing/clothing = parent + clothing.tint -= dirtiness + if(iscarbon(clothing.loc)) + var/mob/living/carbon/wearer = clothing.loc + wearer.update_tint() + UnregisterSignal(wearer, COMSIG_ATOM_EXPOSE_REAGENTS) + else + UnregisterSignal(parent, COMSIG_ATOM_EXPOSE_REAGENTS) + UnregisterSignal(parent, list( + COMSIG_ATOM_EXAMINE, + COMSIG_ITEM_EQUIPPED, + COMSIG_MOB_UNEQUIPPED_ITEM, + COMSIG_COMPONENT_CLEAN_ACT, + )) + return ..() + +/datum/component/clothing_dirt/proc/on_equip(datum/source, mob/user, slot) + SIGNAL_HANDLER + var/obj/item/clothing/clothing = parent + if (!(slot & clothing.slot_flags)) + return + UnregisterSignal(parent, COMSIG_ATOM_EXPOSE_REAGENTS) + RegisterSignal(user, COMSIG_ATOM_EXPOSE_REAGENTS, PROC_REF(on_expose), TRUE) + +/datum/component/clothing_dirt/proc/on_drop(datum/source, mob/holder) + SIGNAL_HANDLER + UnregisterSignal(holder, COMSIG_ATOM_EXPOSE_REAGENTS) + RegisterSignal(parent, COMSIG_ATOM_EXPOSE_REAGENTS, PROC_REF(on_expose), TRUE) + +/datum/component/clothing_dirt/proc/on_examine(datum/source, mob/user, list/examine_list) + SIGNAL_HANDLER + if (dirtiness > 0) + examine_list += span_warning("It appears to be covered in some oily substance. Won't see much while wearing it until you wash it off.") + +/datum/component/clothing_dirt/proc/on_expose(atom/target, list/reagents, datum/reagents/source, methods) + SIGNAL_HANDLER + + var/mob/living/carbon/wearer + if(iscarbon(target)) + wearer = target + if(is_protected(wearer)) + return + + var/datum/reagent/consumable/condensedcapsaicin/pepper = locate() in reagents + if(isnull(pepper)) + return + + var/obj/item/clothing/clothing = parent + if (methods & (TOUCH | VAPOR)) + clothing.tint -= dirtiness + dirtiness = min(dirtiness + round(reagents[pepper] / 5), 3) + clothing.tint += dirtiness + if(!isnull(wearer)) + wearer.update_tint() + +/datum/component/clothing_dirt/proc/is_protected(mob/living/carbon/wearer) + return wearer.head && (wearer.head.flags_cover & PEPPERPROOF) + +/datum/component/clothing_dirt/proc/on_clean(datum/target, clean_types) + SIGNAL_HANDLER + var/obj/item/clothing/clothing = parent + var/mob/living/carbon/wearer + if(iscarbon(clothing.loc)) + wearer = clothing.loc + + if (clean_types & (CLEAN_WASH|CLEAN_SCRUB)) + clothing.tint -= dirtiness + dirtiness = 0 + if(!isnull(wearer)) + wearer.update_tint() diff --git a/code/modules/antagonists/ninja/ninja_clothing.dm b/code/modules/antagonists/ninja/ninja_clothing.dm index 54ed46c9c3e..4eaf40f9c79 100644 --- a/code/modules/antagonists/ninja/ninja_clothing.dm +++ b/code/modules/antagonists/ninja/ninja_clothing.dm @@ -15,7 +15,8 @@ resistance_flags = LAVA_PROOF | FIRE_PROOF | ACID_PROOF flags_inv = HIDEFACIALHAIR | HIDEFACE | HIDESNOUT flags_cover = MASKCOVERSMOUTH | PEPPERPROOF - has_fov = FALSE + pepper_tint = FALSE + /obj/item/clothing/under/syndicate/ninja name = "ninja suit" diff --git a/code/modules/clothing/masks/gasmask.dm b/code/modules/clothing/masks/gasmask.dm index 6d92b80ebfd..89d9a68530a 100644 --- a/code/modules/clothing/masks/gasmask.dm +++ b/code/modules/clothing/masks/gasmask.dm @@ -25,19 +25,21 @@ GLOBAL_LIST_INIT(clown_mask_options, list( var/list/gas_filters ///Type of filter that spawns on roundstart 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/cigarette/cig ///How much does this mask affect fishing difficulty var/fishing_modifier = 2 + ///Applies clothing_dirt component to the pepperproof mask if true + var/pepper_tint = TRUE /datum/armor/mask_gas bio = 100 /obj/item/clothing/mask/gas/Initialize(mapload) . = ..() - init_fov() + + if((flags_cover & PEPPERPROOF) && pepper_tint) + AddComponent(/datum/component/clothing_dirt) if(fishing_modifier) AddComponent(/datum/component/adjust_fishing_difficulty, fishing_modifier) @@ -160,11 +162,6 @@ GLOBAL_LIST_INIT(clown_mask_options, list( has_filter = FALSE return filtered_breath -/// Initializes the FoV component for the gas mask -/obj/item/clothing/mask/gas/proc/init_fov() - if (has_fov) - AddComponent(/datum/component/clothing_fov_visor, FOV_90_DEGREES) - /** * Getter for overall filter durability, takes into consideration all filters filter_status */ @@ -267,7 +264,6 @@ GLOBAL_LIST_INIT(clown_mask_options, list( icon_state = "plaguedoctor" flags_inv = HIDEEARS|HIDEEYES|HIDEFACE|HIDEFACIALHAIR|HIDESNOUT|HIDEHAIR inhand_icon_state = "gas_mask" - has_fov = FALSE clothing_flags = BLOCK_GAS_SMOKE_EFFECT|MASKINTERNALS /obj/item/clothing/mask/gas/syndicate @@ -278,8 +274,8 @@ GLOBAL_LIST_INIT(clown_mask_options, list( resistance_flags = FIRE_PROOF | ACID_PROOF strip_delay = 60 w_class = WEIGHT_CLASS_SMALL - has_fov = FALSE fishing_modifier = 0 + pepper_tint = FALSE /obj/item/clothing/mask/gas/clown_hat name = "clown wig and mask" @@ -296,7 +292,6 @@ GLOBAL_LIST_INIT(clown_mask_options, list( resistance_flags = FLAMMABLE actions_types = list(/datum/action/item_action/adjust) dog_fashion = /datum/dog_fashion/head/clown - has_fov = FALSE var/list/clownmask_designs = list() voice_filter = null // performer masks expect to be talked through fishing_modifier = 0 @@ -341,7 +336,6 @@ GLOBAL_LIST_INIT(clown_mask_options, list( righthand_file = 'icons/mob/inhands/clothing/hats_righthand.dmi' flags_cover = MASKCOVERSEYES resistance_flags = FLAMMABLE - has_fov = FALSE fishing_modifier = 0 /obj/item/clothing/mask/gas/mime @@ -355,7 +349,6 @@ GLOBAL_LIST_INIT(clown_mask_options, list( resistance_flags = FLAMMABLE actions_types = list(/datum/action/item_action/adjust) species_exception = list(/datum/species/golem) - has_fov = FALSE fishing_modifier = 0 var/list/mimemask_designs = list() @@ -400,7 +393,6 @@ GLOBAL_LIST_INIT(clown_mask_options, list( inhand_icon_state = "owl_mask" flags_cover = MASKCOVERSEYES resistance_flags = FLAMMABLE - has_fov = FALSE fishing_modifier = 0 /obj/item/clothing/mask/gas/sexymime @@ -412,7 +404,6 @@ GLOBAL_LIST_INIT(clown_mask_options, list( flags_cover = MASKCOVERSEYES resistance_flags = FLAMMABLE species_exception = list(/datum/species/golem) - has_fov = FALSE fishing_modifier = 0 /obj/item/clothing/mask/gas/cyborg @@ -420,7 +411,6 @@ GLOBAL_LIST_INIT(clown_mask_options, list( desc = "Beep boop." icon_state = "death" resistance_flags = FLAMMABLE - has_fov = FALSE flags_cover = MASKCOVERSEYES fishing_modifier = 0 @@ -432,7 +422,6 @@ GLOBAL_LIST_INIT(clown_mask_options, list( clothing_flags = MASKINTERNALS flags_cover = MASKCOVERSEYES resistance_flags = FLAMMABLE - has_fov = FALSE fishing_modifier = -1 /obj/item/clothing/mask/gas/carp @@ -440,7 +429,6 @@ GLOBAL_LIST_INIT(clown_mask_options, list( desc = "Gnash gnash." icon_state = "carp_mask" inhand_icon_state = null - has_fov = FALSE flags_cover = MASKCOVERSEYES fishing_modifier = -3 @@ -451,7 +439,6 @@ GLOBAL_LIST_INIT(clown_mask_options, list( inhand_icon_state = null custom_materials = list(/datum/material/wood = SHEET_MATERIAL_AMOUNT * 1.25) resistance_flags = FLAMMABLE - has_fov = FALSE flags_cover = MASKCOVERSEYES max_integrity = 100 actions_types = list(/datum/action/item_action/adjust) @@ -498,7 +485,6 @@ GLOBAL_LIST_INIT(clown_mask_options, list( inhand_icon_state = "gas_atmos" resistance_flags = FIRE_PROOF | ACID_PROOF flags_inv = HIDEFACIALHAIR|HIDEFACE|HIDEEYES|HIDEEARS|HIDEHAIR|HIDESNOUT - has_fov = FALSE fishing_modifier = -2 /obj/item/clothing/mask/gas/prop @@ -509,7 +495,6 @@ GLOBAL_LIST_INIT(clown_mask_options, list( clothing_flags = NONE flags_cover = MASKCOVERSMOUTH resistance_flags = FLAMMABLE - has_fov = FALSE fishing_modifier = 0 /obj/item/clothing/mask/gas/atmosprop @@ -521,7 +506,6 @@ GLOBAL_LIST_INIT(clown_mask_options, list( clothing_flags = NONE flags_cover = MASKCOVERSMOUTH resistance_flags = FLAMMABLE - has_fov = FALSE fishing_modifier = 0 /obj/item/clothing/mask/gas/driscoll diff --git a/code/modules/clothing/masks/hailer.dm b/code/modules/clothing/masks/hailer.dm index aee1ac17b1b..182bc3ace76 100644 --- a/code/modules/clothing/masks/hailer.dm +++ b/code/modules/clothing/masks/hailer.dm @@ -56,7 +56,6 @@ GLOBAL_LIST_INIT(hailer_phrases, list( flags_cover = MASKCOVERSMOUTH visor_flags_cover = MASKCOVERSMOUTH tint = 0 - has_fov = FALSE fishing_modifier = 0 unique_death = 'sound/items/sec_hailer/sec_death.ogg' COOLDOWN_DECLARE(hailer_cooldown) @@ -88,6 +87,7 @@ GLOBAL_LIST_INIT(hailer_phrases, list( flags_cover = MASKCOVERSMOUTH | MASKCOVERSEYES | PEPPERPROOF visor_flags_cover = MASKCOVERSMOUTH | MASKCOVERSEYES | PEPPERPROOF fishing_modifier = 2 + pepper_tint = FALSE /obj/item/clothing/mask/gas/sechailer/swat/spacepol name = "spacepol mask" diff --git a/code/modules/mining/equipment/explorer_gear.dm b/code/modules/mining/equipment/explorer_gear.dm index cc8cba654dd..c2dffd37ee5 100644 --- a/code/modules/mining/equipment/explorer_gear.dm +++ b/code/modules/mining/equipment/explorer_gear.dm @@ -61,7 +61,6 @@ actions_types = list(/datum/action/item_action/adjust) armor_type = /datum/armor/gas_explorer resistance_flags = FIRE_PROOF - has_fov = FALSE /datum/armor/gas_explorer melee = 10 diff --git a/tgstation.dme b/tgstation.dme index 386f3819e20..930644287ba 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -1074,6 +1074,7 @@ #include "code\datums\components\chuunibyou.dm" #include "code\datums\components\cleaner.dm" #include "code\datums\components\clickbox.dm" +#include "code\datums\components\clothing_dirt.dm" #include "code\datums\components\clothing_fov_visor.dm" #include "code\datums\components\codeword_hearing.dm" #include "code\datums\components\combo_attacks.dm"