From 92de0d684a6c3e2ac201a5c37452b1520afd301e Mon Sep 17 00:00:00 2001 From: "daelith.rhedynfre" Date: Thu, 13 Jan 2011 19:33:30 +0000 Subject: [PATCH] -Added matches. They are available in boxes from the smokes machine. -Moved the code for how cigarettes work to a more appropriate location (They were in clothing code) git-svn-id: http://tgstation13.googlecode.com/svn/trunk@848 316c924e-a436-60f5-8080-3fe189b3f50e --- code/defines/obj/clothing.dm | 2 +- code/defines/obj/vending.dm | 4 +- code/defines/obj/weapon.dm | 15 ++ code/game/objects/items/clothing.dm | 98 ---------- .../objects/items/weapons/cigs_lighters.dm | 183 +++++++++++++++++- icons/obj/cigarettes.dmi | Bin 804 -> 1449 bytes 6 files changed, 198 insertions(+), 104 deletions(-) diff --git a/code/defines/obj/clothing.dm b/code/defines/obj/clothing.dm index db184ea0537..40abf9adead 100644 --- a/code/defines/obj/clothing.dm +++ b/code/defines/obj/clothing.dm @@ -461,7 +461,7 @@ permeability_coefficient = 0.25 /obj/item/clothing/shoes/sandal - desc = "A pair of rather plain sandals, wooden sandals." + desc = "A pair of rather plain, wooden sandals." name = "sandals" icon_state = "wizard" diff --git a/code/defines/obj/vending.dm b/code/defines/obj/vending.dm index 1baeedbccac..f8524b1da7a 100644 --- a/code/defines/obj/vending.dm +++ b/code/defines/obj/vending.dm @@ -82,8 +82,8 @@ name = "cigarette machine" desc = "If you want to get cancer, might as well do it in style" icon_state = "cigs" - product_paths = "/obj/item/weapon/cigpacket" - product_amounts = "10" + product_paths = "/obj/item/weapon/cigpacket;/obj/item/weapon/matchbox" + product_amounts = "10;2" product_slogans = "Space cigs taste good like a cigarette should.;I'd rather toolbox than switch.;Smoke!;Don't believe the reports - smoke today!" vend_delay = 34 product_hidden = "/obj/item/weapon/zippo" diff --git a/code/defines/obj/weapon.dm b/code/defines/obj/weapon.dm index ffd6f6c4c77..9e28714f2c7 100644 --- a/code/defines/obj/weapon.dm +++ b/code/defines/obj/weapon.dm @@ -19,6 +19,21 @@ g_amt = 7500 m_amt = 1000 +/obj/item/weapon/match + name = "Match" + desc = "A simple match stick, used for lighting tobacco" + icon = 'cigarettes.dmi' + icon_state = "match_unlit" + var/lit = 0 + var/smoketime = 5 + +/obj/item/weapon/matchbox + name = "Matchbox" + desc = "A box of matches" + icon = 'cigarettes.dmi' + icon_state = "matchbox" + var/matchcount = 20 + /obj/item/weapon/rcd name = "rapid-construction-device (RCD)" desc = "A device used to rapidly build walls/floor." diff --git a/code/game/objects/items/clothing.dm b/code/game/objects/items/clothing.dm index b62fbea63e0..1daf2e5c913 100644 --- a/code/game/objects/items/clothing.dm +++ b/code/game/objects/items/clothing.dm @@ -4,7 +4,6 @@ ORANGE SHOES MUZZLE CAKEHAT SUNGLASSES -CIGARETTE SWAT SUIT CHAMELEON JUMPSUIT DEATH COMMANDO GAS MASK @@ -91,103 +90,6 @@ DEATH COMMANDO GAS MASK return -/obj/item/clothing/mask/cigarette/attackby(obj/item/weapon/W as obj, mob/user as mob) - if(istype(W, /obj/item/weapon/weldingtool) && W:welding) - if(src.lit == 0) - src.lit = 1 - src.damtype = "fire" - src.icon_state = "cigon" - src.item_state = "cigon" - for(var/mob/O in viewers(user, null)) - O.show_message(text("\red [] casually lights the cigarette with [], what a badass.", user, W), 1) - spawn() //start fires while it's lit - src.process() - else if(istype(W, /obj/item/weapon/zippo) && W:lit) - if(src.lit == 0) - src.lit = 1 - src.icon_state = "cigon" - src.item_state = "cigon" - for(var/mob/O in viewers(user, null)) - O.show_message(text("\red With a single flick of his wrist, [] smoothly lights his cigarette with his []. Damn they're cool.", user, W), 1) - spawn() //start fires while it's lit - src.process() - - - -/obj/item/clothing/mask/cigarette/process() - - var/atom/lastHolder = null - - while(src.lit == 1) - var/turf/location = src.loc - var/atom/holder = loc - var/isHeld = 0 - var/mob/M = null - src.smoketime-- - - if(istype(location, /mob/)) - M = location - if(M.l_hand == src || M.r_hand == src || M.wear_mask == src) - location = M.loc - if(src.smoketime < 1) - var/obj/item/weapon/cigbutt/C = new /obj/item/weapon/cigbutt - if(M != null) - M << "\red Your cigarette goes out." - C.loc = location - del(src) - return - if (istype(location, /turf)) //start a fire if possible - location.hotspot_expose(700, 5) - if (ismob(holder)) - isHeld = 1 - else - - - - - // note remove luminosity processing until can understand how to make this compatible - // with the fire checks, etc. - - isHeld = 0 - if (lastHolder != null) - //lastHolder.sd_SetLuminosity(0) - lastHolder = null - - if (isHeld == 1) - //if (holder != lastHolder && lastHolder != null) - //lastHolder.sd_SetLuminosity(0) - //holder.sd_SetLuminosity(1) - lastHolder = holder - - //sd_SetLuminosity(1) - sleep(10) - - if (lastHolder != null) - //lastHolder.sd_SetLuminosity(0) - lastHolder = null - - //sd_SetLuminosity(0) - - -/obj/item/clothing/mask/cigarette/dropped(mob/user as mob) - if(src.lit == 1) - for(var/mob/O in viewers(user, null)) - O.show_message(text("\red [] calmly drops and treads on the lit cigarette, putting it out instantly.", user), 1) - src.lit = -1 - src.damtype = "brute" - src.icon_state = "cigbutt" - src.item_state = "cigoff" - src.name = "Cigarette butt" - src.desc = "A cigarette butt." - return ..() - else - for(var/mob/O in viewers(user, null)) - O.show_message(text("\red [] drops the []. Guess they've had enough for the day.", user, src), 1) - return ..() - - - - /obj/item/clothing/under/chameleon/New() ..() diff --git a/code/game/objects/items/weapons/cigs_lighters.dm b/code/game/objects/items/weapons/cigs_lighters.dm index 4a7cd3135c2..39e85ffbd7a 100644 --- a/code/game/objects/items/weapons/cigs_lighters.dm +++ b/code/game/objects/items/weapons/cigs_lighters.dm @@ -1,10 +1,185 @@ /* CONTAINS: +MATCHES +MATCHBOXES +CIGARETTES CIG PACKET ZIPPO - - */ + +/////////// +//MATCHES// +/////////// + +/obj/item/weapon/match/process() + while(src.lit == 1) + src.smoketime-- + sleep(10) + if(src.smoketime < 1) + src.icon_state = "match_burnt" + src.lit = -1 + return + +/obj/item/weapon/match/dropped(mob/user as mob) + if(src.lit == 1) + src.lit = -1 + src.damtype = "brute" + src.icon_state = "match_burnt" + src.item_state = "cigoff" + src.name = "Burnt match" + src.desc = "A match that has been burnt" + return ..() + +////////////// +//MATCHBOXES// +////////////// +/obj/item/weapon/matchbox/attack_hand(mob/user as mob) + if(user.r_hand == src || user.l_hand == src) + if(src.matchcount <= 0) + user << "\red You're out of matches. Shouldn't have wasted so many..." + return + else + src.matchcount-- + var/obj/item/weapon/match/W = new /obj/item/weapon/match(user) + if(user.hand) + user.l_hand = W + else + user.r_hand = W + W.layer = 20 + else + return ..() + if(src.matchcount <= 0) + src.icon_state = "matchbox_e" + else if(src.matchcount <= 5) + src.icon_state = "matchbox_1q" + else if(src.matchcount <= 10) + src.icon_state = "matchbox_h" + else if(src.matchcount <= 15) + src.icon_state = "matchbox_3q" + else + src.icon_state = "matchbox" + src.update_icon() + return + +obj/item/weapon/matchbox.attackby(obj/item/weapon/match/W as obj, mob/user as mob) + if(istype(W, /obj/item/weapon/match) && W.lit == 0) + W.lit = 1 + W.icon_state = "match_lit" + W.process() + W.update_icon() + return + + +////////////// +//CIGARETTES// +////////////// +/obj/item/clothing/mask/cigarette/attackby(obj/item/weapon/W as obj, mob/user as mob) + if(istype(W, /obj/item/weapon/weldingtool) && W:welding) + if(src.lit == 0) + src.lit = 1 + src.damtype = "fire" + src.icon_state = "cigon" + src.item_state = "cigon" + for(var/mob/O in viewers(user, null)) + O.show_message(text("\red [] casually lights the cigarette with [], what a badass.", user, W), 1) + spawn() //start fires while it's lit + src.process() + else if(istype(W, /obj/item/weapon/zippo) && W:lit) + if(src.lit == 0) + src.lit = 1 + src.icon_state = "cigon" + src.item_state = "cigon" + for(var/mob/O in viewers(user, null)) + O.show_message(text("\red With a single flick of his wrist, [] smoothly lights his cigarette with his []. Damn they're cool.", user, W), 1) + spawn() //start fires while it's lit + src.process() + else if(istype(W, /obj/item/weapon/match) && W:lit) + if(src.lit == 0) + src.lit = 1 + src.icon_state = "cigon" + src.item_state = "cigon" + for(var/mob/O in viewers(user, null)) + O.show_message(text("\red With a single flick of his wrist, [] smoothly lights his cigarette with his []. Damn they're cool.", user, W), 1) + spawn() //start fires while it's lit + src.process() + + + +/obj/item/clothing/mask/cigarette/process() + + var/atom/lastHolder = null + + while(src.lit == 1) + var/turf/location = src.loc + var/atom/holder = loc + var/isHeld = 0 + var/mob/M = null + src.smoketime-- + + if(istype(location, /mob/)) + M = location + if(M.l_hand == src || M.r_hand == src || M.wear_mask == src) + location = M.loc + if(src.smoketime < 1) + var/obj/item/weapon/cigbutt/C = new /obj/item/weapon/cigbutt + if(M != null) + M << "\red Your cigarette goes out." + C.loc = location + del(src) + return + if (istype(location, /turf)) //start a fire if possible + location.hotspot_expose(700, 5) + if (ismob(holder)) + isHeld = 1 + else + + + + + // note remove luminosity processing until can understand how to make this compatible + // with the fire checks, etc. + + isHeld = 0 + if (lastHolder != null) + //lastHolder.sd_SetLuminosity(0) + lastHolder = null + + if (isHeld == 1) + //if (holder != lastHolder && lastHolder != null) + //lastHolder.sd_SetLuminosity(0) + //holder.sd_SetLuminosity(1) + lastHolder = holder + + //sd_SetLuminosity(1) + sleep(10) + + if (lastHolder != null) + //lastHolder.sd_SetLuminosity(0) + lastHolder = null + + //sd_SetLuminosity(0) + + +/obj/item/clothing/mask/cigarette/dropped(mob/user as mob) + if(src.lit == 1) + for(var/mob/O in viewers(user, null)) + O.show_message(text("\red [] calmly drops and treads on the lit cigarette, putting it out instantly.", user), 1) + src.lit = -1 + src.damtype = "brute" + src.icon_state = "cigbutt" + src.item_state = "cigoff" + src.name = "Cigarette butt" + src.desc = "A cigarette butt." + return ..() + else + for(var/mob/O in viewers(user, null)) + O.show_message(text("\red [] drops the []. Guess they've had enough for the day.", user, src), 1) + return ..() + +//////////// +//CIG PACK// +//////////// + /obj/item/weapon/cigpacket/update_icon() src.icon_state = text("cigpacket[]", src.cigcount) src.desc = text("There are [] cigs\s left!", src.cigcount) @@ -28,7 +203,9 @@ ZIPPO src.update_icon() return - +///////// +//ZIPPO// +///////// #define ZIPPO_LUM 2 /obj/item/weapon/zippo/attack_self(mob/user) diff --git a/icons/obj/cigarettes.dmi b/icons/obj/cigarettes.dmi index c04c516e29d0bcf46df070558e3db71c0372abc3..bdc762803b9ab3906cb43445d5f14307e9547336 100644 GIT binary patch delta 1386 zcmV-w1(o`w2B`}riBL{Q4GJ0x0000DNk~Le0002M0001>2m=5B0B!b@ZvX%Q^N}S| zf0>z?xVX52f`V3@bV=-0C=30 z)6EWoFbn|T^Y#=AT#eyR4IygY+;D5<3CP0gp|sCWZo zJeNM626!6cX@sXMJYD0dhoKl#OUvFjrV2HGzRQcrne-Qf{{3(b*QLm`GG-TmVB|NqX~RCEGgK0+E>pPg5W`W%v;lSa@} zApigXfcYp%imP*!%92V^bs-+4P;zi72wr2YHK{SCnO??s30--{00zvoFX$8*^J-8zBUaJGN9N?`sJwtp`= zZ2xXbU~T3Uwx92bUaM82->K943mcoyXNiFjTU!b}W_z2~;jxO}|;WzyB}93Gy}o0000000000006)Yc6ZhN``(^f=f-pWzUuzKn0=L= z8le04Gytu0j|@LpU4`kB+3l+4{?bsQ?EDuapjBIr9XeBi*^t zz#Syt#4GJe|HmV_!km8F-^qz80jCQwI$p@X^fi$F61URdf9a{*BAlLafY+zm{+)P9 zlLz@tB!5W!jYe{hbNZA+ZVRb(aTMtWn8o1@oIW|g* zpgy0eJ{@4%-`PI~S$&f83-$R-_2~f073TFxK7LZ4&s4wS>?VL}h3C*G`TRwFW>a1A zHRd{i;+J$De|?f~-__?f)usLPu*2|&UEQX4$5>&+GK}R{S&lyQyy9|E&J~>ilFsKfit_ z{jV{k(2}pM3zseqOh~JkLIWVLz|i-)A4du%FlM@3RkJ s*w5?s_t^(9?B{j+djJ3c0DuDV7yBrJ+K@Mb1poj507*qoM6N<$g0VBP(f|Me delta 721 zcmV;?0xtcj3#0}miBL{Q4GJ0x0000DNk~Le0006&0000W2m=5B0L?EqcK`qYfsrLr zNOyL2nVFfmxVVCXf>xY$%*)H%+uNUPL&=R@pJ_hSC;-$(0MvK@)TIFb=~GlhL{*q` z{>gU!00001bW%=J06^y0W&i*Hp_4HI6Ms`yaB_9`^iy#0_2eo`Eh^5;&r`5fFwryM z;w;ZhDainGjE%TBGg33tGfE(w;*!LYR3K9+IWxT=F*!T6M2U+tC9|j)C}zmTnO2mT zn+joLsx%~CsS)u?jfq!kLcCH_;+2{auhf7TrNpSo$;1)v7C_O|oWx3yunr1D(SM&* zT7om;loee4T)=4p0A9+N_v5Q38vp2sg#VAVIya28evZ-5}(8!1a*pA=85pJ5XOP^YcJ;FM4c| z3*<#hu18#7ay{bu5(CtiSj|sN4p8#cO46}*uqIk`eU;Y06W88<+cRLBJydhcxNJ4jcTBaG~CwKCpb&8jSO=x?g^@4wl; z{}h|)+3gIyvES3Z9lpcCeEsog?x$0?>$&$g-T#*})2FPKRUz^Z`me2efVP`0(e(h) zT`vIL^#ame4*=cu09}7Q_g4Pg{kP6cpR!t(MJ^2k#K94E+iIEQvdaK*FksWx3{bZn z2yR<@gbC5-0AY(7w^XDu_3-~fa4met2mk;80Ds{V06{