From a85e170ce4c56da4eadd2a0e851555271b26467e Mon Sep 17 00:00:00 2001 From: Anewbe Date: Fri, 24 Feb 2017 17:15:38 -0600 Subject: [PATCH] Minor smoking update --- .../objects/items/weapons/cigs_lighters.dm | 93 +++++++++++-------- html/changelogs/Anewbe - Smoking.yml | 36 +++++++ 2 files changed, 90 insertions(+), 39 deletions(-) create mode 100644 html/changelogs/Anewbe - Smoking.yml diff --git a/code/game/objects/items/weapons/cigs_lighters.dm b/code/game/objects/items/weapons/cigs_lighters.dm index 62f4925c9a..3f83451951 100644 --- a/code/game/objects/items/weapons/cigs_lighters.dm +++ b/code/game/objects/items/weapons/cigs_lighters.dm @@ -85,10 +85,10 @@ CIGARETTE PACKETS ARE IN FANCY.DM body_parts_covered = 0 var/lit = 0 var/icon_on - var/icon_off var/type_butt = null var/chem_volume = 0 var/smoketime = 0 + var/is_pipe = 0 //Prevents a runtime with pipes var/matchmes = "USER lights NAME with FLAME" var/lightermes = "USER lights NAME with FLAME" var/zippomes = "USER lights NAME with FLAME" @@ -106,6 +106,9 @@ CIGARETTE PACKETS ARE IN FANCY.DM smoketime-- if(smoketime < 1) die() + if(ishuman(loc)) + var/mob/living/carbon/human/C = loc + to_chat(C, "Your [name] goes out.") return if(location) location.hotspot_expose(700, 5) @@ -119,19 +122,20 @@ CIGARETTE PACKETS ARE IN FANCY.DM /obj/item/clothing/mask/smokable/examine(mob/user) ..() - if(lit == 1) - var/smoke_percent = round((smoketime / initial(smoketime)) * 100) - switch(smoke_percent) - if(90 to INFINITY) - user << "[src] has just begun to burn." - if(60 to 90) - user << "[src] has a good amount of burn time remaining." - if(30 to 60) - user << "[src] is about half finished." - if(10 to 30) - user << "[src] is starting to burn low." - else - user << "[src] is nearly burnt out!" + if(is_pipe) + return + var/smoke_percent = round((smoketime / initial(smoketime)) * 100) + switch(smoke_percent) + if(90 to INFINITY) + user << "[src] is still fresh." + if(60 to 90) + user << "[src] has a good amount of burn time remaining." + if(30 to 60) + user << "[src] is about half finished." + if(10 to 30) + user << "[src] is starting to burn low." + else + user << "[src] is nearly burnt out!" /obj/item/clothing/mask/smokable/proc/light(var/flavor_text = "[usr] lights the [name].") @@ -167,6 +171,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM /obj/item/clothing/mask/smokable/proc/die(var/nomessage = 0) var/turf/T = get_turf(src) set_light(0) + processing_objects.Remove(src) if (type_butt) var/obj/item/butt = new type_butt(T) transfer_fingerprints_to(butt) @@ -175,12 +180,11 @@ CIGARETTE PACKETS ARE IN FANCY.DM if(ismob(loc)) var/mob/living/M = loc if (!nomessage) - M << "Your [name] goes out." + to_chat(M, "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) - processing_objects.Remove(src) qdel(src) else new /obj/effect/decal/cleanable/ash(T) @@ -189,12 +193,26 @@ CIGARETTE PACKETS ARE IN FANCY.DM if (!nomessage) M << "Your [name] goes out, and you empty the ash." lit = 0 - icon_state = icon_off - item_state = icon_off + icon_state = initial(icon_state) + item_state = initial(item_state) M.update_inv_wear_mask(0) M.update_inv_l_hand(0) M.update_inv_r_hand(1) - processing_objects.Remove(src) + smoketime = 0 + reagents.clear_reagents() + name = "empty [initial(name)]" + +/obj/item/clothing/mask/smokable/proc/quench() + lit = 0 + processing_objects.Remove(src) + icon_state = initial(icon_state) + item_state = initial(item_state) + + if(ismob(loc)) + var/mob/living/M = loc + M.update_inv_wear_mask(0) + M.update_inv_l_hand(0) + M.update_inv_r_hand(1) /obj/item/clothing/mask/smokable/attackby(obj/item/weapon/W as obj, mob/user as mob) ..() @@ -223,6 +241,10 @@ CIGARETTE PACKETS ARE IN FANCY.DM else return ..() +/obj/item/clothing/mask/smokable/water_act(amount) + if(amount >= 5) + quench() + /obj/item/clothing/mask/smokable/cigarette name = "cigarette" desc = "A roll of tobacco and nicotine." @@ -233,7 +255,6 @@ CIGARETTE PACKETS ARE IN FANCY.DM slot_flags = SLOT_EARS | SLOT_MASK attack_verb = list("burnt", "singed") icon_on = "cigon" //Note - these are in masks.dmi not in cigarette.dmi - icon_off = "cigoff" type_butt = /obj/item/weapon/cigbutt chem_volume = 15 smoketime = 300 @@ -269,8 +290,12 @@ CIGARETTE PACKETS ARE IN FANCY.DM /obj/item/clothing/mask/smokable/cigarette/attack_self(mob/user as mob) if(lit == 1) - user.visible_message("[user] calmly drops and treads on the lit [src], putting it out instantly.") - die(1) + if(user.a_intent == I_HURT) + user.visible_message("[user] drops and treads on the lit [src], putting it out instantly.") + die(1) + else + user.visible_message("[user] puts out \the [src].") + quench() return ..() //////////// @@ -281,7 +306,6 @@ CIGARETTE PACKETS ARE IN FANCY.DM desc = "A brown roll of tobacco and... well, you're not quite sure. This thing's huge!" icon_state = "cigar2off" icon_on = "cigar2on" - icon_off = "cigar2off" type_butt = /obj/item/weapon/cigbutt/cigarbutt throw_speed = 0.5 item_state = "cigaroff" @@ -298,14 +322,12 @@ CIGARETTE PACKETS ARE IN FANCY.DM desc = "There's little more you could want from a cigar." icon_state = "cigar2off" icon_on = "cigar2on" - icon_off = "cigar2off" /obj/item/clothing/mask/smokable/cigarette/cigar/havana name = "premium Havanian cigar" desc = "A cigar fit for only the best of the best." icon_state = "cigar2off" icon_on = "cigar2on" - icon_off = "cigar2off" smoketime = 7200 chem_volume = 30 @@ -345,7 +367,6 @@ CIGARETTE PACKETS ARE IN FANCY.DM icon_state = "pipeoff" item_state = "pipeoff" icon_on = "pipeon" //Note - these are in masks.dmi - icon_off = "pipeoff" smoketime = 0 chem_volume = 50 matchmes = "USER lights their NAME with their FLAME." @@ -353,6 +374,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM zippomes = "With much care, USER lights their NAME with their FLAME." weldermes = "USER recklessly lights NAME with FLAME." ignitermes = "USER fiddles with FLAME, and manages to light their NAME with the power of science." + is_pipe = 1 /obj/item/clothing/mask/smokable/pipe/New() ..() @@ -375,18 +397,12 @@ CIGARETTE PACKETS ARE IN FANCY.DM /obj/item/clothing/mask/smokable/pipe/attack_self(mob/user as mob) if(lit == 1) - user.visible_message("[user] puts out [src].", "You put out [src].") - lit = 0 - icon_state = icon_off - item_state = icon_off - processing_objects.Remove(src) - else if (smoketime) - var/turf/location = get_turf(user) - user.visible_message("[user] empties out [src].", "You empty out [src].") - new /obj/effect/decal/cleanable/ash(location) - smoketime = 0 - reagents.clear_reagents() - name = "empty [initial(name)]" + if(user.a_intent == I_HURT) + user.visible_message("[user] empties the lit [src] on the floor!.") + die(1) + else + user.visible_message("[user] puts out \the [src].") + quench() /obj/item/clothing/mask/smokable/pipe/attackby(obj/item/weapon/W as obj, mob/user as mob) if(istype(W, /obj/item/weapon/melee/energy/sword)) @@ -431,7 +447,6 @@ CIGARETTE PACKETS ARE IN FANCY.DM icon_state = "cobpipeoff" item_state = "cobpipeoff" icon_on = "cobpipeon" //Note - these are in masks.dmi - icon_off = "cobpipeoff" chem_volume = 35 ///////// diff --git a/html/changelogs/Anewbe - Smoking.yml b/html/changelogs/Anewbe - Smoking.yml new file mode 100644 index 0000000000..92a73198fe --- /dev/null +++ b/html/changelogs/Anewbe - Smoking.yml @@ -0,0 +1,36 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +################################# + +# Your name. +author: Anewbe + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - tweak: "Extinguishing a smokable on non-Harm intents no longer destroys it."