Cascading Crafting
kurokuno opened this issue ยท 9 comments
would it be possible for the mod to do cascading crafting say i wanted to make a delux meal and i have everything required to make it in the fridge is there any way to say have the mod craft all pre-req foods then the final product without having to do each one pipe it out then back in to get the finished product
I do not believe cascading crafting fits the style of the mod. As an alternative I could imagine more themed blocks that can provide processed ingredients (e.g. Ice Unit => Ice, Sink => Salt, etc.) implicitly, but those would have to be planned and added individually.
Is it possible to add a delay in crafting? Each stage crafted this way takes longer to cook-> prep?
Immersion suggestion, add some items that provide crafting "translation."
Example:
- Right now, if you look up a recipe that uses toast, but you have none, you can't make it.
- With this suggestion, if you have a toaster, then bread will fulfill the toast requirement.
- Add a bread machine and it now sees dough as bread as toast.
This can also relate to #305 and #309. (As well as anything that comes up with the icemaker, etc.)
If you add a JSON for external blocks, pack developers could add other processing blocks, like Pam's ( #353) or Crayfish (#373). (You might need to add some non-slip carpeting to help link the huge Iron Chef kitchens that you're inspiring.)
I'm curious: habe you given this mich thought already?
I got thinking about this and came across a few potential problems - it would be very interesting to hear your thoughts on this, of you've had some - before I clone the code and play around with it.
First there is the conceptional issue with alternate recipes or recipes using (ore) dictionary ingredients. When there are mutilple recipes for some food that's not immediately an issue since he player can select which ingredients he or she wants to use.but for cascading crafting we might run into problems if one of the ingredients that has to be crafted has multiple recipes. But that is only if this case occurs at all.
Then there is the question on how to handle the process of finding possible "cascading recipes".
My first idea would be to handle even shaped recipes as shapeless (which, for the purpose of checking whether the player has all ingredients and for auto-crafting them, should be OK). If we then increase the number of possible ingredients from nine to infinite we can actually represent an entire tree of cascading recipes in one such structure.
And while increases the recipe list the performance impact of the recursion would mostly happen during initialization...
From a quick glance at the code it seems to me that approach might work and fit in with the existing code.
Still I'd be very happy to hear your thoughts on this, since I guess you might already have put some thinking into this issue.
Kind regards!
You were probably referring to the OP, but I've given it thought so here's what I got. You can have a priority system, make the player prepare, or fail.
For example, say toast can be made in two different mods, one by smelting bread and one by crafting a frying pan, butter and bread. Plus, you have a dedicated toaster that converts bread to toast. You have all the ingredients for all three versions (including a fueled oven and toaster). Assume a recipe calls for toast and any of the three will suffice.
Priority) You can give priority to the toaster, since it's a dedicated machine. If there's no toaster, priority goes to the oven (assuming the results can be brought back in) because it's more immersive than grid crafting.
Prepare) Have recipe cards or something a player can use (like filters) on processing machines to limit requests. This makes more work for the player (and coder) and has the autocrafting issue of having to pre-register every recipe.
Fail) You can refuse the request because it's not clear, forcing players to remove the toaster and frying pan to limit the options. However, that causes problems if the frying pan is needed later.
I'd suggest a combo idea. Use dedicated, or semi-dedicated items with priority. Give them in inventory that works as a filter (i.e., the toaster has slots, you put bread and poptarts in them so those items can be used, but will be taken from the pantry and fridge first with the internal buffer used last). The player can make recipe cards that will have priority over the regular system (i.e., like an autocrafting pattern that is checked before the list of crafting possibilities). When the chain isn't clear, don't do it (players need to maintain their workspace, it's not magic).
I'm inclined towards a much simpler system based on predefined recipe books you would most likely be able to find as dungeon loot. For example there would be a cheese themed book providing several cheesy meals as cascade recipes. Placing these in a bookshelf in the kitchen would make them available in the cooking table.
That way the recursive recipe scanning can be limited to those few selected items.
The toaster is not meant to be an automated piece of the kitchen, therefore it doesn't appear in the cooking table right now either. I'd also go as far as excluding the oven from this, given it's an asynchronous process unlike the crafting.