Merge pull request #715 from CHOMPStationBot/upstream-merge-9233

[MIRROR] [MIRROR] Makes the recipe dump take coatings into account
This commit is contained in:
Nadyr
2020-10-22 09:19:34 -04:00
committed by GitHub

View File

@@ -34,6 +34,7 @@
"Catalysts" = list(),
"Fruit" = R.fruit,
"Ingredients" = R.items,
"Coating" = R.coating,
"Appliance" = R.appliance,
"Image" = result_icon
)
@@ -57,8 +58,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)
@@ -67,6 +71,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
@@ -195,6 +201,20 @@
if(pretty_ing != "")
html += "<li><b>Ingredients:</b> [pretty_ing]</li>"
//Coating
if(!food_recipes[Rp]["has_coatable_items"])
html += "<span class = \"coating coating_not_applicable\"><li><b>Coating:</b> N/A, no coatable items</li></span>"
// 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 += "<span class = \"coating coating_any_coating\"><li><b>Coating:</b> Optionally, any coating</li></span>"
else if(isnull(food_recipes[Rp]["Coating"]))
html += "<span class = \"coating coating_uncoated\"><li><b>Coating:</b> Must be uncoated</li></span>"
else
var/coatingtype = food_recipes[Rp]["Coating"]
var/datum/reagent/coating = new coatingtype()
html += "<span class = \"coating coating_specific_coating\"><li><b>Coating:</b> [coating.name]</li></span>"
//For each fruit
var/pretty_fru = ""
count = 0