Guide to adding new content to CDDA for first time modders

Adding a new recipe

Recipes determine what you can craft. They’re relatively easy to add.

Recipes are stored in data/json/recipes . There are some subfolders there and subfiles like recipe_food.json. Just pick one that seems appropriate.

This is the JSON object for the salt (made from boiling water) recipe:

  {
    "type": "recipe",
    "result": "salt",
    "id_suffix": "from_salt_water",
    "category": "CC_FOOD",
    "subcategory": "CSC_FOOD_OTHER",
    "skill_used": "cooking",
    "difficulty": 0,
    "time": 90000,
    "autolearn": true,
    "batch_time_factors": [ 80, 4 ],
    "qualities": [ { "id": "BOIL", "level": 1 } ],
    "tools": [ [ [ "water_boiling_heat", 3, "LIST" ] ] ],
    "components": [ [ [ "salt_water", 10 ], [ "saline", 50 ] ] ]
  },

Important bits:

  • "type" has to be "recipe"
  • "result" is the "id" of the item that the recipe creates. items are defined in data/json/items/ and its subfolders.
  • "id_suffix" is used to differentiate two recipes that have the same results. It doesn’t really mean anything and you can put anything here as long as every recipe with the same result has a different id_suffix, but it’s good practice to use something that makes it easy to tell why each recipe is different.
  • "category" and "subcategory" are where the recipe will end up in the craft menu. You have to use a valid string in both cases, so look through the recipes to find one in the same category as your new recipe and use those values.
  • "skill_used" is the "ident" of the primary skill for the recipe. possible skills are in data/json/skills.json
  • "difficulty" is the number of the skill level where you have a high chance of automatically making this recipe.
  • “time” is the number of ticks to create a single result. 100 ticks is 1 turn or 6 seconds.
  • "autolearn" is true if you learn the recipe automatically when your skill reaches difficulty. Otherwise, there should be a "book_learn" entry, with a list of lists of references books and the skill level at which you get the recipe, like "book_learn": [ [ "cookbook_sushi", 3 ] ] for sushi veggy rolls. The books are refered to by “id” from data/json/items/ again.
  • "qualities" is a list of tool qualities you need to make the recipe. Available qualities are in data/json/tool_qualities.json and items define what tool qualities they provide. Items that provide qualities are not consumed by the recipe.
  • "tools' is a list of tool types you need, in addition to the qualities. While qualities is a list of objects, tools is a list of lists. Items that provide tools are not consumed by the recipe.
  • "components" is a list of lists of components that are consumed by the recipe. They break down like this:
    [ "water", 1] is a single component, where the first string is "id" of the item in the component, and the second number is the number of that item that is required.
    [ [ "water", 1 ], [ "water_clean", 1 ] ] is an options list. it’s a list of single components. either component can be used to satisfy the recipe. It can have as a single entry.
"components": [
  [ [ "scrap", 1 ] ],
  [ [ "water", 1 ], [ "water_clean", 1 ] ],
]

is the full components list, made up of options lists. So this recipe requires a piece of scrap metal and a unit of water or clean water.

So adding a new recipe requires that you have:

  • the id of resulting item
  • the ids of all components and tools
  • the qualities of any tools specified by quality
  • the ident of the skill
  • the difficulty of the crafting
  • the ids of any books used to learn the recipe
  • the time to make the recipe.
7 Likes