From 54b979eb340590c3be50263cc4d479e8e5c28878 Mon Sep 17 00:00:00 2001 From: Krausus Date: Thu, 30 Apr 2015 09:22:21 -0400 Subject: [PATCH] Adds nicotine addiction to smokables --- .../objects/items/weapons/cigs_lighters.dm | 62 ++++++++++--------- code/modules/reagents/Chemistry-Holder.dm | 2 +- code/modules/reagents/newchem/drugs.dm | 4 +- 3 files changed, 35 insertions(+), 33 deletions(-) diff --git a/code/game/objects/items/weapons/cigs_lighters.dm b/code/game/objects/items/weapons/cigs_lighters.dm index 27e3b00b489..8a113f14fce 100644 --- a/code/game/objects/items/weapons/cigs_lighters.dm +++ b/code/game/objects/items/weapons/cigs_lighters.dm @@ -68,12 +68,14 @@ CIGARETTE PACKETS ARE IN FANCY.DM var/lastHolder = null var/smoketime = 300 var/chem_volume = 15 + var/has_nicotine = 1 /obj/item/clothing/mask/cigarette/New() ..() flags |= NOREACT // so it doesn't react until you light it create_reagents(chem_volume) // making the cigarrete a chemical holder with a maximum volume of 15 - reagents.add_reagent("nicotine", 15) + if(has_nicotine) + reagents.add_reagent("nicotine", 15) /obj/item/clothing/mask/cigarette/Destroy() ..() @@ -162,7 +164,6 @@ CIGARETTE PACKETS ARE IN FANCY.DM /obj/item/clothing/mask/cigarette/process() - var/turf/location = get_turf(src) var/mob/living/M = loc if(isliving(loc)) M.IgniteMob() @@ -170,20 +171,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM if(smoketime < 1) die() return - if(location) - location.hotspot_expose(700, 5) - if(reagents && reagents.total_volume) // check if it has any reagents at all - if(iscarbon(loc) && (src == loc:wear_mask)) // if it's in the human/monkey mouth, transfer reagents to the mob - if(istype(loc, /mob/living/carbon/human)) - var/mob/living/carbon/human/H = loc - if(H.species.flags & IS_SYNTHETIC) - return - var/mob/living/carbon/C = loc - if(prob(15)) // so it's not an instarape in case of acid - reagents.reaction(C, INGEST) - reagents.trans_to(C, REAGENTS_METABOLISM) - else // else just remove some of the reagents - reagents.remove_any(REAGENTS_METABOLISM) + smoke() return @@ -193,6 +181,32 @@ CIGARETTE PACKETS ARE IN FANCY.DM die() return ..() +/obj/item/clothing/mask/cigarette/proc/smoke() + var/turf/location = get_turf(src) + var/smoker_is_synthetic = 0 + if(istype(loc, /mob/living/carbon/human)) + var/mob/living/carbon/human/H = loc + if(H.species.flags & IS_SYNTHETIC) + smoker_is_synthetic = 1 // Synthetics can't smoke! + if(location) + location.hotspot_expose(700, 5) + if(reagents && reagents.total_volume) // check if it has any reagents at all + if(iscarbon(loc) && (src == loc:wear_mask) && !smoker_is_synthetic) // if it's in the human/monkey mouth, transfer reagents to the mob + var/mob/living/carbon/C = loc + if(prob(15)) // so it's not an instarape in case of acid + reagents.reaction(C, INGEST) + reagents.trans_to(C, REAGENTS_METABOLISM) + if(!reagents.total_volume) // There were reagents, but now they're gone + C << "Your [name] no longer tastes the same..." + else // else just remove some of the reagents + reagents.remove_any(REAGENTS_METABOLISM) + + if(has_nicotine && iscarbon(loc) && (src == loc:wear_mask) && !smoker_is_synthetic) + var/mob/living/carbon/C = loc + if (!C.reagents.has_reagent("nicotine")) + C.reagents.add_reagent("nicotine", 0.1) + return + /obj/item/clothing/mask/cigarette/proc/die() var/turf/T = get_turf(src) var/obj/item/butt = new type_butt(T) @@ -216,6 +230,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM item_state = "spliffoff" smoketime = 180 chem_volume = 50 + has_nicotine = 0 // The plants these are made from don't actually contain nicotine /obj/item/clothing/mask/cigarette/joint/New() ..() @@ -331,20 +346,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM M.update_inv_wear_mask(0) processing_objects.Remove(src) return - if(location) - location.hotspot_expose(700, 5) - if(reagents && reagents.total_volume) // check if it has any reagents at all - if(iscarbon(loc) && (src == loc:wear_mask)) // if it's in the human/monkey mouth, transfer reagents to the mob - if(istype(loc, /mob/living/carbon/human)) - var/mob/living/carbon/human/H = loc - if(H.species.flags & IS_SYNTHETIC) - return - var/mob/living/carbon/C = loc - if(prob(15)) // so it's not an instarape in case of acid - reagents.reaction(C, INGEST) - reagents.trans_to(C, REAGENTS_METABOLISM) - else // else just remove some of the reagents - reagents.remove_any(REAGENTS_METABOLISM) + smoke() return /obj/item/clothing/mask/cigarette/pipe/attack_self(mob/user as mob) //Refills the pipe. Can be changed to an attackby later, if loose tobacco is added to vendors or something. diff --git a/code/modules/reagents/Chemistry-Holder.dm b/code/modules/reagents/Chemistry-Holder.dm index 5c05909becd..e0064fec12e 100644 --- a/code/modules/reagents/Chemistry-Holder.dm +++ b/code/modules/reagents/Chemistry-Holder.dm @@ -63,7 +63,7 @@ datum if(current_list_element > reagent_list.len) current_list_element = 1 var/datum/reagent/current_reagent = reagent_list[current_list_element] - src.remove_reagent(current_reagent.id, 1) + src.remove_reagent(current_reagent.id, min(1, amount - total_transfered)) current_list_element++ total_transfered++ diff --git a/code/modules/reagents/newchem/drugs.dm b/code/modules/reagents/newchem/drugs.dm index b7012cb7b24..9515a5c9e38 100644 --- a/code/modules/reagents/newchem/drugs.dm +++ b/code/modules/reagents/newchem/drugs.dm @@ -11,14 +11,14 @@ datum/reagent/nicotine reagent_state = LIQUID color = "#60A584" // rgb: 96, 165, 132 overdose_threshold = 35 - addiction_threshold = 30 + addiction_threshold = 0.1 datum/reagent/nicotine/on_mob_life(var/mob/living/M as mob) if(!M) M = holder.my_atom var/smoke_message = pick("You can just feel your lungs dying!", "You feel relaxed.", "You feel calmed.", "You feel the lung cancer forming.", "You feel the money you wasted.", "You feel like a space cowboy.", "You feel rugged.") if(prob(5)) M << "[smoke_message]" - if(prob(50)) + if(volume >= 0.2 && prob(50)) // Trace amounts of nicotine are ineffective M.AdjustParalysis(-1) M.AdjustStunned(-1) M.AdjustWeakened(-1)