Im trying to make a system where the recipes is based on 3 things but i dont care the order of them, just that the 3 things are in it to make the end result. Atm its just selecting the item via a drop down menu and setting the var to w/e you pick for each part then checks the order and then produces the results.
In response to Mastergamerx
|
|
I would assume program them into whatever crafting solution checker you've written.
|
i mean var recipe[]=???? i dont know how to code it or what to put there exactly
|
Let's say each recipe is represented by an associative list, such as list(/obj/item/food/bun, /obj/item/food/flour=1, /obj/item/food/cinnamon=1, /obj/item/food/egg=2), and the first item in the list is the product. For robustness, if there's no associated value we'll call it a 1.
Let's also say that your inventory system uses stacking, so each of these objects has a count var. (I can't imagine wanting to do a crafting system without stacking.) Here's how I'd check: mob/proc/CraftRecipe(list/recipe) If you want this to be extensible, hard-coded types probably aren't ideal. In that case I'd go with something like a name var instead, and you'd have to use something besides locate() to find the item. |
This won't work if you have a stacking system, but I (and many many others) have straightforward solutions for crafting with item stacks.