From 914f1a075cddbd8ff6d8516bea1e21c92843cfd8 Mon Sep 17 00:00:00 2001 From: Verkister Date: Sun, 18 Oct 2020 15:31:08 +0300 Subject: [PATCH 1/2] Merge pull request #9233 from VOREStation/upstream-merge-7723 [MIRROR] Makes the recipe dump take coatings into account --- code/modules/food/recipe_dump.dm | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/code/modules/food/recipe_dump.dm b/code/modules/food/recipe_dump.dm index 45f4c3e4ae..e2c2bd1b1e 100644 --- a/code/modules/food/recipe_dump.dm +++ b/code/modules/food/recipe_dump.dm @@ -32,6 +32,7 @@ "Reagents" = R.reagents, "Fruit" = R.fruit, "Ingredients" = R.items, + "Coating" = R.coating, "Appliance" = R.appliance, "Image" = result_icon ) @@ -54,8 +55,11 @@ //Items needs further processing into human-readability. for(var/Rp in food_recipes) var/working_ing_list = list() + food_recipes[Rp]["has_coatable_items"] = FALSE for(var/I in food_recipes[Rp]["Ingredients"]) var/atom/ing = new I() + if(istype(ing, /obj/item/weapon/reagent_containers/food/snacks)) // only subtypes of this have a coating variable and are checked for it (fruit are a subtype of this, so there's a check for them too later) + food_recipes[Rp]["has_coatable_items"] = TRUE //So now we add something like "Bread" = 3 if(ing.name in working_ing_list) @@ -64,6 +68,8 @@ else working_ing_list[ing.name] = 1 + if(LAZYLEN(food_recipes[Rp]["Fruit"])) + food_recipes[Rp]["has_coatable_items"] = TRUE food_recipes[Rp]["Ingredients"] = working_ing_list //Reagents can be resolved to nicer names as well @@ -174,6 +180,20 @@ if(pretty_ing != "") html += "
  • Ingredients: [pretty_ing]
  • " + //Coating + if(!food_recipes[Rp]["has_coatable_items"]) + html += "
  • Coating: N/A, no coatable items
  • " + // css can be used to style or hide these depending on the class. This has two classes + // coating and coating_not_applicable, which can each have styles applied. + else if(food_recipes[Rp]["Coating"] == -1) + html += "
  • Coating: Optionally, any coating
  • " + else if(isnull(food_recipes[Rp]["Coating"])) + html += "
  • Coating: Must be uncoated
  • " + else + var/coatingtype = food_recipes[Rp]["Coating"] + var/datum/reagent/coating = new coatingtype() + html += "
  • Coating: [coating.name]
  • " + //For each fruit var/pretty_fru = "" count = 0