Cigarettes and chewables stay in your mouth/hands when they go out, and cigs no longer stay lit in storage (#9302)

This commit is contained in:
Wowzewow (Wezzy)
2020-07-14 11:52:14 +02:00
committed by GitHub
parent 48e7f3334a
commit 7cdd4ec5e2
5 changed files with 82 additions and 29 deletions
+13 -4
View File
@@ -87,16 +87,25 @@ obj/item/clothing/mask/chewable/Destroy()
/obj/item/clothing/mask/chewable/proc/spitout(var/mob/user, var/no_message)
STOP_PROCESSING(SSprocessing, src)
if (type_butt)
var/obj/item/butt = new type_butt(get_turf(src))
if(type_butt)
var/obj/item/butt = new type_butt(user)
transfer_fingerprints_to(butt)
butt.color = color
if(brand)
butt.desc += " This one is \a [brand]."
if(ismob(loc))
var/mob/living/M = loc
if (!no_message)
to_chat(M, SPAN_NOTICE("You spit out the [name]."))
if(!no_message)
to_chat(M, SPAN_NOTICE("The [name] runs out of flavor."))
if(M.wear_mask)
M.remove_from_mob(src) //un-equip it so the overlays can update
M.update_inv_wear_mask(0)
M.equip_to_slot_if_possible(butt, slot_wear_mask)
else
M.remove_from_mob(src) // if it gets blocked somehow, since chewables shouldn't be processing outside the mask slot.
M.update_inv_l_hand(0)
M.update_inv_r_hand(1)
M.put_in_hands(butt)
qdel(src)
/obj/item/clothing/mask/chewable/tobacco/bad
@@ -56,7 +56,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM
attack_verb = list("flicked")
drop_sound = 'sound/items/cigs_lighters/cig_snuff.ogg'
pickup_sound = 'sound/items/pickup/food.ogg'
/obj/item/trash/match/Initialize()
. = ..()
randpixel_xy()
@@ -173,8 +173,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM
create_reagents(chem_volume) // making the cigarrete a chemical holder with a maximum volume of 15
/obj/item/clothing/mask/smokable/process()
if(reagents && reagents.total_volume && burn_rate)
if(reagents && reagents.total_volume && burn_rate && !istype(loc, /obj/item/storage))
if(!initial_volume)
initial_volume = reagents.total_volume
var/mob/living/carbon/human/C = loc
@@ -225,28 +224,33 @@ CIGARETTE PACKETS ARE IN FANCY.DM
set_light(2, 0.25, "#E38F46")
START_PROCESSING(SSprocessing, src)
/obj/item/clothing/mask/smokable/proc/die(var/nomessage = FALSE)
/obj/item/clothing/mask/smokable/proc/die(var/no_message = 0, var/mob/living/M)
var/turf/T = get_turf(src)
set_light(0)
playsound(src.loc, 'sound/items/cigs_lighters/cig_snuff.ogg', 50, 1)
if (type_butt)
var/obj/item/butt = new type_butt(T)
if(type_butt)
var/obj/item/butt = new type_butt(src.loc)
transfer_fingerprints_to(butt)
if(ismob(loc))
var/mob/living/M = loc
if (!nomessage)
M = loc
if(!no_message)
to_chat(M, SPAN_NOTICE("Your [name] goes out."))
M.remove_from_mob(src) //un-equip it so the overlays can update
M.update_inv_wear_mask(0)
M.update_inv_l_hand(0)
M.update_inv_r_hand(1)
if(M.wear_mask)
M.remove_from_mob(src) //un-equip it so the overlays can update
M.update_inv_wear_mask(0)
M.equip_to_slot_if_possible(butt, slot_wear_mask)
else
M.remove_from_mob(src) // if it dies in your hand.
M.update_inv_l_hand(0)
M.update_inv_r_hand(1)
M.put_in_hands(butt)
STOP_PROCESSING(SSprocessing, src)
qdel(src)
else
new /obj/effect/decal/cleanable/ash(T)
if(ismob(loc))
var/mob/living/M = loc
if (!nomessage)
M = loc
if(!no_message)
to_chat(M, SPAN_NOTICE("Your [name] goes out, and you empty the ash."))
playsound(src.loc, 'sound/items/cigs_lighters/cig_snuff.ogg', 50, 1)
lit = 0
@@ -287,7 +291,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM
icon_state = "cigoff"
throw_speed = 0.5
item_state = "cigoff"
w_class = 1
w_class = ITEMSIZE_TINY
slot_flags = SLOT_EARS | SLOT_MASK
attack_verb = list("burnt", "singed")
icon_on = "cigon" //Note - these are in masks.dmi not in cigarette.dmi
@@ -306,15 +310,12 @@ CIGARETTE PACKETS ARE IN FANCY.DM
reagents.add_reagent(/datum/reagent/toxin/tobacco,10)
reagents.add_reagent(/datum/reagent/mental/nicotine,5) // 2/3 ratio, Adds 0.03 units per second
/obj/item/clothing/mask/smokable/cigarette/attackby(obj/item/W as obj, mob/user as mob)
..()
if(istype(W, /obj/item/melee/energy/sword))
var/obj/item/melee/energy/sword/S = W
if(S.active)
light(SPAN_WARNING("[user] swings their [W], barely missing themselves. They light their [name] in the process."))
return
/obj/item/clothing/mask/smokable/cigarette/attack(mob/living/carbon/human/H, mob/user, def_zone)
@@ -481,10 +482,11 @@ CIGARETTE PACKETS ARE IN FANCY.DM
icon = 'icons/obj/clothing/masks.dmi'
icon_state = "cigbutt"
randpixel = 10
w_class = 1
slot_flags = SLOT_EARS
w_class = ITEMSIZE_TINY
slot_flags = SLOT_EARS | SLOT_MASK
throwforce = 1
drop_sound = 'sound/items/cigs_lighters/cig_snuff.ogg'
pickup_sound = 'sound/items/pickup/food.ogg'
/obj/item/trash/cigbutt/Initialize()
. = ..()
@@ -535,7 +537,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM
icon_on = "pipeon" //Note - these are in masks.dmi
icon_off = "pipeoff"
burn_rate = 0.003
w_class = 1
w_class = ITEMSIZE_TINY
chem_volume = 30
matchmes = "<span class='notice'>USER lights their NAME with their FLAME.</span>"
lightermes = "<span class='notice'>USER manages to light their NAME with FLAME.</span>"
@@ -641,7 +643,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM
slot_l_hand_str = 'icons/mob/items/lefthand_cigs_lighters.dmi',
slot_r_hand_str = 'icons/mob/items/righthand_cigs_lighters.dmi',
)
w_class = 1
w_class = ITEMSIZE_TINY
throwforce = 4
flags = CONDUCT
slot_flags = SLOT_BELT
@@ -802,7 +804,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM
desc = "A thin piece of paper used to make smokables."
icon = 'icons/obj/cigs_lighters.dmi'
icon_state = "cigpaper_generic"
w_class = 1.0
w_class = ITEMSIZE_TINY
/obj/item/paper/cig/attackby(obj/item/P as obj, mob/user as mob)
if(istype(P, /obj/item/flame) || P.iswelder())
@@ -821,7 +823,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM
name = "cigarette filter"
desc = "A small nub like filter for cigarettes."
icon_state = "cigfilter"
w_class = 1.0
w_class = ITEMSIZE_TINY
/obj/item/paper/cig/filter/attackby(obj/item/P as obj, mob/user as mob)
if(istype(P, /obj/item/flame) || P.iswelder())
@@ -840,7 +842,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM
//tobacco sold seperately if you're too snobby to grow it yourself.
/obj/item/reagent_containers/food/snacks/grown/dried_tobacco
plantname = "tobacco"
w_class = 1.0
w_class = ITEMSIZE_TINY
/obj/item/reagent_containers/food/snacks/grown/dried_tobacco/Initialize()
. = ..()