This commit is contained in:
DeityLink
2019-07-02 22:54:24 +02:00
parent 350be17e12
commit efcb37613d
4 changed files with 46 additions and 22 deletions

View File

@@ -193,4 +193,40 @@
icon_state = "byond"
starting_materials = list(MAT_CARDBOARD = 370)
autoignition_temperature = 522
w_type=RECYK_MISC
w_type=RECYK_MISC
var/list/crushed_cans_cache = list()
/obj/item/trash/soda_cans
name = "crushed soda can"
inhand_states = list("left_hand" = 'icons/mob/in-hand/left/drinkingglass.dmi', "right_hand" = 'icons/mob/in-hand/right/drinkingglass.dmi')
icon = 'icons/obj/drinks.dmi'
icon_state = "crushed_can"
starting_materials = list(MAT_IRON = 50)
w_type=RECYK_METAL
force = 0
throwforce = 2
throw_range = 8
throw_speed = 3
/obj/item/trash/New(var/loc, var/age, var/icon_state, var/color, var/dir, var/pixel_x, var/pixel_y)
..()
if(icon_state)
if (!(icon_state in crushed_cans_cache))
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('icons/obj/drinks.dmi',icon_state)
I.Blend(K,ICON_MULTIPLY)
I.Blend(J,ICON_OVERLAY)
crushed_cans_cache[icon_state] = I
icon = icon(crushed_cans_cache[icon_state])
item_state = icon_state
/obj/item/trash/soda_cans/atom2mapsave()
color = name//a bit hacky but hey
. = ..()
/obj/item/trash/soda_cans/post_mapsave2atom(var/list/L)
name = color
color = null

View File

@@ -25,6 +25,7 @@
/obj/item/weapon/reagent_containers/food/snacks/grown/ricestalk = list(RICE,5),
/obj/item/weapon/reagent_containers/food/snacks/grown/cherries = list(CHERRYJELLY,1),
/obj/item/weapon/reagent_containers/food/drinks/soda_cans = list(ALUMINUM,10),
/obj/item/trash/soda_cans = list(ALUMINUM,10),
/obj/item/seeds = list(BLACKPEPPER,5),
/obj/item/device/flashlight/flare = list(SULFUR,10),
/obj/item/stack/cable_coil = list(COPPER, 10),

View File

@@ -613,13 +613,10 @@
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(var/mob/user)
@@ -632,29 +629,19 @@ var/list/crushed_cans = list()
return
if (reagents.total_volume > 0)
return ..()
else if (user.a_intent == I_HURT && !crushed)
crushed = TRUE
throwforce++
throw_range++
throw_speed++
flags &= ~OPENCONTAINER
qdel(reagents)
reagents = null
else if (user.a_intent == I_HURT)
var/turf/T = get_turf(user)
user.drop_item(src, T, 1)
var/obj/item/trash/soda_cans/crushed_can = new (T, icon_state = icon_state)
crushed_can.name = "crushed [name]"
crushed_can.attack_hand(user)
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])
qdel(src)
/obj/item/weapon/reagent_containers/food/drinks/soda_cans/attackby(obj/item/weapon/W, mob/user)
..()
if(!crushed && iswirecutter(W))
if(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)