Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 50 additions & 46 deletions code/game/objects/items/ashtray.dm
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/obj/item/ashtray
icon = 'icons/ashtray.dmi'
name = "ashtray"
inhand_states = list("left_hand" = 'icons/mob/in-hand/left/cigs_lighters.dmi', "right_hand" = 'icons/mob/in-hand/right/cigs_lighters.dmi')
icon = 'icons/ashtray.dmi'
icon_state = "ashtray_bl"
item_state = "ashtray"
w_class = W_CLASS_TINY

var/max_butts = 0
var/empty_desc = ""
var/icon_empty = ""
var/icon_half = ""
var/icon_full = ""
var/icon_broken = ""
var/trash_type = /obj/item/trash/broken_ashtray
var/max_butts = 0
var/impact_sound = 'sound/effects/pop.ogg'
var/ash_suffix = "bl"

/obj/item/ashtray/New()
..()
Expand All @@ -25,7 +25,7 @@
if (contents.len >= max_butts)
to_chat(user, "<span class='warning'>This ashtray is full.</span>")
return
if (istype(W,/obj/item/clothing/mask/cigarette/pipe) && (user.a_intent != I_HURT)) // angry spessmen can still crush their pipe inside the ashtray if they really want
if (istype(W,/obj/item/clothing/mask/cigarette/pipe) && (user.a_intent != I_HURT)) // angry spessmen can still crush their pipe inside the ashtray if they really want to
var/obj/item/clothing/mask/cigarette/pipe/P = W
P.lit = 0
P.smoketime = 0
Expand All @@ -46,19 +46,39 @@
else if (cig.lit == -1)
visible_message("<span class='notice'>[user] places [cig] in [src].</span>")
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."
update_icon()
return
health = max(0,health - W.force)
playsound(src, impact_sound, 30, TRUE)
to_chat(user, "<span class='danger'>You hit [src] with [W].</span>")
if (health < 1)
die()

/obj/item/ashtray/update_icon()
if (contents.len >= max_butts)
icon_state = "ashtray_full_[ash_suffix]"
else if (contents.len > max_butts/2)
icon_state = "ashtray_half_[ash_suffix]"
else if (contents.len > 0)
icon_state = "ashtray_one_[ash_suffix]"
else
icon_state = "ashtray_[ash_suffix]"

/obj/item/ashtray/examine(var/mob/user)
..()
if (contents.len >= max_butts)
to_chat(user, "<span class='info'>It's stuffed full.</span>")
else if (contents.len > max_butts/2)
to_chat(user, "<span class='info'>It's half-filled.</span>")
else if (contents.len == 1)
to_chat(user, "<span class='info'>There's a [pick(contents)] in there.</span>")
else if (contents.len > 0)
to_chat(user, "<span class='info'>There's a couple cigarettes in there.</span>")
else
to_chat(user, "<span class='info'>It's empty.</span>")

/obj/item/ashtray/throw_impact(atom/hit_atom)
playsound(src, impact_sound, 30, TRUE)
if (health > 0)
health = max(0,health - 3)
if (health < 1)
Expand All @@ -68,75 +88,59 @@
visible_message("<span class='warning'>[src] slams into [hit_atom] spilling its contents!</span>")
for (var/obj/item/O in contents)
O.forceMove(loc)
icon_state = icon_empty
update_icon()
return ..()

/obj/item/ashtray/proc/die()
var/turf/T = get_turf(src)
visible_message("<span class='warning'>[src] shatters spilling its contents!</span>")
for (var/obj/item/O in contents)
O.forceMove(loc)
icon_state = icon_broken
O.forceMove(T)
new trash_type(T)
qdel(src)

/obj/item/ashtray/plastic
name = "plastic ashtray"
desc = "Cheap plastic ashtray."
icon_state = "ashtray_bl"
icon_empty = "ashtray_bl"
icon_half = "ashtray_half_bl"
icon_full = "ashtray_full_bl"
icon_broken = "ashtray_bork_bl"
item_state = "ashtray"
ash_suffix = "bl"
max_butts = 14
health = 24
starting_materials = list(MAT_PLASTIC = 50)
w_type = RECYK_PLASTIC
empty_desc = "Cheap plastic ashtray."
throwforce = 3
flammable = TRUE

/obj/item/ashtray/plastic/die()
..()
name = "pieces of plastic"
desc = "Pieces of plastic with ash on them."
trash_type = /obj/item/trash/broken_ashtray
impact_sound = 'sound/effects/pop.ogg'

/obj/item/ashtray/bronze
name = "bronze ashtray"
desc = "A large ashtray made of bronze."
icon_state = "ashtray_br"
icon_empty = "ashtray_br"
icon_half = "ashtray_half_br"
icon_full = "ashtray_full_br"
icon_broken = "ashtray_bork_br"
item_state = "ashtray_br"
ash_suffix = "br"
max_butts = 10
health = 72
starting_materials = list(MAT_IRON = 80)
w_type = RECYK_METAL
empty_desc = "A large ashtray made of bronze."
throwforce = 10

/obj/item/ashtray/bronze/die()
..()
name = "pieces of bronze"
desc = "Pieces of bronze with ash on them."

trash_type = /obj/item/trash/broken_ashtray/bronze
impact_sound = 'sound/items/Crowbar.ogg'

/obj/item/ashtray/glass
name = "glass ashtray"
desc = "An ashtray made of glass."
icon_state = "ashtray_gl"
icon_empty = "ashtray_gl"
icon_half = "ashtray_half_gl"
icon_full = "ashtray_full_gl"
icon_broken = "ashtray_bork_gl"
item_state = "ashtray_gl"
ash_suffix = "gl"
max_butts = 12
health = 12
starting_materials = list(MAT_GLASS = 60)
empty_desc = "Glass ashtray. Looks fragile."
throwforce = 6
trash_type = /obj/item/trash/broken_ashtray/glass
impact_sound = 'sound/effects/Glasshit.ogg'

/obj/item/ashtray/glass/die()
playsound(src, 'sound/effects/hit_on_shattered_glass.ogg', 30, TRUE)
..()
name = "shards of glass"
desc = "Shards of glass with ash on them."
playsound(src, "shatter", 30, TRUE)
21 changes: 20 additions & 1 deletion code/game/objects/items/trash.dm
Original file line number Diff line number Diff line change
Expand Up @@ -450,4 +450,23 @@ var/list/crushed_cans_cache = list()
desc = "What a shame it's too small to fly in."
icon_state = "emptysaucerbowl"
starting_materials = list(MAT_IRON = 100)
w_type=RECYK_METAL
w_type = RECYK_METAL

/obj/item/trash/broken_ashtray
name = "broken ashtray"
desc = "Pieces of plastic with ash on them."
icon_state = "ashtray_bork_bl"
starting_materials = list(MAT_PLASTIC = 50)
w_type = RECYK_PLASTIC

/obj/item/trash/broken_ashtray/bronze
desc = "Pieces of bronze with ash on them."
icon_state = "ashtray_bork_br"
starting_materials = list(MAT_IRON = 80)
w_type = RECYK_METAL

/obj/item/trash/broken_ashtray/glass
desc = "Shards of glass with ash on them."
icon_state = "ashtray_bork_gl"
starting_materials = list(MAT_GLASS = 60)
w_type = RECYK_GLASS
15 changes: 14 additions & 1 deletion code/modules/recycling/disposal.dm
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
if(isrobot(user) && !istype(I, /obj/item/weapon/storage/bag/trash) && !isgripper(user.get_active_hand()) && !isMoMMI(user) )
return

if(istype(I, /obj/item/weapon/storage/bag/))
if(istype(I, /obj/item/weapon/storage/bag))
var/obj/item/weapon/storage/bag/B = I
if(B.contents.len == 0)
if(user.drop_item(I, src))
Expand All @@ -161,6 +161,19 @@
update_icon()
return

if(istype(I, /obj/item/ashtray))
var/obj/item/ashtray/A = I
if(A.contents.len == 0)
if(user.drop_item(I, src))
to_chat(user, "<span class='notice'>You throw away \the empty [A].</span>")
return
to_chat(user, "<span class='notice'>You empty \the [A].</span>")
for (var/obj/item/O in A.contents)
O.forceMove(src)
A.update_icon()
update_icon()
return

var/obj/item/weapon/grab/G = I
if(istype(G)) // handle grabbed mob
if(ismob(G.affecting))
Expand Down
Binary file modified icons/ashtray.dmi
Binary file not shown.
Binary file modified icons/obj/trash.dmi
Binary file not shown.
Loading