diff --git a/code/__DEFINES/construction.dm b/code/__DEFINES/construction.dm index d627e668bed..6ce1810a75d 100644 --- a/code/__DEFINES/construction.dm +++ b/code/__DEFINES/construction.dm @@ -80,7 +80,8 @@ //maximum amount of cable in a coil #define MAXCOIL 30 -//tablecrafting defines +//food/drink crafting defines +//When adding new defines, please make sure to also add them to the encompassing list #define CAT_FOOD "Foods" #define CAT_BREAD "Breads" #define CAT_BURGER "Burgers" @@ -102,7 +103,31 @@ #define CAT_ICE "Frozen" #define CAT_DRINK "Drinks" +GLOBAL_LIST_INIT(crafting_category_food, list( + CAT_FOOD, + CAT_BREAD, + CAT_BURGER, + CAT_CAKE, + CAT_EGG, + CAT_LIZARD, + CAT_MEAT, + CAT_SEAFOOD, + CAT_MISCFOOD, + CAT_MEXICAN, + CAT_MOTH, + CAT_PASTRY, + CAT_PIE, + CAT_PIZZA, + CAT_SALAD, + CAT_SANDWICH, + CAT_SOUP, + CAT_SPAGHETTI, + CAT_ICE, + CAT_DRINK, +)) + //crafting defines +//When adding new defines, please make sure to also add them to the encompassing list #define CAT_WEAPON_RANGED "Weapons Ranged" #define CAT_WEAPON_MELEE "Weapons Melee" #define CAT_WEAPON_AMMO "Weapon Ammo" @@ -122,6 +147,27 @@ #define CAT_TOOLS "Tools" #define CAT_CULT "Blood Cult" +GLOBAL_LIST_INIT(crafting_category, list( + CAT_WEAPON_RANGED, + CAT_WEAPON_MELEE, + CAT_WEAPON_AMMO, + CAT_ROBOT, + CAT_MISC, + CAT_CLOTHING, + CAT_CHEMISTRY, + CAT_ATMOSPHERIC, + CAT_STRUCTURE, + CAT_TILES, + CAT_WINDOWS, + CAT_DOORS, + CAT_FURNITURE, + CAT_EQUIPMENT, + CAT_CONTAINERS, + CAT_ENTERTAINMENT, + CAT_TOOLS, + CAT_CULT, +)) + //rcd modes #define RCD_FLOORWALL 0 #define RCD_AIRLOCK 1 diff --git a/code/__HELPERS/global_lists.dm b/code/__HELPERS/global_lists.dm index a48c0f7ff47..05d6be65214 100644 --- a/code/__HELPERS/global_lists.dm +++ b/code/__HELPERS/global_lists.dm @@ -65,8 +65,8 @@ for(var/path in subtypesof(/datum/crafting_recipe)) if(ispath(path, /datum/crafting_recipe/stack)) continue - var/is_cooking = ispath(path, /datum/crafting_recipe/food/) var/datum/crafting_recipe/recipe = new path() + var/is_cooking = (recipe.category in GLOB.crafting_category_food) recipe.reqs = sort_list(recipe.reqs, GLOBAL_PROC_REF(cmp_crafting_req_priority)) if(recipe.name != "" && recipe.result) if(is_cooking) diff --git a/code/datums/components/crafting/_recipes.dm b/code/datums/components/crafting/_recipes.dm index 5d248b04ba3..9239ac07244 100644 --- a/code/datums/components/crafting/_recipes.dm +++ b/code/datums/components/crafting/_recipes.dm @@ -44,6 +44,8 @@ var/datum/chemical_reaction/reaction /// Resulting amount (for stacks only) var/result_amount + /// Whether we should delete the contents of the crafted storage item (Only works with storage items, used for ammo boxes, donut boxes, internals boxes, etc) + var/delete_contents = TRUE /datum/crafting_recipe/New() if(!(result in reqs)) diff --git a/code/datums/components/crafting/crafting.dm b/code/datums/components/crafting/crafting.dm index b3babfeae88..51f74fd389e 100644 --- a/code/datums/components/crafting/crafting.dm +++ b/code/datums/components/crafting/crafting.dm @@ -77,7 +77,7 @@ for(var/machinery_path in R.machinery) if(!machines[machinery_path])//We don't care for volume with machines, just if one is there or not return FALSE - + for(var/required_structure_path in R.structures) // Check for the presence of the required structure. Allow for subtypes to be used if not blacklisted var/needed_amount = R.structures[required_structure_path] @@ -89,7 +89,7 @@ requirements_list[required_structure_path] = structures[structure_path] // Store an instance of what we are using for check_requirements if(needed_amount <= 0) break - + // We didn't find the required item if(needed_amount > 0) return FALSE @@ -204,7 +204,7 @@ I = new R.result (get_turf(a.loc), R.result_amount || 1) else I = new R.result (get_turf(a.loc)) - if(I.atom_storage) + if(I.atom_storage && R.delete_contents) for(var/obj/item/thing in I) qdel(thing) I.CheckParts(parts, R) @@ -361,8 +361,6 @@ /datum/component/personal_crafting/proc/is_recipe_available(datum/crafting_recipe/recipe, mob/user) if(!recipe.always_available && !(recipe.type in user?.mind?.learned_recipes)) //User doesn't actually know how to make this. return FALSE - if (ispath(recipe.type, /datum/crafting_recipe/food/) != mode) // Skip if food and mode is crafting / Skip if not food and mode is cooking - return FALSE if (recipe.category == CAT_CULT && !IS_CULTIST(user)) // Skip blood cult recipes if not cultist return FALSE return TRUE @@ -563,7 +561,7 @@ data["machinery"] = list() for(var/req_atom as anything in recipe.machinery) data["machinery"] += atoms.Find(req_atom) - + // Structures if(recipe.structures) data["structures"] = list() diff --git a/code/modules/food_and_drinks/recipes/tablecraft/recipes_misc.dm b/code/modules/food_and_drinks/recipes/tablecraft/recipes_misc.dm index 663411be013..263cddc3b84 100644 --- a/code/modules/food_and_drinks/recipes/tablecraft/recipes_misc.dm +++ b/code/modules/food_and_drinks/recipes/tablecraft/recipes_misc.dm @@ -291,22 +291,6 @@ result = /obj/item/food/pacoca category = CAT_MISCFOOD -/datum/crafting_recipe/food/pickles_jar - name = "Jar of pickles" - reqs = list( - /obj/item/reagent_containers/cup/beaker/large = 1, - /obj/item/food/grown/cucumber = 10, - /datum/reagent/water = 10, - /datum/reagent/consumable/salt = 10, - ) - result = /obj/item/storage/fancy/pickles_jar - category = CAT_MISCFOOD - -/datum/crafting_recipe/food/pickles_jar/on_craft_completion(mob/user, atom/result) - . = ..() - var/obj/item/storage/fancy/pickles_jar/jar = result - qdel(locate(/obj/item/reagent_containers/cup/beaker/large) in jar.contents) - /datum/crafting_recipe/food/springroll name = "Spring roll" reqs = list( @@ -412,3 +396,15 @@ ) result = /obj/item/food/bonbon/peanut_butter_cup category = CAT_MISCFOOD + +/datum/crafting_recipe/pickles_jar + name = "Jar of pickles" + reqs = list( + /obj/item/reagent_containers/cup/beaker/large = 1, + /obj/item/food/grown/cucumber = 10, + /datum/reagent/water = 10, + /datum/reagent/consumable/salt = 10, + ) + result = /obj/item/storage/fancy/pickles_jar + category = CAT_MISCFOOD + delete_contents = FALSE