Skip to content

Commit

Permalink
Removing plates and trays from food icons, making them a separate
Browse files Browse the repository at this point in the history
element of food appearance.
  • Loading branch information
MistakeNot4892 authored and comma committed Feb 15, 2024
1 parent 3881d0c commit 660c336
Show file tree
Hide file tree
Showing 43 changed files with 230 additions and 107 deletions.
4 changes: 3 additions & 1 deletion code/game/machinery/vending/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
markup = 0
base_type = /obj/machinery/vending/dinnerware
products = list(
/obj/item/chems/glass/beaker/bowl =2,
/obj/item/plate = 10,
/obj/item/plate/platter = 5,
/obj/item/chems/glass/beaker/bowl = 2,
/obj/item/storage/tray/metal/aluminium = 8,
/obj/item/knife/kitchen = 3,
/obj/item/kitchen/rollingpin = 2,
Expand Down
8 changes: 0 additions & 8 deletions code/game/objects/items/trash.dm
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@
name = "waffles"
icon_state = "waffles"

/obj/item/trash/plate
name = "plate"
icon_state = "plate"

/obj/item/trash/snack_bowl
name = "snack bowl"
icon_state = "snack_bowl"
Expand Down Expand Up @@ -99,10 +95,6 @@
name = "vobla pack"
icon_state = "driedfish"

/obj/item/trash/tray
name = "tray"
icon_state = "tray"

/obj/item/trash/candle
name = "candle"
icon = 'icons/obj/candle.dmi'
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/weapons/storage/trays.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/obj/item/storage/tray
name = "tray"
icon = 'icons/obj/food.dmi'
icon = 'icons/obj/food_trays.dmi'
icon_state = "tray_material"
desc = "A tray to serve food on."
force = 4
Expand Down
2 changes: 0 additions & 2 deletions code/game/objects/random/subtypes/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,8 @@
spawnable_choices[trash_type] = 95
for(var/trash_type in typesof(/obj/item/trash/cigbutt))
spawnable_choices[trash_type] = 95
spawnable_choices -= /obj/item/trash/plate
spawnable_choices -= /obj/item/trash/snack_bowl
spawnable_choices -= /obj/item/trash/syndi_cakes
spawnable_choices -= /obj/item/trash/tray
var/lunches = lunchables_lunches()
for(var/lunch in lunches)
spawnable_choices[lunches[lunch]] = 1
Expand Down
11 changes: 11 additions & 0 deletions code/modules/fabrication/designs/micro/designs_glasses.dm
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,14 @@

/datum/fabricator_recipe/drinkingglass/metalcoffecup
path = /obj/item/chems/drinks/glass2/coffeecup/metal

/datum/fabricator_recipe/dinnerware
category = "Dinnerware"
fabricator_types = list(FABRICATOR_CLASS_MICRO)
path = /obj/item/plate

/datum/fabricator_recipe/dinnerware/platter
path = /obj/item/plate/platter

/datum/fabricator_recipe/dinnerware/tray
path = /obj/item/plate/tray
71 changes: 71 additions & 0 deletions code/modules/food/plates/_plate.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/obj/item/plate
name = "plate"
desc = "A small plate, suitable for serving food."
material = /decl/material/solid/stone/ceramic
icon = 'icons/obj/food/plates/small_plate.dmi'
icon_state = ICON_STATE_WORLD
material_alteration = MAT_FLAG_ALTERATION_COLOR | MAT_FLAG_ALTERATION_NAME
w_class = ITEM_SIZE_SMALL
var/is_dirty

/obj/item/plate/Destroy()
if(istype(loc, /obj/item/chems/food))
var/obj/item/chems/food/food = loc
if(food.plate == src)
food.plate = null
return ..()

/obj/item/plate/proc/make_dirty(obj/item/chems/food/food)
if(!is_dirty)
is_dirty = food?.filling_color || COLOR_WHITE
update_icon()

/obj/item/plate/clean(clean_forensics = TRUE)
. = ..()
if(is_dirty)
is_dirty = null
update_icon()

/obj/item/plate/on_update_icon()
. = ..()
if(is_dirty)
var/image/I = image(icon, "[icon_state]-dirty")
I.appearance_flags |= RESET_COLOR
I.color = is_dirty
add_overlay(I)

/obj/item/plate/proc/try_plate_food(obj/item/chems/food/food, mob/user)
if(food.plate)
to_chat(user, SPAN_WARNING("\The [food] has already been plated."))
return
if(ismob(loc))
var/mob/M = loc
if(!M.try_unequip(src))
return
forceMove(food)
food.plate = src
user?.visible_message(SPAN_NOTICE("\The [user] places \the [food] on \the [src]."))
food.update_icon()

/obj/item/plate/attackby(obj/item/W, mob/living/user)
// Plating food.
if(istype(W, /obj/item/chems/food))
if(!user.try_unequip(W))
return TRUE
try_plate_food(W, user)
return TRUE
return ..()

/obj/item/plate/platter
name = "platter"
desc = "A large white platter, suitable for serving cakes or other large food."
icon = 'icons/obj/food/plates/platter.dmi'
material = /decl/material/solid/glass
w_class = ITEM_SIZE_NORMAL

/obj/item/plate/tray
name = "tray"
desc = "A large tray, suitable for serving several servings of food."
icon = 'icons/obj/food/plates/tray.dmi'
material = /decl/material/solid/organic/plastic
w_class = ITEM_SIZE_NORMAL
46 changes: 42 additions & 4 deletions code/modules/reagents/reagent_containers/food.dm
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
var/list/nutriment_desc = list("food" = 1) // List of flavours and flavour strengths. The flavour strength text is determined by the ratio of flavour strengths in the snack.
var/list/eat_sound = 'sound/items/eatfood.ogg'
var/filling_color = "#ffffff" //Used by sandwiches.
var/trash = null
var/trash
var/obj/item/plate/plate
var/list/attack_products //Items you can craft together. Like bomb making, but with food and less screwdrivers.
// Uses format list(ingredient = result_type). The ingredient can be a typepath or a kitchen_tag string (used for mobs or plants)

Expand All @@ -54,6 +55,8 @@
/obj/item/chems/food/Initialize()
.=..()
amount_per_transfer_from_this = bitesize
if(ispath(plate))
plate = new plate(src)

/obj/item/chems/food/attack_self(mob/user)
attack(user, user)
Expand All @@ -65,21 +68,30 @@
. = ..()
if(distance > 1)
return
if(plate)
to_chat(user, SPAN_NOTICE("\The [src] has been arranged on \a [plate]."))
if (bitecount==0)
return
else if (bitecount==1)
to_chat(user, "<span class='notice'>\The [src] was bitten by someone!</span>")
to_chat(user, SPAN_NOTICE("\The [src] was bitten by someone!"))
else if (bitecount<=3)
to_chat(user, "<span class='notice'>\The [src] was bitten [bitecount] time\s!</span>")
to_chat(user, SPAN_NOTICE("\The [src] was bitten [bitecount] time\s!"))
else
to_chat(user, "<span class='notice'>\The [src] was bitten multiple times!</span>")
to_chat(user, SPAN_NOTICE("\The [src] was bitten multiple times!"))

/obj/item/chems/food/attackby(obj/item/W, mob/living/user)
if(!istype(user))
return
if(istype(W,/obj/item/storage))
..()// -> item/attackby()
return

// Plating food.
if(istype(W, /obj/item/plate))
var/obj/item/plate/plate = W
plate.try_plate_food(src, user)
return TRUE

// Eating with forks
if(istype(W,/obj/item/kitchen/utensil))
var/obj/item/kitchen/utensil/U = W
Expand Down Expand Up @@ -178,6 +190,7 @@
return (slices_num && slice_path && slices_num > 0)

/obj/item/chems/food/proc/on_dry(var/atom/newloc)
drop_plate(get_turf(newloc))
if(dried_type == type)
SetName("dried [name]")
color = "#a38463"
Expand All @@ -188,7 +201,19 @@
. = new dried_type(newloc || get_turf(src))
qdel(src)

/obj/item/chems/food/proc/drop_plate(var/drop_loc)
if(istype(plate))
plate.dropInto(drop_loc || loc)
plate.make_dirty(src)
plate = null

/obj/item/chems/food/physically_destroyed()
drop_plate()
return ..()

/obj/item/chems/food/Destroy()
QDEL_NULL(plate)
trash = null
if(contents)
for(var/atom/movable/something in contents)
something.dropInto(loc)
Expand All @@ -207,9 +232,22 @@
update_icon()

/obj/item/chems/food/on_update_icon()
underlays.Cut()
. = ..()
//Since other things that don't have filling override this, slap it into its own proc to avoid the overhead of scanning through the icon file
apply_filling_overlay() //#TODO: Maybe generalise food item icons.
// If we have a plate, add it to our icon.
if(plate)
var/image/I = new
I.appearance = plate
I.layer = FLOAT_LAYER
I.plane = FLOAT_PLANE
I.pixel_x = 0
I.pixel_y = 0
I.pixel_z = 0
I.pixel_w = 0
I.appearance_flags |= RESET_TRANSFORM|RESET_COLOR
underlays += list(I)

/obj/item/chems/food/proc/apply_filling_overlay()
if(check_state_in_icon("[icon_state]_filling", icon))
Expand Down
16 changes: 8 additions & 8 deletions code/modules/reagents/reagent_containers/food/baked_goods.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
name = "banana cream pie"
desc = "Just like back home, on clown planet! HONK!"
icon_state = "pie"
trash = /obj/item/trash/plate
plate = /obj/item/plate
filling_color = "#fbffb8"
center_of_mass = @'{"x":16,"y":13}'
nutriment_desc = list("pie" = 3, "cream" = 2)
Expand All @@ -37,7 +37,7 @@
name = "berry clafoutis"
desc = "No black birds, this is a good sign."
icon_state = "berryclafoutis"
trash = /obj/item/trash/plate
plate = /obj/item/plate
center_of_mass = @'{"x":16,"y":13}'
nutriment_desc = list("sweetness" = 2, "pie" = 3)
nutriment_amt = 4
Expand Down Expand Up @@ -77,7 +77,7 @@
name = "pancakes"
desc = "Pancakes without blueberries, still delicious."
icon_state = "pancakes"
trash = /obj/item/trash/plate
plate = /obj/item/plate
center_of_mass = @'{"x":15,"y":11}'
nutriment_desc = list("pancake" = 8)
nutriment_amt = 8
Expand All @@ -87,7 +87,7 @@
name = "blueberry pancakes"
desc = "Pancakes with blueberries, delicious."
icon_state = "pancakes"
trash = /obj/item/trash/plate
plate = /obj/item/plate
center_of_mass = @'{"x":15,"y":11}'
nutriment_desc = list("pancake" = 8)
nutriment_amt = 8
Expand All @@ -97,7 +97,7 @@
name = "eggplant parmigiana"
desc = "The only good recipe for eggplant."
icon_state = "eggplantparm"
trash = /obj/item/trash/plate
plate = /obj/item/plate
filling_color = "#4d2f5e"
center_of_mass = @'{"x":16,"y":11}'
nutriment_desc = list("cheese" = 3, "eggplant" = 3)
Expand Down Expand Up @@ -132,7 +132,7 @@
name = "meat-pie"
icon_state = "meatpie"
desc = "An old barber recipe, very delicious!"
trash = /obj/item/trash/plate
plate = /obj/item/plate
filling_color = "#948051"
center_of_mass = @'{"x":16,"y":13}'
bitesize = 2
Expand All @@ -145,7 +145,7 @@
name = "tofu-pie"
icon_state = "meatpie"
desc = "A delicious tofu pie."
trash = /obj/item/trash/plate
plate = /obj/item/plate
filling_color = "#fffee0"
center_of_mass = @'{"x":16,"y":13}'
nutriment_desc = list("tofu" = 2, "pie" = 8)
Expand Down Expand Up @@ -188,7 +188,7 @@
name = "xeno-pie"
icon_state = "xenomeatpie"
desc = "A delicious meatpie. Probably heretical."
trash = /obj/item/trash/plate
plate = /obj/item/plate
filling_color = "#43de18"
center_of_mass = @'{"x":16,"y":13}'
bitesize = 2
Expand Down
10 changes: 5 additions & 5 deletions code/modules/reagents/reagent_containers/food/bread.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
name = "sandwich"
desc = "A grand creation of meat, cheese, bread, and several leaves of lettuce!"
icon_state = "sandwich"
trash = /obj/item/trash/plate
plate = /obj/item/plate
filling_color = "#d9be29"
center_of_mass = @'{"x":16,"y":4}'
nutriment_desc = list("bread" = 3, "cheese" = 3)
Expand All @@ -22,7 +22,7 @@
name = "toasted sandwich"
desc = "Now if you only had a pepper bar."
icon_state = "toastedsandwich"
trash = /obj/item/trash/plate
plate = /obj/item/plate
filling_color = "#d9be29"
center_of_mass = @'{"x":16,"y":4}'
nutriment_desc = list("toasted bread" = 3, "cheese" = 3)
Expand All @@ -39,7 +39,7 @@
name = "grilled cheese sandwich"
desc = "Goes great with Tomato soup!"
icon_state = "toastedsandwich"
trash = /obj/item/trash/plate
plate = /obj/item/plate
filling_color = "#d9be29"
nutriment_desc = list("toasted bread" = 3, "cheese" = 3)
nutriment_amt = 3
Expand Down Expand Up @@ -70,7 +70,7 @@
name = "jellied toast"
desc = "A slice of bread covered with delicious jam."
icon_state = "jellytoast"
trash = /obj/item/trash/plate
plate = /obj/item/plate
filling_color = "#b572ab"
center_of_mass = @'{"x":16,"y":8}'
nutriment_desc = list("toasted bread" = 2)
Expand All @@ -86,7 +86,7 @@
name = "jelly sandwich"
desc = "You wish you had some peanut butter to go with this..."
icon_state = "jellysandwich"
trash = /obj/item/trash/plate
plate = /obj/item/plate
filling_color = "#9e3a78"
center_of_mass = @'{"x":16,"y":8}'
nutriment_desc = list("bread" = 2)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/reagents/reagent_containers/food/eggs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
name = "cheese omelette"
desc = "Omelette with cheese!"
icon_state = "omelette"
trash = /obj/item/trash/plate
plate = /obj/item/plate
filling_color = "#fff9a8"
center_of_mass = @'{"x":16,"y":13}'
bitesize = 1
Expand Down
6 changes: 3 additions & 3 deletions code/modules/reagents/reagent_containers/food/fried.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
name = "onion rings"
desc = "Like circular fries but better."
icon_state = "onionrings"
trash = /obj/item/trash/plate
plate = /obj/item/plate
filling_color = "#eddd00"
center_of_mass = @'{"x":16,"y":11}'
nutriment_desc = list("fried onions" = 5)
Expand All @@ -19,7 +19,7 @@
name = "chips"
desc = "Frenched potato, fried."
icon_state = "fries"
trash = /obj/item/trash/plate
plate = /obj/item/plate
filling_color = "#eddd00"
center_of_mass = @'{"x":16,"y":11}'
nutriment_desc = list("fresh fries" = 4)
Expand All @@ -40,7 +40,7 @@
name = "cheesy fries"
desc = "Fries. Covered in cheese. Duh."
icon_state = "cheesyfries"
trash = /obj/item/trash/plate
plate = /obj/item/plate
filling_color = "#eddd00"
center_of_mass = @'{"x":16,"y":11}'
nutriment_desc = list("fresh fries" = 3, "cheese" = 3)
Expand Down
Loading

0 comments on commit 660c336

Please sign in to comment.