Merge pull request #13771 from MrJWhit/better-donut-box-sprites

Better donuts boxes
This commit is contained in:
DeltaFire
2020-12-14 05:23:30 +01:00
committed by GitHub
4 changed files with 45 additions and 6 deletions
+37 -6
View File
@@ -17,9 +17,6 @@
/obj/item/storage/fancy
icon = 'icons/obj/food/containers.dmi'
icon_state = "donutbox6"
name = "donut box"
desc = "Mmm. Donuts."
resistance_flags = FLAMMABLE
var/icon_type = "donut"
var/spawn_type = null
@@ -59,18 +56,22 @@
fancy_open = TRUE
update_icon()
#define DONUT_INBOX_SPRITE_WIDTH 3
/*
* Donut Box
*/
/obj/item/storage/fancy/donut_box
icon = 'icons/obj/food/containers.dmi'
icon_state = "donutbox6"
icon_type = "donut"
name = "donut box"
desc = "Mmm. Donuts."
icon = 'icons/obj/food/donut.dmi'
icon_state = "donutbox_inner"
icon_type = "donut"
spawn_type = /obj/item/reagent_containers/food/snacks/donut
fancy_open = TRUE
custom_price = PRICE_NORMAL
appearance_flags = KEEP_TOGETHER
/obj/item/storage/fancy/donut_box/ComponentInitialize()
. = ..()
@@ -78,6 +79,36 @@
STR.max_items = 6
STR.can_hold = typecacheof(list(/obj/item/reagent_containers/food/snacks/donut))
/obj/item/storage/fancy/donut_box/PopulateContents()
. = ..()
update_icon()
/obj/item/storage/fancy/donut_box/update_icon_state()
if(fancy_open)
icon_state = "donutbox_inner"
else
icon_state = "donutbox"
/obj/item/storage/fancy/donut_box/update_overlays()
. = ..()
if (!fancy_open)
return
var/donuts = 0
for (var/_donut in contents)
var/obj/item/reagent_containers/food/snacks/donut/donut = _donut
if (!istype(donut))
continue
. += image(icon = initial(icon), icon_state = donut.in_box_sprite(), pixel_x = donuts * DONUT_INBOX_SPRITE_WIDTH)
donuts += 1
. += image(icon = initial(icon), icon_state = "donutbox_top")
#undef DONUT_INBOX_SPRITE_WIDTH
/*
* Egg Box
*/
@@ -34,6 +34,10 @@
filling_color = "#FF69B4"
return TRUE
/// Returns the sprite of the donut while in a donut box
/obj/item/reagent_containers/food/snacks/donut/proc/in_box_sprite()
return "[icon_state]_inbox"
/obj/item/reagent_containers/food/snacks/donut/checkLiked(fraction, mob/M) //Sec officers always love donuts
if(last_check_time + 50 < world.time)
if(ishuman(M))
@@ -165,6 +169,10 @@
tastes = list("jelly" = 1, "donut" = 3)
foodtype = JUNKFOOD | GRAIN | FRIED | FRUIT | SUGAR | BREAKFAST
// Jelly donuts don't have holes, but look the same on the outside
/obj/item/reagent_containers/food/snacks/donut/jelly/in_box_sprite()
return "[replacetext(icon_state, "jelly", "donut")]_inbox"
/obj/item/reagent_containers/food/snacks/donut/jelly/Initialize()
. = ..()
if(extra_reagent)