diff --git a/code/__DEFINES/crafting.dm b/code/__DEFINES/crafting.dm
index 8218d392640..aff1b20e4b2 100644
--- a/code/__DEFINES/crafting.dm
+++ b/code/__DEFINES/crafting.dm
@@ -5,3 +5,8 @@
#define CAT_FOOD "Food"
#define CAT_MISC "Misc"
#define CAT_PRIMAL "Tribal"
+
+#define RECIPE_MICROWAVE "Microwave"
+#define RECIPE_OVEN "Oven"
+#define RECIPE_GRILL "Grill"
+#define RECIPE_CANDY "Candy"
\ No newline at end of file
diff --git a/code/_globalvars/lists/misc.dm b/code/_globalvars/lists/misc.dm
index a6b78bce94c..331780d8571 100644
--- a/code/_globalvars/lists/misc.dm
+++ b/code/_globalvars/lists/misc.dm
@@ -30,3 +30,13 @@ var/list/round_end_sounds = list( // Maps available round end sounds to their du
'sound/goonstation/misc/newround1.ogg' = 6.9 SECONDS,
'sound/goonstation/misc/newround2.ogg' = 14.8 SECONDS
)
+
+var/list/cooking_recipe_types = list(
+ RECIPE_MICROWAVE = /datum/recipe/microwave,
+ RECIPE_OVEN = /datum/recipe/oven,
+ RECIPE_GRILL = /datum/recipe/grill,
+ RECIPE_CANDY = /datum/recipe/candy
+ )
+var/list/cooking_recipes = list(RECIPE_MICROWAVE = list(), RECIPE_OVEN = list(), RECIPE_GRILL = list(), RECIPE_CANDY = list())
+var/list/cooking_ingredients = list(RECIPE_MICROWAVE = list(), RECIPE_OVEN = list(), RECIPE_GRILL = list(), RECIPE_CANDY = list())
+var/list/cooking_reagents = list(RECIPE_MICROWAVE = list(), RECIPE_OVEN = list(), RECIPE_GRILL = list(), RECIPE_CANDY = list())
\ No newline at end of file
diff --git a/code/datums/recipe.dm b/code/datums/recipe.dm
index e379de25209..668c254fe54 100644
--- a/code/datums/recipe.dm
+++ b/code/datums/recipe.dm
@@ -95,16 +95,16 @@
container.reagents.clear_reagents()
return result_obj
-/proc/select_recipe(list/datum/recipe/avaiable_recipes, obj/obj, exact = 1 as num)
+/proc/select_recipe(list/datum/recipe/available_recipes, obj/obj, exact = 1 as num)
if(!exact)
exact = -1
var/list/datum/recipe/possible_recipes = new
- for(var/datum/recipe/recipe in avaiable_recipes)
- if(recipe.check_reagents(obj.reagents)==exact && recipe.check_items(obj)==exact)
- possible_recipes+=recipe
- if(possible_recipes.len==0)
+ for(var/datum/recipe/recipe in available_recipes)
+ if(recipe.check_reagents(obj.reagents) == exact && recipe.check_items(obj) == exact)
+ possible_recipes += recipe
+ if(possible_recipes.len == 0)
return null
- else if(possible_recipes.len==1)
+ else if(possible_recipes.len == 1)
return possible_recipes[1]
else //okay, let's select the most complicated recipe
var/r_count = 0
diff --git a/code/modules/food_and_drinks/kitchen_machinery/candy_maker.dm b/code/modules/food_and_drinks/kitchen_machinery/candy_maker.dm
index 1452df3ea70..b77ee23c714 100644
--- a/code/modules/food_and_drinks/kitchen_machinery/candy_maker.dm
+++ b/code/modules/food_and_drinks/kitchen_machinery/candy_maker.dm
@@ -5,7 +5,7 @@
icon = 'icons/obj/cooking_machines.dmi'
icon_state = "candymaker_off"
cook_verbs = list("Wonderizing", "Scrumpdiddlyumptiousification", "Miracle-coating", "Flavorifaction")
- recipe_type = /datum/recipe/candy
+ recipe_type = RECIPE_CANDY
off_icon = "candymaker_off"
on_icon = "candymaker_on"
broken_icon = "candymaker_broke"
diff --git a/code/modules/food_and_drinks/kitchen_machinery/grill_new.dm b/code/modules/food_and_drinks/kitchen_machinery/grill_new.dm
index 1a1dd34196d..fcfe84f3174 100644
--- a/code/modules/food_and_drinks/kitchen_machinery/grill_new.dm
+++ b/code/modules/food_and_drinks/kitchen_machinery/grill_new.dm
@@ -5,7 +5,7 @@
icon = 'icons/obj/cooking_machines.dmi'
icon_state = "grill_off"
cook_verbs = list("Grilling", "Searing", "Frying")
- recipe_type = /datum/recipe/grill
+ recipe_type = RECIPE_GRILL
off_icon = "grill_off"
on_icon = "grill_on"
broken_icon = "grill_broke"
diff --git a/code/modules/food_and_drinks/kitchen_machinery/kitchen_machine.dm b/code/modules/food_and_drinks/kitchen_machinery/kitchen_machine.dm
index 289a4c66d4c..d6af2696d53 100644
--- a/code/modules/food_and_drinks/kitchen_machinery/kitchen_machine.dm
+++ b/code/modules/food_and_drinks/kitchen_machinery/kitchen_machine.dm
@@ -16,10 +16,7 @@
var/list/cook_verbs = list("Cooking")
//Recipe & Item vars
var/recipe_type //Make sure to set this on the machine definition, or else you're gonna runtime on New()
- var/list/datum/recipe/available_recipes // List of the recipes you can use
- var/list/acceptable_items // List of the items you can put in
- var/list/acceptable_reagents // List of the reagents you can put in
- var/max_n_of_items = 0
+ var/max_n_of_items = 25
//Icon states
var/off_icon
var/on_icon
@@ -34,23 +31,24 @@
/obj/machinery/kitchen_machine/New()
create_reagents(100)
reagents.set_reacting(FALSE)
- if(!available_recipes)
- available_recipes = new
- acceptable_items = new
- acceptable_reagents = new
- for(var/type in subtypesof(recipe_type))
- var/datum/recipe/recipe = new type
- if(recipe.result) // Ignore recipe subtypes that lack a result
- available_recipes += recipe
- for(var/item in recipe.items)
- acceptable_items |= item
- for(var/reagent in recipe.reagents)
- acceptable_reagents |= reagent
- if(recipe.items)
- max_n_of_items = max(max_n_of_items,recipe.count_n_items())
- else
- qdel(recipe)
- acceptable_items |= /obj/item/weapon/reagent_containers/food/snacks/grown
+ if(!cooking_recipes[recipe_type])
+ cooking_recipes[recipe_type] = list()
+ cooking_ingredients[recipe_type] = list()
+ cooking_reagents[recipe_type] = list()
+ for(var/type in subtypesof(cooking_recipe_types[recipe_type]))
+ var/datum/recipe/recipe = new type
+ if(recipe in cooking_recipes[recipe_type])
+ qdel(recipe)
+ continue
+ if(recipe.result) // Ignore recipe subtypes that lack a result
+ cooking_recipes[recipe_type] += recipe
+ for(var/item in recipe.items)
+ cooking_ingredients[recipe_type] |= item
+ for(var/reagent in recipe.reagents)
+ cooking_reagents[recipe_type] |= reagent
+ else
+ qdel(recipe)
+ cooking_ingredients[recipe_type] |= /obj/item/weapon/reagent_containers/food/snacks/grown
/*******************
* Item Adding
@@ -124,7 +122,7 @@
else //Otherwise bad luck!!
to_chat(user, "It's dirty!")
return 1
- else if(is_type_in_list(O,acceptable_items))
+ else if(is_type_in_list(O, cooking_ingredients[recipe_type]))
if(contents.len>=max_n_of_items)
to_chat(user, "This [src] is full of ingredients, you cannot put more.")
return 1
@@ -150,7 +148,7 @@
if(!O.reagents)
return 1
for(var/datum/reagent/R in O.reagents.reagent_list)
- if(!(R.id in acceptable_reagents))
+ if(!(R.id in cooking_reagents[recipe_type]))
to_chat(user, "Your [O] contains components unsuitable for cookery.")
return 1
//G.reagents.trans_to(src,G.amount_per_transfer_from_this)
@@ -259,7 +257,7 @@
stop()
return
- var/datum/recipe/recipe = select_recipe(available_recipes,src)
+ var/datum/recipe/recipe = select_recipe(cooking_recipes[recipe_type], src)
var/obj/cooked
var/obj/byproduct
if(!recipe)
diff --git a/code/modules/food_and_drinks/kitchen_machinery/microwave.dm b/code/modules/food_and_drinks/kitchen_machinery/microwave.dm
index 49cfc3ad0e8..4c5f07ff0ba 100644
--- a/code/modules/food_and_drinks/kitchen_machinery/microwave.dm
+++ b/code/modules/food_and_drinks/kitchen_machinery/microwave.dm
@@ -5,7 +5,7 @@
icon = 'icons/obj/kitchen.dmi'
icon_state = "mw"
cook_verbs = list("Microwaving", "Reheating", "Heating")
- recipe_type = /datum/recipe/microwave
+ recipe_type = RECIPE_MICROWAVE
off_icon = "mw"
on_icon = "mw1"
broken_icon = "mwb"
diff --git a/code/modules/food_and_drinks/kitchen_machinery/oven_new.dm b/code/modules/food_and_drinks/kitchen_machinery/oven_new.dm
index 5c1ed4ac6df..c6149b382c5 100644
--- a/code/modules/food_and_drinks/kitchen_machinery/oven_new.dm
+++ b/code/modules/food_and_drinks/kitchen_machinery/oven_new.dm
@@ -5,7 +5,7 @@
icon = 'icons/obj/cooking_machines.dmi'
icon_state = "oven_off"
cook_verbs = list("Baking", "Roasting", "Broiling")
- recipe_type = /datum/recipe/oven
+ recipe_type = RECIPE_OVEN
off_icon = "oven_off"
on_icon = "oven_on"
broken_icon = "oven_broke"