More flexible recipe

Let’s take the example of the basic chemistry set :

Components required:

1x pair of safety glasses
3x rubber hose
4x glass flask OR 4x glass jar OR 4x glass bottle
1x cardboard box OR 1x canvas sack OR 1x backpack OR 1x leather backpack OR 1x military rucksack

With the current system if you have 3x glass flask AND 3x glass jar you can’t craft it, which is a bit frustrating since the recipe seems to suggest that glass jar and glass flask are equivalent. So it feels like you should be able to swap ONE fore the other.

So my question is : would it possible to make it so instead of : “4xA OR 4xB” , we get “4 amongst {A,B}” ? 4 Items within the list of valid ones ?

I too would be interested in this.

A lot of things are possible. This particular change requires teaching the code how to handle mixed ingredients, and then going through the json and changing all the recipes that should use mixed recipes to the new format. It’s a fairly big task.

I thought someone had written a pull request for this, but I can’t find it at github right now.

the way to do this within the current framework is to specify each bottle as its own ingredient.

i.e.

  • bottle
  • bottle
  • bottle
  • bottle

rather than

  • bottle, 4

I guess you can use requirements for that:

  {
    "id": "leather_large",
    "type": "requirement",
    "//": "Leather or leather equivalent items for crafting.",
    "components": [ [ [ "leather", 6 ], [ "tanned_hide", 1 ] ] ]
  },

More here:

Is this it?

Thanks, Zhilkin, those were some of the ones I was thinking of.

I might pick up the requirements one. It looks like its a json only change and should be relatively easy to do.

Would the requirements work in this way? You would still need all the ingredients of the same kind, no? If it was "components": [ [ [ "leather", 12 ], [ "tanned_hide", 2 ] ] ] you still wouldn’t be able to use 6 leathers and 1 tanned hide, right?

I feel like the move to the requirements is still pretty good, as it’ll definitely make it much easier and possible to have consistent recipes across the board.

Right, moving to requirements isn’t enough, but it will make it easier in the future to create recipes that use mixed ingredients properly.

I may get distracted, because as one of the reviewers notes, the current handling of tanned hides and pelts is awful and they all need to be replaced by a smarter ingredients parse that knows each hide/pelt is potentially 8 leathers/furs and asks you if you want to cut stuff up to reach the count. I’m not sure if C:DDA already has most the tools to enable that or not.

You cannot mix components - I’ve already stumbled upon this here: