Revisiting my first commits.

Updated ashtray to actually accept cig butts and crush lit cigs properly.
Applied random transform to cig butts, and made fingerprints from original cig carry over.
This commit is contained in:
Chinsky
2013-12-18 12:02:20 +04:00
parent 0074452f29
commit 65fa11d496
2 changed files with 43 additions and 39 deletions

View File

@@ -17,26 +17,25 @@
/obj/item/ashtray/attackby(obj/item/weapon/W as obj, mob/user as mob) /obj/item/ashtray/attackby(obj/item/weapon/W as obj, mob/user as mob)
if (health < 1) if (health < 1)
return return
if (istype(W,/obj/item/clothing/mask/cigarette) || istype(W, /obj/item/weapon/match)) if (istype(W,/obj/item/weapon/cigbutt) || istype(W,/obj/item/clothing/mask/cigarette) || istype(W, /obj/item/weapon/match))
if(user)
if (contents.len >= max_butts) if (contents.len >= max_butts)
user << "This ashtray is full." user << "This ashtray is full."
return return
user.u_equip(W) user.u_equip(W)
W.loc = src W.loc = src
if ((user.client && user.s_active != src))
user.client.screen -= W if (istype(W,/obj/item/clothing/mask/cigarette))
var/obj/item/clothing/mask/cigarette/cig = W var/obj/item/clothing/mask/cigarette/cig = W
if (cig.lit == 1) if (cig.lit == 1)
src.visible_message("[user] crushes [cig] in [src], putting it out.") src.visible_message("[user] crushes [cig] in [src], putting it out.")
cig.smoketime = 0 processing_objects.Remove(cig)
var/obj/item/butt = new cig.type_butt(src)
cig.transfer_fingerprints_to(butt)
del(cig)
else if (cig.lit == 0) else if (cig.lit == 0)
if(istype(cig, /obj/item/weapon/match))
user << "You place [cig] in [src] without even lighting it. Why would you do that?"
else
user << "You place [cig] in [src] without even smoking it. Why would you do that?" user << "You place [cig] in [src] without even smoking it. Why would you do that?"
else if (cig.lit == -1)
src.visible_message("[user] places [cig] in [src].") src.visible_message("[user] places [W] in [src].")
user.update_inv_l_hand() user.update_inv_l_hand()
user.update_inv_r_hand() user.update_inv_r_hand()
add_fingerprint(user) add_fingerprint(user)
@@ -62,7 +61,6 @@
if (contents.len) if (contents.len)
src.visible_message("\red [src] slams into [hit_atom] spilling its contents!") src.visible_message("\red [src] slams into [hit_atom] spilling its contents!")
for (var/obj/item/clothing/mask/cigarette/O in contents) for (var/obj/item/clothing/mask/cigarette/O in contents)
contents -= O
O.loc = src.loc O.loc = src.loc
icon_state = icon_empty icon_state = icon_empty
return ..() return ..()
@@ -70,7 +68,6 @@
/obj/item/ashtray/proc/die() /obj/item/ashtray/proc/die()
src.visible_message("\red [src] shatters spilling its contents!") src.visible_message("\red [src] shatters spilling its contents!")
for (var/obj/item/clothing/mask/cigarette/O in contents) for (var/obj/item/clothing/mask/cigarette/O in contents)
contents -= O
O.loc = src.loc O.loc = src.loc
icon_state = icon_broken icon_state = icon_broken

View File

@@ -157,14 +157,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM
var/turf/location = get_turf(src) var/turf/location = get_turf(src)
smoketime-- smoketime--
if(smoketime < 1) if(smoketime < 1)
new type_butt(location) die()
processing_objects.Remove(src)
if(ismob(loc))
var/mob/living/M = loc
M << "<span class='notice'>Your [name] goes out.</span>"
M.u_equip(src) //un-equip it so the overlays can update
M.update_inv_wear_mask(0)
del(src)
return return
if(location) if(location)
location.hotspot_expose(700, 5) location.hotspot_expose(700, 5)
@@ -182,13 +175,21 @@ CIGARETTE PACKETS ARE IN FANCY.DM
/obj/item/clothing/mask/cigarette/attack_self(mob/user as mob) /obj/item/clothing/mask/cigarette/attack_self(mob/user as mob)
if(lit == 1) if(lit == 1)
user.visible_message("<span class='notice'>[user] calmly drops and treads on the lit [src], putting it out instantly.</span>") user.visible_message("<span class='notice'>[user] calmly drops and treads on the lit [src], putting it out instantly.</span>")
var/turf/T = get_turf(src) die()
new type_butt(T)
processing_objects.Remove(src)
del(src)
return ..() return ..()
/obj/item/clothing/mask/cigarette/proc/die()
var/turf/T = get_turf(src)
var/obj/item/butt = new type_butt(T)
transfer_fingerprints_to(butt)
if(ismob(loc))
var/mob/living/M = loc
M << "<span class='notice'>Your [name] goes out.</span>"
M.u_equip(src) //un-equip it so the overlays can update
M.update_inv_wear_mask(0)
processing_objects.Remove(src)
del(src)
//////////// ////////////
// CIGARS // // CIGARS //
@@ -229,6 +230,12 @@ CIGARETTE PACKETS ARE IN FANCY.DM
w_class = 1 w_class = 1
throwforce = 1 throwforce = 1
/obj/item/weapon/cigbutt/New()
..()
pixel_x = rand(-10,10)
pixel_y = rand(-10,10)
transform = turn(transform,rand(0,360))
/obj/item/weapon/cigbutt/cigarbutt /obj/item/weapon/cigbutt/cigarbutt
name = "cigar butt" name = "cigar butt"
desc = "A manky old cigar butt." desc = "A manky old cigar butt."