Updated ashtray code!

This commit is contained in:
ZomgPonies
2013-12-22 06:36:27 -05:00
parent ebc01b39aa
commit 5661d24dc7
2 changed files with 45 additions and 39 deletions
+24 -27
View File
@@ -17,35 +17,34 @@
/obj/item/ashtray/attackby(obj/item/weapon/W as obj, mob/user as mob)
if (health < 1)
return
if (istype(W,/obj/item/clothing/mask/cigarette) || istype(W, /obj/item/weapon/match))
if(user)
if (contents.len >= max_butts)
user << "This ashtray is full."
return
user.u_equip(W)
W.loc = src
if ((user.client && user.s_active != src))
user.client.screen -= W
if (istype(W,/obj/item/weapon/cigbutt) || istype(W,/obj/item/clothing/mask/cigarette) || istype(W, /obj/item/weapon/match))
if (contents.len >= max_butts)
user << "This ashtray is full."
return
user.u_equip(W)
W.loc = src
if (istype(W,/obj/item/clothing/mask/cigarette))
var/obj/item/clothing/mask/cigarette/cig = W
if (cig.lit == 1)
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)
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?"
else if (cig.lit == -1)
src.visible_message("[user] places [cig] in [src].")
user.update_inv_l_hand()
user.update_inv_r_hand()
add_fingerprint(user)
if (contents.len == max_butts)
icon_state = icon_full
desc = empty_desc + " It's stuffed full."
else if (contents.len > max_butts/2)
icon_state = icon_half
desc = empty_desc + " It's half-filled."
user << "You place [cig] in [src] without even smoking it. Why would you do that?"
src.visible_message("[user] places [W] in [src].")
user.update_inv_l_hand()
user.update_inv_r_hand()
add_fingerprint(user)
if (contents.len == max_butts)
icon_state = icon_full
desc = empty_desc + " It's stuffed full."
else if (contents.len > max_butts/2)
icon_state = icon_half
desc = empty_desc + " It's half-filled."
else
health = max(0,health - W.force)
user << "You hit [src] with [W]."
@@ -62,7 +61,6 @@
if (contents.len)
src.visible_message("\red [src] slams into [hit_atom] spilling its contents!")
for (var/obj/item/clothing/mask/cigarette/O in contents)
contents -= O
O.loc = src.loc
icon_state = icon_empty
return ..()
@@ -70,7 +68,6 @@
/obj/item/ashtray/proc/die()
src.visible_message("\red [src] shatters spilling its contents!")
for (var/obj/item/clothing/mask/cigarette/O in contents)
contents -= O
O.loc = src.loc
icon_state = icon_broken