can crusher

This commit is contained in:
DeityLink
2019-06-30 21:43:25 +02:00
parent 2b779fcb19
commit f9ab48c55c
3 changed files with 20 additions and 3 deletions

View File

@@ -613,13 +613,16 @@
src.pixel_x = rand(-10, 10) * PIXEL_MULTIPLIER
src.pixel_y = rand(-10, 10) * PIXEL_MULTIPLIER
var/list/crushed_cans = list()
/obj/item/weapon/reagent_containers/food/drinks/soda_cans
vending_cat = "carbonated drinks"
flags = FPRINT //Starts sealed until you pull the tab! Lacks OPENCONTAINER for this purpose
//because playsound(user, 'sound/effects/can_open[rand(1,3)].ogg', 50, 1) just wouldn't work. also so badmins can varedit these
var/crushed = FALSE
var/list/open_sounds = list('sound/effects/can_open1.ogg', 'sound/effects/can_open2.ogg', 'sound/effects/can_open3.ogg')
/obj/item/weapon/reagent_containers/food/drinks/soda_cans/attack_self(mob/user as mob)
/obj/item/weapon/reagent_containers/food/drinks/soda_cans/attack_self(var/mob/user)
if(!is_open_container())
to_chat(user, "You pull back the tab of \the [src] with a satisfying pop.")
flags |= OPENCONTAINER
@@ -627,11 +630,25 @@
playsound(user, pick(open_sounds), 50, 1)
overlays += image(icon = icon, icon_state = "soda_open")
return
return ..()
if (reagents.total_volume > 0)
return ..()
else if (user.a_intent == I_HURT && !crushed)
crushed = TRUE
playsound(user, 'sound/items/can_crushed.ogg', 75, 1)
overlays.len = 0
if (!(icon_state in crushed_cans))
var/icon/I = icon('icons/obj/drinks.dmi',"crushed_can")
var/icon/J = icon('icons/obj/drinks.dmi',"crushed_can-overlay")
var/icon/K = icon(icon,icon_state)
I.Blend(K,ICON_MULTIPLY)
I.Blend(J,ICON_OVERLAY)
crushed_cans[icon_state] = I
icon = icon(crushed_cans[icon_state])
/obj/item/weapon/reagent_containers/food/drinks/soda_cans/attackby(obj/item/weapon/W, mob/user)
..()
if(iswirecutter(W))
if(!crushed && iswirecutter(W))
to_chat(user, "You cut out the top and bottom of \the [src] with \the [W].")
playsound(user, 'sound/items/Wirecutter.ogg', 50, 1)
if(src.loc == user)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

After

Width:  |  Height:  |  Size: 91 KiB

BIN
sound/items/can_crushed.ogg Normal file

Binary file not shown.