Merge pull request #906 from Krausus/NicotineAddiction

Cigarette Fixes/Tweaks
This commit is contained in:
Fox-McCloud
2015-05-02 23:29:49 -04:00
5 changed files with 76 additions and 68 deletions
@@ -67,13 +67,12 @@ CIGARETTE PACKETS ARE IN FANCY.DM
var/type_butt = /obj/item/weapon/cigbutt
var/lastHolder = null
var/smoketime = 300
var/chem_volume = 15
var/chem_volume = 30
/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)
create_reagents(chem_volume) // making the cigarrete a chemical holder with a maximum volume of 30
/obj/item/clothing/mask/cigarette/Destroy()
..()
@@ -162,7 +161,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,29 +168,39 @@ 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
/obj/item/clothing/mask/cigarette/attack_self(mob/user as mob)
if(lit == 1)
if(lit)
user.visible_message("<span class='notice'>[user] calmly drops and treads on the lit [src], putting it out instantly.</span>")
die()
return ..()
/obj/item/clothing/mask/cigarette/proc/smoke()
var/turf/location = get_turf(src)
var/is_being_smoked = 0
// Check whether this is actually in a mouth, being smoked
if(iscarbon(loc))
var/mob/living/carbon/C = loc
if(src == C.wear_mask)
// There used to be a species check here, but synthetics can smoke now
is_being_smoked = 1
if(location)
location.hotspot_expose(700, 5)
if(reagents && reagents.total_volume) // check if it has any reagents at all
if(is_being_smoked) // if it's being smoked, 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 << "<span class='notice'>Your [name] loses its flavor.</span>"
else // else just remove some of the reagents
reagents.remove_any(REAGENTS_METABOLISM)
return
/obj/item/clothing/mask/cigarette/proc/die()
var/turf/T = get_turf(src)
var/obj/item/butt = new type_butt(T)
@@ -250,7 +258,11 @@ CIGARETTE PACKETS ARE IN FANCY.DM
throw_speed = 0.5
item_state = "cigaroff"
smoketime = 1500
chem_volume = 20
chem_volume = 40
/obj/item/clothing/mask/cigarette/cigar/New()
..()
reagents.add_reagent("nicotine", chem_volume/2)
/obj/item/clothing/mask/cigarette/cigar/cohiba
name = "Cohiba Robusto Cigar"
@@ -266,7 +278,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM
icon_on = "cigar2on"
icon_off = "cigar2off"
smoketime = 7200
chem_volume = 30
chem_volume = 60
/obj/item/weapon/cigbutt
name = "cigarette butt"
@@ -307,6 +319,10 @@ CIGARETTE PACKETS ARE IN FANCY.DM
smoketime = 1000
chem_volume = 50
/obj/item/clothing/mask/cigarette/pipe/New()
..()
reagents.add_reagent("nicotine", chem_volume)
/obj/item/clothing/mask/cigarette/pipe/light(var/flavor_text = "[usr] lights the [name].")
if(!src.lit)
src.lit = 1
@@ -331,24 +347,11 @@ 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.
if(lit == 1)
if(lit)
user.visible_message("<span class='notice'>[user] puts out [src].</span>")
lit = 0
icon_state = icon_off
@@ -154,14 +154,22 @@
slot_flags = SLOT_BELT
storage_slots = 6
can_hold = list("/obj/item/clothing/mask/cigarette")
cant_hold = list("/obj/item/clothing/mask/cigarette/cigar",
"/obj/item/clothing/mask/cigarette/pipe")
icon_type = "cigarette"
var/list/unlaced_cigarettes = list() // Cigarettes that haven't received reagents yet
var/default_reagents = list("nicotine" = 15) // List of reagents to pre-generate for each cigarette
/obj/item/weapon/storage/fancy/cigarettes/New()
..()
flags |= NOREACT
create_reagents(30 * storage_slots)//so people can inject cigarettes without opening a packet, now with being able to inject the whole one
for(var/i = 1 to storage_slots)
new /obj/item/clothing/mask/cigarette(src)
create_reagents(15 * storage_slots)//so people can inject cigarettes without opening a packet, now with being able to inject the whole one
var/obj/item/clothing/mask/cigarette/C = new /obj/item/clothing/mask/cigarette(src)
unlaced_cigarettes += C
for(var/R in default_reagents)
reagents.add_reagent(R, default_reagents[R])
/obj/item/weapon/storage/fancy/cigarettes/Destroy()
del(reagents)
@@ -173,22 +181,25 @@
desc = "There are [contents.len] cig\s left!"
return
/obj/item/weapon/storage/fancy/cigarettes/proc/lace_cigarette(var/obj/item/clothing/mask/cigarette/C as obj)
if(istype(C) && (C in unlaced_cigarettes)) // Only transfer reagents to each cigarette once
reagents.trans_to(C, (reagents.total_volume/unlaced_cigarettes.len))
unlaced_cigarettes -= C
reagents.maximum_volume = 30 * unlaced_cigarettes.len
/obj/item/weapon/storage/fancy/cigarettes/remove_from_storage(obj/item/W as obj, atom/new_location)
var/obj/item/clothing/mask/cigarette/C = W
if(!istype(C)) return // what
reagents.trans_to(C, (reagents.total_volume/contents.len))
..()
lace_cigarette(W)
..()
/obj/item/weapon/storage/fancy/cigarettes/attack(mob/living/carbon/M as mob, mob/living/carbon/user as mob)
if(!istype(M, /mob))
return
if(M == user && user.zone_sel.selecting == "mouth" && contents.len > 0 && !user.wear_mask)
var/obj/item/clothing/mask/cigarette/W = new /obj/item/clothing/mask/cigarette(user)
reagents.trans_to(W, (reagents.total_volume/contents.len))
user.equip_to_slot_if_possible(W, slot_wear_mask)
reagents.maximum_volume = 15 * contents.len
contents.len--
if(istype(M) && M == user && user.zone_sel.selecting == "mouth" && contents.len > 0 && !user.wear_mask)
var/obj/item/clothing/mask/cigarette/C = contents[contents.len]
if(!istype(C)) return
lace_cigarette(C)
user.equip_to_slot_if_possible(C, slot_wear_mask)
user << "<span class='notice'>You take a cigarette out of the pack.</span>"
update_icon()
else
@@ -217,11 +228,7 @@
desc = "An obscure brand of cigarettes."
icon_state = "syndiepacket"
item_state = "cigpacket"
/obj/item/weapon/storage/fancy/cigarettes/cigpack_syndicate/New()
..()
for(var/i = 1 to storage_slots)
reagents.add_reagent("omnizine",15)
default_reagents = list("nicotine" = 15, "omnizine" = 15)
/obj/item/weapon/storage/fancy/cigarettes/cigpack_uplift
name = "\improper Uplift Smooth packet"
@@ -240,11 +247,7 @@
desc = "Smoked by the truly robust."
icon_state = "robustgpacket"
item_state = "cigpacket"
/obj/item/weapon/storage/fancy/cigarettes/cigpack_robustgold/New()
..()
for(var/i = 1 to storage_slots)
reagents.add_reagent("gold",1)
default_reagents = list("nicotine" = 15, "gold" = 1)
/obj/item/weapon/storage/fancy/cigarettes/cigpack_carp
name = "\improper Carp Classic packet"
@@ -263,14 +266,11 @@
desc = "Is your weight slowing you down? Having trouble running away from gravitational singularities? Can't stop stuffing your mouth? Smoke Shady Jim's Super Slims and watch all that fat burn away. Guaranteed results!"
icon_state = "shadyjimpacket"
item_state = "cigpacket"
/obj/item/weapon/storage/fancy/cigarettes/cigpack_shadyjims/New()
..()
for(var/i = 1 to storage_slots)
reagents.add_reagent("lipolicide",4)
reagents.add_reagent("ammonia",2)
reagents.add_reagent("atrazine",1)
reagents.add_reagent("toxin",1.5)
default_reagents = list("nicotine" = 15,
"lipolicide" = 7.5,
"ammonia" = 2,
"atrazine" = 1,
"toxin" = 1.5)
/*
* Vial Box