diff --git a/code/__DEFINES/span.dm b/code/__DEFINES/span.dm index 45eae3ce762..f47881fd65b 100644 --- a/code/__DEFINES/span.dm +++ b/code/__DEFINES/span.dm @@ -54,6 +54,7 @@ #define span_hypnophrase(str) ("" + str + "") #define span_icon(str) ("" + str + "") #define span_info(str) ("" + str + "") +#define span_infoplain(str) ("" + str + "") #define span_interface(str) ("" + str + "") #define span_looc(str) ("" + str + "") #define span_medal(str) ("" + str + "") diff --git a/code/game/objects/items/cigs_lighters.dm b/code/game/objects/items/cigs_lighters.dm index 730e68914d3..7f8a329416c 100644 --- a/code/game/objects/items/cigs_lighters.dm +++ b/code/game/objects/items/cigs_lighters.dm @@ -20,16 +20,18 @@ CIGARETTE PACKETS ARE IN FANCY.DM desc = "A simple match stick, used for lighting fine smokables." icon = 'icons/obj/cigarettes.dmi' icon_state = "match_unlit" - var/lit = FALSE - var/burnt = FALSE - /// How long the match lasts in seconds - var/smoketime = 10 + var/smoketime = 10 SECONDS w_class = WEIGHT_CLASS_TINY heat = 1000 grind_results = list(/datum/reagent/phosphorus = 2) + /// Whether this match has been lit. + var/lit = FALSE + /// Whether this match has burnt out. + var/burnt = FALSE + /// How long the match lasts in seconds /obj/item/match/process(delta_time) - smoketime -= delta_time + smoketime -= delta_time * (1 SECONDS) if(smoketime <= 0) matchburnout() else @@ -39,59 +41,67 @@ CIGARETTE PACKETS ARE IN FANCY.DM matchignite() /obj/item/match/proc/matchignite() - if(!lit && !burnt) - playsound(src, 'sound/items/match_strike.ogg', 15, TRUE) - lit = TRUE - icon_state = "match_lit" - damtype = BURN - force = 3 - hitsound = 'sound/items/welder.ogg' - inhand_icon_state = "cigon" - name = "lit [initial(name)]" - desc = "A [initial(name)]. This one is lit." - attack_verb_continuous = string_list(list("burns", "singes")) - attack_verb_simple = string_list(list("burn", "singe")) - START_PROCESSING(SSobj, src) - update_appearance() + if(lit || burnt) + return + + playsound(src, 'sound/items/match_strike.ogg', 15, TRUE) + lit = TRUE + icon_state = "match_lit" + damtype = BURN + force = 3 + hitsound = 'sound/items/welder.ogg' + inhand_icon_state = "cigon" + name = "lit [initial(name)]" + desc = "A [initial(name)]. This one is lit." + attack_verb_continuous = string_list(list("burns", "singes")) + attack_verb_simple = string_list(list("burn", "singe")) + START_PROCESSING(SSobj, src) + update_appearance() /obj/item/match/proc/matchburnout() - if(lit) - lit = FALSE - burnt = TRUE - damtype = BRUTE - force = initial(force) - icon_state = "match_burnt" - inhand_icon_state = "cigoff" - name = "burnt [initial(name)]" - desc = "A [initial(name)]. This one has seen better days." - attack_verb_continuous = string_list(list("flicks")) - attack_verb_simple = string_list(list("flick")) - STOP_PROCESSING(SSobj, src) + if(!lit) + return + + lit = FALSE + burnt = TRUE + damtype = BRUTE + force = initial(force) + icon_state = "match_burnt" + inhand_icon_state = "cigoff" + name = "burnt [initial(name)]" + desc = "A [initial(name)]. This one has seen better days." + attack_verb_continuous = string_list(list("flicks")) + attack_verb_simple = string_list(list("flick")) + STOP_PROCESSING(SSobj, src) /obj/item/match/extinguish() matchburnout() /obj/item/match/dropped(mob/user) matchburnout() - . = ..() + return ..() /obj/item/match/attack(mob/living/carbon/M, mob/living/carbon/user) if(!isliving(M)) return + if(lit && M.IgniteMob()) message_admins("[ADMIN_LOOKUPFLW(user)] set [key_name_admin(M)] on fire with [src] at [AREACOORD(user)]") log_game("[key_name(user)] set [key_name(M)] on fire with [src] at [AREACOORD(user)]") - var/obj/item/clothing/mask/cigarette/cig = help_light_cig(M) - if(lit && cig && !user.combat_mode) - if(cig.lit) - to_chat(user, span_warning("[cig] is already lit!")) - if(M == user) - cig.attackby(src, user) - else - cig.light(span_notice("[user] holds [src] out for [M], and lights [cig].")) - else - ..() + var/obj/item/clothing/mask/cigarette/cig = help_light_cig(M) + if(!lit || !cig || user.combat_mode) + ..() + return + + if(cig.lit) + to_chat(user, span_warning("[cig] is already lit!")) + if(M == user) + cig.attackby(src, user) + else + cig.light(span_notice("[user] holds [src] out for [M], and lights [cig].")) + +/// Finds a cigarette on another mob to help light. /obj/item/proc/help_light_cig(mob/living/M) var/mask_item = M.get_item_by_slot(ITEM_SLOT_MASK) if(istype(mask_item, /obj/item/clothing/mask/cigarette)) @@ -103,7 +113,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM /obj/item/match/firebrand name = "firebrand" desc = "An unlit firebrand. It makes you wonder why it's not just called a stick." - smoketime = 40 + smoketime = 40 SECONDS custom_materials = list(/datum/material/wood = MINERAL_MATERIAL_AMOUNT) grind_results = list(/datum/reagent/carbon = 2) @@ -124,25 +134,32 @@ CIGARETTE PACKETS ARE IN FANCY.DM body_parts_covered = null grind_results = list() heat = 1000 - var/dragtime = 10 - var/nextdragtime = 0 + /// Whether this cigarette has been lit. var/lit = FALSE + /// Whether this cigarette should start lit. var/starts_lit = FALSE - var/icon_on = "cigon" //Note - these are in masks.dmi not in cigarette.dmi + // Note - these are in masks.dmi not in cigarette.dmi + /// The icon state used when this is lit. + var/icon_on = "cigon" + /// The icon state used when this is extinguished. var/icon_off = "cigoff" - var/type_butt = /obj/item/cigbutt - var/lastHolder = null /// How long the cigarette lasts in seconds - var/smoketime = 360 + var/smoketime = 6 MINUTES + /// How much time between drags of the cigarette. + var/dragtime = 10 SECONDS + /// The cooldown that prevents just huffing the entire cigarette at once. + COOLDOWN_DECLARE(drag_cooldown) + /// The type of cigarette butt spawned when this burns out. + var/type_butt = /obj/item/cigbutt + /// The capacity for chems this cigarette has. var/chem_volume = 30 - var/smoke_all = FALSE /// Should we smoke all of the chems in the cig before it runs out. Splits each puff to take a portion of the overall chems so by the end you'll always have consumed all of the chems inside. + /// The reagents that this cigarette starts with. var/list/list_reagents = list(/datum/reagent/drug/nicotine = 15) - //var/lung_harm = 1 //How bad it is for you //ORIGINAL - var/lung_harm = 0.5 //How bad it is for you //SKYRAT EDIT CHANGE + /// Should we smoke all of the chems in the cig before it runs out. Splits each puff to take a portion of the overall chems so by the end you'll always have consumed all of the chems inside. + var/smoke_all = FALSE + /// How much damage this deals to the lungs per drag. + var/lung_harm = 1 -/obj/item/clothing/mask/cigarette/suicide_act(mob/user) - user.visible_message(span_suicide("[user] is huffing [src] as quickly as [user.p_they()] can! It looks like [user.p_theyre()] trying to give [user.p_them()]self cancer.")) - return (TOXLOSS|OXYLOSS) /obj/item/clothing/mask/cigarette/Initialize() . = ..() @@ -151,11 +168,15 @@ CIGARETTE PACKETS ARE IN FANCY.DM reagents.add_reagent_list(list_reagents) if(starts_lit) light() - AddComponent(/datum/component/knockoff,90,list(BODY_ZONE_PRECISE_MOUTH),list(ITEM_SLOT_MASK))//90% to knock off when wearing a mask + AddComponent(/datum/component/knockoff, 90, list(BODY_ZONE_PRECISE_MOUTH), list(ITEM_SLOT_MASK)) //90% to knock off when wearing a mask /obj/item/clothing/mask/cigarette/Destroy() STOP_PROCESSING(SSobj, src) - . = ..() + return ..() + +/obj/item/clothing/mask/cigarette/suicide_act(mob/user) + user.visible_message(span_suicide("[user] is huffing [src] as quickly as [user.p_they()] can! It looks like [user.p_theyre()] trying to give [user.p_them()]self cancer.")) + return (TOXLOSS|OXYLOSS) /obj/item/clothing/mask/cigarette/attackby(obj/item/W, mob/user, params) if(lit || smoketime <= 0) @@ -165,6 +186,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM if(!air || !air.has_gas(/datum/gas/oxygen, 1)) //or oxygen on a tile to burn to_chat(user, span_notice("Your [name] needs a source of oxygen to burn.")) return ..() + var/lighting_text = W.ignition_effect(src, user) if(lighting_text) light(lighting_text) @@ -173,15 +195,18 @@ CIGARETTE PACKETS ARE IN FANCY.DM . = ..() if(!proximity || lit) //can't dip if cigarette is lit (it will heat the reagents in the glass instead) return - if(istype(glass)) //you can dip cigarettes into beakers - if(glass.reagents.trans_to(src, chem_volume, transfered_by = user)) //if reagents were transfered, show the message - to_chat(user, span_notice("You dip \the [src] into \the [glass].")) - else //if not, either the beaker was empty, or the cigarette was full - if(!glass.reagents.total_volume) - to_chat(user, span_warning("[glass] is empty!")) - else - to_chat(user, span_warning("[src] is full!")) + if(!istype(glass)) //you can dip cigarettes into beakers + return + if(glass.reagents.trans_to(src, chem_volume, transfered_by = user)) //if reagents were transfered, show the message + to_chat(user, span_notice("You dip \the [src] into \the [glass].")) + //if not, either the beaker was empty, or the cigarette was full + else if(!glass.reagents.total_volume) + to_chat(user, span_warning("[glass] is empty!")) + else + to_chat(user, span_warning("[src] is full!")) + +/// Lights the cigarette with given flavor text. /obj/item/clothing/mask/cigarette/proc/light(flavor_text = null) if(lit) return @@ -245,27 +270,25 @@ CIGARETTE PACKETS ARE IN FANCY.DM M.update_inv_wear_mask() M.update_inv_hands() +/// Handles processing the reagents in the cigarette. /obj/item/clothing/mask/cigarette/proc/handle_reagents() - if(reagents.total_volume) - var/to_smoke = REAGENTS_METABOLISM - if(iscarbon(loc)) - var/mob/living/carbon/C = loc - if (src == C.wear_mask) // if it's in the human/monkey mouth, transfer reagents to the mob - /* - * Given the amount of time the cig will last, and how often we take a hit, find the number - * of chems to give them each time so they'll have smoked it all by the end. - */ - if (smoke_all) - to_smoke = reagents.total_volume / (smoketime / dragtime) - var/fraction = min(to_smoke/reagents.total_volume, 1) - reagents.expose(C, INGEST, fraction) - var/obj/item/organ/lungs/L = C.getorganslot(ORGAN_SLOT_LUNGS) - if(L && !(L.organ_flags & ORGAN_SYNTHETIC)) - C.adjustOrganLoss(ORGAN_SLOT_LUNGS, lung_harm) - if(!reagents.trans_to(C, to_smoke)) - reagents.remove_any(to_smoke) - return + if(!reagents.total_volume) + return + reagents.expose_temperature(heat, 0.05) + + 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 + + reagents.expose(smoker, INGEST, min(to_smoke / reagents.total_volume, 1)) + var/obj/item/organ/lungs/lungs = smoker.getorganslot(ORGAN_SLOT_LUNGS) + if(lungs && !(lungs.organ_flags & ORGAN_SYNTHETIC)) + smoker.adjustOrganLoss(ORGAN_SLOT_LUNGS, lung_harm) + if(!reagents.trans_to(smoker, to_smoke, methods = INGEST, ignore_stomach = TRUE)) + reagents.remove_any(to_smoke) + /obj/item/clothing/mask/cigarette/process(delta_time) var/turf/location = get_turf(src) @@ -277,16 +300,18 @@ CIGARETTE PACKETS ARE IN FANCY.DM if(!air || !air.has_gas(/datum/gas/oxygen, 1)) //or oxygen on a tile to burn extinguish() return - smoketime -= delta_time + + smoketime -= delta_time * (1 SECONDS) if(smoketime <= 0) new type_butt(location) if(ismob(loc)) to_chat(M, span_notice("Your [name] goes out.")) qdel(src) return - open_flame() - if((reagents?.total_volume) && (nextdragtime <= world.time)) - nextdragtime = world.time + dragtime SECONDS + + open_flame(heat) + if((reagents?.total_volume) && COOLDOWN_FINISHED(src, drag_cooldown)) + COOLDOWN_START(src, drag_cooldown, dragtime) handle_reagents() /obj/item/clothing/mask/cigarette/attack_self(mob/user) @@ -295,7 +320,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM new type_butt(user.loc) new /obj/effect/decal/cleanable/ash(user.loc) qdel(src) - . = ..() + return ..() /obj/item/clothing/mask/cigarette/attack(mob/living/carbon/M, mob/living/carbon/user) if(!istype(M)) @@ -304,28 +329,28 @@ CIGARETTE PACKETS ARE IN FANCY.DM light(span_notice("[user] lights [src] with [M]'s burning body. What a cold-blooded badass.")) return var/obj/item/clothing/mask/cigarette/cig = help_light_cig(M) - if(lit && cig && !user.combat_mode) - if(cig.lit) - to_chat(user, span_warning("The [cig.name] is already lit!")) - if(M == user) - cig.attackby(src, user) - else - cig.light(span_notice("[user] holds the [name] out for [M], and lights [M.p_their()] [cig.name].")) - else + if(!lit || !cig || user.combat_mode) return ..() + if(cig.lit) + to_chat(user, span_warning("The [cig.name] is already lit!")) + if(M == user) + cig.attackby(src, user) + else + cig.light(span_notice("[user] holds the [name] out for [M], and lights [M.p_their()] [cig.name].")) + /obj/item/clothing/mask/cigarette/fire_act(exposed_temperature, exposed_volume) light() /obj/item/clothing/mask/cigarette/get_temperature() return lit * heat -// Cigarette brands. +// Cigarette brands. /obj/item/clothing/mask/cigarette/space_cigarette desc = "A Space brand cigarette that can be smoked anywhere." list_reagents = list(/datum/reagent/drug/nicotine = 9, /datum/reagent/oxygen = 9) - smoketime = 240 // space cigs have a shorter burn time than normal cigs + smoketime = 4 MINUTES // space cigs have a shorter burn time than normal cigs smoke_all = TRUE // so that it doesn't runout of oxygen while being smoked in space /obj/item/clothing/mask/cigarette/dromedary @@ -355,7 +380,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM /obj/item/clothing/mask/cigarette/syndicate desc = "An unknown brand cigarette." chem_volume = 60 - smoketime = 2 * 60 + smoketime = 2 MINUTES smoke_all = TRUE list_reagents = list(/datum/reagent/drug/nicotine = 10, /datum/reagent/medicine/omnizine = 15) @@ -378,7 +403,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM type_butt = /obj/item/cigbutt/roach throw_speed = 0.5 inhand_icon_state = "spliffoff" - smoketime = 4 * 60 + smoketime = 4 MINUTES chem_volume = 50 list_reagents = null @@ -444,18 +469,19 @@ CIGARETTE PACKETS ARE IN FANCY.DM /obj/item/clothing/mask/cigarette/candy name = "Little Timmy's candy cigarette" desc = "For all ages*! Doesn't contain any amount of nicotine. Health and safety risks can be read on the tip of the cigarette." - smoketime = 2 * 60 + smoketime = 2 MINUTES icon_on = "candyon" icon_off = "candyoff" //make sure to add positional sprites in icons/obj/cigarettes.dmi if you add more. inhand_icon_state = "candyoff" icon_state = "candyoff" type_butt = /obj/item/food/candy_trash - list_reagents = list(/datum/reagent/consumable/sugar = 10, /datum/reagent/consumable/caramel = 10) + heat = 473.15 // Lowered so that the sugar can be carmalized, but not burnt. + list_reagents = list(/datum/reagent/consumable/sugar = 20) /obj/item/clothing/mask/cigarette/candy/nicotine desc = "For all ages*! Doesn't contain any* amount of nicotine. Health and safety risks can be read on the tip of the cigarette." type_butt = /obj/item/food/candy_trash/nicotine - list_reagents = list(/datum/reagent/consumable/sugar = 10, /datum/reagent/consumable/caramel = 10, /datum/reagent/drug/nicotine = 20) //oh no! + list_reagents = list(/datum/reagent/consumable/sugar = 20, /datum/reagent/drug/nicotine = 20) //oh no! smoke_all = TRUE //timmy's not getting out of this one /obj/item/cigbutt/roach @@ -481,7 +507,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM type_butt = /obj/item/cigbutt/cigarbutt throw_speed = 0.5 inhand_icon_state = "cigaroff" - smoketime = 11 * 60 + smoketime = 11 MINUTES chem_volume = 40 list_reagents = list(/datum/reagent/drug/nicotine = 25) @@ -491,7 +517,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM icon_state = "cigar2off" icon_on = "cigar2on" icon_off = "cigar2off" - smoketime = 20 * 60 + smoketime = 20 MINUTES chem_volume = 80 list_reagents =list(/datum/reagent/drug/nicotine = 40) @@ -501,7 +527,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM icon_state = "cigar2off" icon_on = "cigar2on" icon_off = "cigar2off" - smoketime = 30 * 60 + smoketime = 30 MINUTES chem_volume = 50 list_reagents =list(/datum/reagent/drug/nicotine = 15) @@ -530,7 +556,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM icon_on = "pipeon" //Note - these are in masks.dmi icon_off = "pipeoff" smoketime = 0 - chem_volume = 100 + chem_volume = 200 // So we can fit densified chemicals plants list_reagents = null var/packeditem = FALSE @@ -540,7 +566,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM /obj/item/clothing/mask/cigarette/pipe/Destroy() STOP_PROCESSING(SSobj, src) - . = ..() + return ..() /obj/item/clothing/mask/cigarette/pipe/process(delta_time) var/turf/location = get_turf(src) @@ -558,37 +584,40 @@ CIGARETTE PACKETS ARE IN FANCY.DM name = "empty [initial(name)]" STOP_PROCESSING(SSobj, src) return - open_flame() + + open_flame(heat) if(reagents?.total_volume) // check if it has any reagents at all handle_reagents() - -/obj/item/clothing/mask/cigarette/pipe/attackby(obj/item/O, mob/user, params) - if(istype(O, /obj/item/food/grown)) - var/obj/item/food/grown/G = O - if(!packeditem) - if(HAS_TRAIT(G, TRAIT_DRIED)) - to_chat(user, span_notice("You stuff [O] into [src].")) - smoketime = 13 * 60 - packeditem = TRUE - name = "[O.name]-packed [initial(name)]" - if(O.reagents) - O.reagents.trans_to(src, O.reagents.total_volume, transfered_by = user) - qdel(O) - else - to_chat(user, span_warning("It has to be dried first!")) - else - to_chat(user, span_warning("It is already packed!")) - else - var/lighting_text = O.ignition_effect(src,user) - if(lighting_text) - if(smoketime > 0) - light(lighting_text) - else - to_chat(user, span_warning("There is nothing to smoke!")) - else +/obj/item/clothing/mask/cigarette/pipe/attackby(obj/item/thing, mob/user, params) + if(!istype(thing, /obj/item/food/grown)) + var/lighting_text = thing.ignition_effect(src,user) + if(!lighting_text) return ..() + if(smoketime > 0) + light(lighting_text) + else + to_chat(user, span_warning("There is nothing to smoke!")) + return + + var/obj/item/food/grown/to_smoke = thing + if(packeditem) + to_chat(user, span_warning("It is already packed!")) + return + if(!HAS_TRAIT(to_smoke, TRAIT_DRIED)) + to_chat(user, span_warning("It has to be dried first!")) + return + + to_chat(user, span_notice("You stuff [to_smoke] into [src].")) + smoketime = 13 MINUTES + packeditem = TRUE + name = "[to_smoke.name]-packed [initial(name)]" + if(to_smoke.reagents) + to_smoke.reagents.trans_to(src, to_smoke.reagents.total_volume, transfered_by = user) + qdel(to_smoke) + + /obj/item/clothing/mask/cigarette/pipe/attack_self(mob/user) var/turf/location = get_turf(user) if(lit) @@ -598,14 +627,16 @@ CIGARETTE PACKETS ARE IN FANCY.DM inhand_icon_state = icon_off STOP_PROCESSING(SSobj, src) return - if(!lit && smoketime > 0) - to_chat(user, span_notice("You empty [src] onto [location].")) - new /obj/effect/decal/cleanable/ash(location) - packeditem = FALSE - smoketime = 0 - reagents.clear_reagents() - name = "empty [initial(name)]" - return + + if(smoketime <= 0) + return + + to_chat(user, span_notice("You empty [src] onto [location].")) + new /obj/effect/decal/cleanable/ash(location) + packeditem = FALSE + smoketime = 0 + reagents.clear_reagents() + name = "empty [initial(name)]" /obj/item/clothing/mask/cigarette/pipe/cobpipe name = "corn cob pipe" @@ -614,7 +645,6 @@ CIGARETTE PACKETS ARE IN FANCY.DM inhand_icon_state = "cobpipeoff" icon_on = "cobpipeon" //Note - these are in masks.dmi icon_off = "cobpipeoff" - smoketime = 0 ///////// @@ -639,9 +669,13 @@ CIGARETTE PACKETS ARE IN FANCY.DM light_power = 0.6 light_color = LIGHT_COLOR_FIRE light_on = FALSE + /// Whether the lighter is lit. var/lit = FALSE + /// Whether the lighter is fancy. Fancy lighters have fancier flavortext and won't burn thumbs. var/fancy = TRUE + /// The engraving overlay used by this lighter. var/overlay_state + /// A list of possible engraving overlays. var/overlay_list = list( "plain", "dame", @@ -669,24 +703,26 @@ CIGARETTE PACKETS ARE IN FANCY.DM user.visible_message(span_suicide("[user] begins whacking [user.p_them()]self with \the [src]! It looks like [user.p_theyre()] trying to commit suicide!")) return BRUTELOSS -/obj/item/lighter/update_overlays() - . = ..() - . += create_lighter_overlay() - /obj/item/lighter/update_icon_state() icon_state = "[initial(icon_state)][lit ? "-on" : ""]" return ..() +/obj/item/lighter/update_overlays() + . = ..() + . += create_lighter_overlay() + +/// Generates an overlay used by this lighter. /obj/item/lighter/proc/create_lighter_overlay() return mutable_appearance(icon, "lighter_overlay_[overlay_state][lit ? "-on" : ""]") /obj/item/lighter/ignition_effect(atom/A, mob/user) if(get_temperature()) - . = "With a single flick of [user.p_their()] wrist, [user] smoothly lights [A] with [src]. Damn [user.p_theyre()] cool." + . = span_infoplain(span_rose("With a single flick of [user.p_their()] wrist, [user] smoothly lights [A] with [src]. Damn [user.p_theyre()] cool.")) /obj/item/lighter/proc/set_lit(new_lit) if(lit == new_lit) return + lit = new_lit if(lit) force = 5 @@ -708,59 +744,80 @@ CIGARETTE PACKETS ARE IN FANCY.DM set_lit(FALSE) /obj/item/lighter/attack_self(mob/living/user) - if(user.is_holding(src)) - if(!lit) - set_lit(TRUE) - if(fancy) - user.visible_message(span_notice("Without even breaking stride, [user] flips open and lights [src] in one smooth movement."), span_notice("Without even breaking stride, you flip open and light [src] in one smooth movement.")) - else - var/prot = FALSE - var/mob/living/carbon/human/H = user - - if(istype(H) && H.gloves) - var/obj/item/clothing/gloves/G = H.gloves - if(G.max_heat_protection_temperature) - prot = (G.max_heat_protection_temperature > 360) - else - prot = TRUE - - if(prot || prob(75)) - user.visible_message(span_notice("After a few attempts, [user] manages to light [src]."), span_notice("After a few attempts, you manage to light [src].")) - else - var/hitzone = user.held_index_to_dir(user.active_hand_index) == "r" ? BODY_ZONE_PRECISE_R_HAND : BODY_ZONE_PRECISE_L_HAND - user.apply_damage(5, BURN, hitzone) - user.visible_message(span_warning("After a few attempts, [user] manages to light [src] - however, [user.p_they()] burn [user.p_their()] finger in the process."), span_warning("You burn yourself while lighting the lighter!")) - SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, "burnt_thumb", /datum/mood_event/burnt_thumb) - + if(!user.is_holding(src)) + return ..() + if(lit) + set_lit(FALSE) + if(fancy) + user.visible_message( + span_notice("You hear a quiet click, as [user] shuts off [src] without even looking at what [user.p_theyre()] doing. Wow."), + span_notice("You quietly shut off [src] without even looking at what you're doing. Wow.") + ) else - set_lit(FALSE) - if(fancy) - user.visible_message(span_notice("You hear a quiet click, as [user] shuts off [src] without even looking at what [user.p_theyre()] doing. Wow."), span_notice("You quietly shut off [src] without even looking at what you're doing. Wow.")) - else - user.visible_message(span_notice("[user] quietly shuts off [src]."), span_notice("You quietly shut off [src].")) + user.visible_message( + span_notice("[user] quietly shuts off [src]."), + span_notice("You quietly shut off [src].") + ) + return + + set_lit(TRUE) + if(fancy) + user.visible_message( + span_notice("Without even breaking stride, [user] flips open and lights [src] in one smooth movement."), + span_notice("Without even breaking stride, you flip open and light [src] in one smooth movement.") + ) + return + + var/hand_protected = FALSE + var/mob/living/carbon/human/human_user = user + if(!istype(human_user) || HAS_TRAIT(human_user, TRAIT_RESISTHEAT) || HAS_TRAIT(human_user, TRAIT_RESISTHEATHANDS)) + hand_protected = TRUE + else if(!istype(human_user.gloves, /obj/item/clothing/gloves)) + hand_protected = FALSE else - . = ..() + var/obj/item/clothing/gloves/gloves = human_user.gloves + if(gloves.max_heat_protection_temperature) + hand_protected = (gloves.max_heat_protection_temperature > 360) + + if(hand_protected || prob(75)) + user.visible_message( + span_notice("After a few attempts, [user] manages to light [src]."), + span_notice("After a few attempts, you manage to light [src].") + ) + return + + var/hitzone = user.held_index_to_dir(user.active_hand_index) == "r" ? BODY_ZONE_PRECISE_R_HAND : BODY_ZONE_PRECISE_L_HAND + user.apply_damage(5, BURN, hitzone) + user.visible_message( + span_warning("After a few attempts, [user] manages to light [src] - however, [user.p_they()] burn [user.p_their()] finger in the process."), + span_warning("You burn yourself while lighting the lighter!") + ) + SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, "burnt_thumb", /datum/mood_event/burnt_thumb) + /obj/item/lighter/attack(mob/living/carbon/M, mob/living/carbon/user) if(lit && M.IgniteMob()) message_admins("[ADMIN_LOOKUPFLW(user)] set [key_name_admin(M)] on fire with [src] at [AREACOORD(user)]") log_game("[key_name(user)] set [key_name(M)] on fire with [src] at [AREACOORD(user)]") var/obj/item/clothing/mask/cigarette/cig = help_light_cig(M) - if(lit && cig && !user.combat_mode) - if(cig.lit) - to_chat(user, span_warning("The [cig.name] is already lit!")) - if(M == user) - cig.attackby(src, user) - else - if(fancy) - cig.light(span_rose("[user] whips the [name] out and holds it for [M]. [user.p_their(TRUE)] arm is as steady as the unflickering flame [user.p_they()] light[user.p_s()] \the [cig] with.")) - else - cig.light(span_notice("[user] holds the [name] out for [M], and lights [M.p_their()] [cig.name].")) - else + if(!lit || !cig || user.combat_mode) ..() + return + + if(cig.lit) + to_chat(user, span_warning("The [cig.name] is already lit!")) + if(M == user) + cig.attackby(src, user) + return + + if(fancy) + cig.light(span_rose("[user] whips the [name] out and holds it for [M]. [user.p_their(TRUE)] arm is as steady as the unflickering flame [user.p_they()] light[user.p_s()] \the [cig] with.")) + else + cig.light(span_notice("[user] holds the [name] out for [M], and lights [M.p_their()] [cig.name].")) + /obj/item/lighter/process() - open_flame() + open_flame(heat) /obj/item/lighter/get_temperature() return lit * heat @@ -777,7 +834,10 @@ CIGARETTE PACKETS ARE IN FANCY.DM "matte", "zoppo" //u cant stoppo th zoppo ) + + /// The color of the lighter. var/lighter_color + /// The set of colors this lighter can be autoset as on init. var/list/color_list = list( //Same 16 color selection as electronic assemblies COLOR_ASSEMBLY_BLACK, COLOR_FLOORTILE_GRAY, @@ -837,19 +897,21 @@ CIGARETTE PACKETS ARE IN FANCY.DM . = ..() if(!proximity) return - if(istype(target, /obj/item/food/grown)) - var/obj/item/food/grown/O = target - if(HAS_TRAIT(O, TRAIT_DRIED)) - var/obj/item/clothing/mask/cigarette/rollie/R = new /obj/item/clothing/mask/cigarette/rollie(user.loc) - R.chem_volume = target.reagents.total_volume - target.reagents.trans_to(R, R.chem_volume, transfered_by = user) - qdel(target) - qdel(src) - user.put_in_active_hand(R) - to_chat(user, span_notice("You roll the [target.name] into a rolling paper.")) - R.desc = "Dried [target.name] rolled up in a thin piece of paper." - else - to_chat(user, span_warning("You need to dry this first!")) + if(!istype(target, /obj/item/food/grown)) + return + + if(!HAS_TRAIT(target, TRAIT_DRIED)) + to_chat(user, span_warning("You need to dry [target] first!")) + return + + var/obj/item/clothing/mask/cigarette/rollie/R = new /obj/item/clothing/mask/cigarette/rollie(user.loc) + R.chem_volume = target.reagents.maximum_volume + target.reagents.trans_to(R, R.chem_volume, transfered_by = user) + qdel(target) + qdel(src) + user.put_in_active_hand(R) + to_chat(user, span_notice("You roll the [target.name] into a rolling paper.")) + R.desc = "Dried [target.name] rolled up in a thin piece of paper." /////////////// //VAPE NATION// @@ -862,17 +924,17 @@ CIGARETTE PACKETS ARE IN FANCY.DM icon_state = "red_vape" inhand_icon_state = null w_class = WEIGHT_CLASS_TINY + + /// The capacity of the vape. var/chem_volume = 100 - var/vapetime = 0 //this so it won't puff out clouds every tick - /// How often we take a drag in seconds - var/vapedelay = 8 - var/screw = FALSE // kinky - var/super = FALSE //for the fattest vapes dude. - -/obj/item/clothing/mask/vape/suicide_act(mob/user) - user.visible_message(span_suicide("[user] is puffin hard on dat vape, [user.p_they()] trying to join the vape life on a whole notha plane!"))//it doesn't give you cancer, it is cancer - return (TOXLOSS|OXYLOSS) - + /// The amount of time between drags. + var/dragtime = 8 SECONDS + /// A cooldown to prevent huffing the vape all at once. + COOLDOWN_DECLARE(drag_cooldown) + /// Whether the resevoir is open and we can add reagents. + var/screw = FALSE + /// Whether the vape has been overloaded to spread smoke. + var/super = FALSE /obj/item/clothing/mask/vape/Initialize(mapload, param_color) . = ..() @@ -883,6 +945,10 @@ CIGARETTE PACKETS ARE IN FANCY.DM icon_state = "[param_color]_vape" inhand_icon_state = "[param_color]_vape" +/obj/item/clothing/mask/vape/suicide_act(mob/user) + user.visible_message(span_suicide("[user] is puffin hard on dat vape, [user.p_they()] trying to join the vape life on a whole notha plane!"))//it doesn't give you cancer, it is cancer + return (TOXLOSS|OXYLOSS) + /obj/item/clothing/mask/vape/attackby(obj/item/O, mob/user, params) if(O.tool_behaviour == TOOL_SCREWDRIVER) if(!screw) @@ -943,13 +1009,16 @@ CIGARETTE PACKETS ARE IN FANCY.DM /obj/item/clothing/mask/vape/equipped(mob/user, slot) . = ..() - if(slot == ITEM_SLOT_MASK) - if(!screw) - to_chat(user, span_notice("You start puffing on the vape.")) - reagents.flags &= ~(NO_REACT) - START_PROCESSING(SSobj, src) - else //it will not start if the vape is opened. - to_chat(user, span_warning("You need to close the cap first!")) + if(slot != ITEM_SLOT_MASK) + return + + if(screw) + to_chat(user, span_warning("You need to close the cap first!")) + return + + to_chat(user, span_notice("You start puffing on the vape.")) + reagents.flags &= ~(NO_REACT) + START_PROCESSING(SSobj, src) /obj/item/clothing/mask/vape/dropped(mob/user) . = ..() @@ -957,26 +1026,27 @@ CIGARETTE PACKETS ARE IN FANCY.DM reagents.flags |= NO_REACT STOP_PROCESSING(SSobj, src) -/obj/item/clothing/mask/vape/proc/hand_reagents()//had to rename to avoid duplicate error - if(reagents.total_volume) - if(iscarbon(loc)) - var/mob/living/carbon/C = loc - if (src == C.wear_mask) // if it's in the human/monkey mouth, transfer reagents to the mob - var/fraction = min(REAGENTS_METABOLISM/reagents.total_volume, 1) //this will react instantly, making them a little more dangerous than cigarettes - reagents.expose(C, INGEST, fraction) - if(!reagents.trans_to(C, REAGENTS_METABOLISM)) - reagents.remove_any(REAGENTS_METABOLISM) - if(reagents.get_reagent_amount(/datum/reagent/fuel)) - //HOT STUFF - C.adjust_fire_stacks(2) - C.IgniteMob() +/obj/item/clothing/mask/vape/proc/handle_reagents() + if(!reagents.total_volume) + return - if(reagents.get_reagent_amount(/datum/reagent/toxin/plasma)) // the plasma explodes when exposed to fire - var/datum/effect_system/reagents_explosion/e = new() - e.set_up(round(reagents.get_reagent_amount(/datum/reagent/toxin/plasma) / 2.5, 1), get_turf(src), 0, 0) - e.start() - qdel(src) - return + var/mob/living/carbon/vaper = loc + if(!iscarbon(vaper) || src != vaper.wear_mask) + reagents.remove_any(REAGENTS_METABOLISM) + return + + if(reagents.get_reagent_amount(/datum/reagent/fuel)) + //HOT STUFF + vaper.adjust_fire_stacks(2) + vaper.IgniteMob() + + if(reagents.get_reagent_amount(/datum/reagent/toxin/plasma)) // the plasma explodes when exposed to fire + var/datum/effect_system/reagents_explosion/e = new() + e.set_up(round(reagents.get_reagent_amount(/datum/reagent/toxin/plasma) / 2.5, 1), get_turf(src), 0, 0) + e.start() + qdel(src) + + if(!reagents.trans_to(vaper, REAGENTS_METABOLISM, methods = INGEST, ignore_stomach = TRUE)) reagents.remove_any(REAGENTS_METABOLISM) /obj/item/clothing/mask/vape/process(delta_time) @@ -985,28 +1055,23 @@ CIGARETTE PACKETS ARE IN FANCY.DM if(isliving(loc)) M.IgniteMob() - vapetime += delta_time - if(!reagents.total_volume) if(ismob(loc)) to_chat(M, span_warning("[src] is empty!")) STOP_PROCESSING(SSobj, src) //it's reusable so it won't unequip when empty return - //open flame removed because vapes are a closed system, they won't light anything on fire - if(super && vapetime >= vapedelay)//Time to start puffing those fat vapes, yo. - var/datum/effect_system/smoke_spread/chem/smoke_machine/s = new - s.set_up(reagents, 1, 24, loc) - s.start() - vapetime -= vapedelay + if(!COOLDOWN_FINISHED(src, drag_cooldown)) + return - if((obj_flags & EMAGGED) && vapetime >= vapedelay) + //Time to start puffing those fat vapes, yo. + COOLDOWN_START(src, drag_cooldown, dragtime) + if(obj_flags & EMAGGED) var/datum/effect_system/smoke_spread/chem/smoke_machine/s = new s.set_up(reagents, 4, 24, loc) s.start() - vapetime -= vapedelay - if(prob(5))//small chance for the vape to break and deal damage if it's emagged + if(prob(5)) //small chance for the vape to break and deal damage if it's emagged playsound(get_turf(src), 'sound/effects/pop_expl.ogg', 50, FALSE) M.apply_damage(20, BURN, BODY_ZONE_HEAD) M.Paralyze(300) @@ -1016,6 +1081,9 @@ CIGARETTE PACKETS ARE IN FANCY.DM to_chat(M, span_userdanger("[src] suddenly explodes in your mouth!")) qdel(src) return + else if(super) + var/datum/effect_system/smoke_spread/chem/smoke_machine/s = new + s.set_up(reagents, 1, 24, loc) + s.start() - if(reagents?.total_volume) - hand_reagents() + handle_reagents()