Recipe JSON Info: Difference between revisions

From The Cataclysm: Dark Days Ahead Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 3: Line 3:
Crafting '''recipes''' are defined as a JSON object with the following fields:
Crafting '''recipes''' are defined as a JSON object with the following fields:


=== ID fields ===
;"result":
;"result":


Line 18: Line 20:
Category of crafting recipe. CC_NONCRAFT used for disassembly recipes
Category of crafting recipe. CC_NONCRAFT used for disassembly recipes


"subcategory"
;"subcategory":


"subcategory": "CSC_WEAPON_PIERCING",
"subcategory": "CSC_WEAPON_PIERCING",
Line 37: Line 39:
Optional (default: empty list). Flags specified here will be removed from the resultant item upon crafting. This will override flag inheritance, but *will not* delete flags that are part of the item type itself.
Optional (default: empty list). Flags specified here will be removed from the resultant item upon crafting. This will override flag inheritance, but *will not* delete flags that are part of the item type itself.


;"flags":
A set of strings describing boolean features of the recipe
"flags": [                 
  "BLIND_EASY",
  "ANOTHERFLAG"
],
;"reversible":
    "reversible": false,       


"reversible": false,       
Can be disassembled.
Can be disassembled.


Line 53: Line 66:
     "time": 5000,                 
     "time": 5000,                 


;"batch_time_factors":
    "batch_time_factors": [25, 15],
Optional factors for batch crafting time reduction. First number specifies maximum crafting time reduction as percentage, and the second number the minimal batch size to reach that number. In this example given batch size of 20 the last 6 crafts will take only 3750 time units.




Line 143: Line 160:
]
]


"batch_time_factors": [25, 15],
Optional factors for batch crafting time reduction. First number specifies maximum crafting time reduction as percentage, and the second number the minimal batch size to reach that number. In this example given batch size of 20 the last 6 crafts will take only 3750 time units.


"flags": [                 
A set of strings describing boolean features of the recipe
  "BLIND_EASY",
  "ANOTHERFLAG"
],


=== faction camp fields ===
=== faction camp fields ===

Revision as of 17:32, 19 August 2020

Recipes

Crafting recipes are defined as a JSON object with the following fields:


ID fields

"result"

ID of resulting item. The thing the recipe creates.

    "result": "javelin",
"byproducts"
    "byproducts": [ [ "" ] ],    

Optional (default: empty). Additional items generated by crafting this recipe.

"category"
    "category": "CC_WEAPON",  

Category of crafting recipe. CC_NONCRAFT used for disassembly recipes

"subcategory"

"subcategory": "CSC_WEAPON_PIERCING",

"id_suffix"
    "id_suffix": "",

Optional (default: empty string). Some suffix to make the ident of the recipe unique. The ident of the recipe is "<id-of-result><id_suffix>".

"override"
    "override": false,

Optional (default: false). If false and the ident of the recipe is already used by another recipe, loading of recipes fails. If true and a recipe with the ident is already defined, the existing recipe is replaced by the new recipe.

"delete_flags"
    "delete_flags": [ "CANNIBALISM" ], 

Optional (default: empty list). Flags specified here will be removed from the resultant item upon crafting. This will override flag inheritance, but *will not* delete flags that are part of the item type itself.

"flags"

A set of strings describing boolean features of the recipe

"flags": [

 "BLIND_EASY",
 "ANOTHERFLAG"

],

"reversible"
    "reversible": false,         

Can be disassembled.

time fields

"time"

Preferred example:

    "time": "5 m",               

Preferred time to perform recipe, can specify in minutes, hours etc. The deprecated time to perform recipe does not include unit (where 1000 ~= 10 turns ~= 10 seconds game time).

Deprecated example:

    "time": 5000,                
"batch_time_factors"
    "batch_time_factors": [25, 15], 

Optional factors for batch crafting time reduction. First number specifies maximum crafting time reduction as percentage, and the second number the minimal batch size to reach that number. In this example given batch size of 20 the last 6 crafts will take only 3750 time units.


skill and learn fields

How the character acquires knowledge of the recipe and the ability to perform it.

"skill_used"
    "skill_used": "fabrication", 

Skill trained and used for success checks

"skills_required"
    "skills_required": [["survival", 1], ["throw", 2]], 

Skills required to unlock recipe

"difficulty"
    "difficulty": 3,             

Difficulty of success check

"book_learn"

(optional) Books that this recipe can be learned from.

ID of the book the recipe can be learned from

Skill level at which it can be learned

(optional) Name of the recipe as it should appear in the book's description (default is the name of resulting item of the recipe)

(optional) If set to true, recipe will not be shown in the description of the book

Additional book this recipe can be learnt from.

    "book_learn": {	             
        "textbook_anarch" : {    
            "skill_level" : 7,   
            "recipe_name" : "something", 
            "hidden" : true },   
        "textbook_gaswarfare" : { 
            "skill_level" : 8
        }
    },
"autolearn"

If set to true, automatically learned upon gaining required skills. If an array, learned upon gaining the skill levels indicated in the array.

Example 1:

    "autolearn": true,           

Example 2:

    "autolearn" : [              
        [ "survival", 2 ],
        [ "fabrication", 3 ]
    ],
"decomp_learn"
    "decomp_learn" : 4,        
 

Can be learned by disassembling an item of same type as result at this level of the skill_used

"decomp_learn" : [ Can be learned by disassembling an item of same type as result at specified levels of skills

   [ "survival", 1 ],
   [ "fabrication", 2 ]

],

"proficiencies" : [ The proficiencies related to this recipe

   {
     "proficiency": "prof_knapping", 

The id of a proficiency

     "required": false, 

Whether or not you must have the proficiency to craft it. Incompatible with `time_multiplier`

     "time_multiplier": 2.0 

The multiplier on time taken to craft this recipe if you do not have this proficiency

     "fail_multiplier": 2.5 

The multiplier on failure chance when crafting without this proficiency. Defaults to 2.5. Multiple proficiencies will multiply this value. (if all have the default, it's fail_multiplier ^ n, where n is the number of proficiencies that are lacked)

     "learning_time_multiplier": 1.2 

The multiplier on learning speed for this proficiency. By default, it's the time of the recipe, divded by the time multiplier, and by the number of proficiencies that can also be learned from it.

     "max_experience": "15 m" 

This recipe cannot raise your experience for that proficiency above 15 minutes worth.

   }

]


faction camp fields

    "construction_blueprint": "camp", 

an optional string containing an update_mapgen_id. Used by faction camps to upgrade their buildings

    "on_display": false,         

this is a hidden construction item, used by faction camps to calculate construction times but not available to the player

ingredient fields

These are the fields that indicate what tools, materials, components, etc are needed to complete the recipe

"qualities"

Generic qualities of tools needed to craft

    "qualities": [               
      { "id": "CUT", "level": 1, "amount": 1 }
    ],

"tools": [ Specific tools needed to craft [

 [ "fire", -1 ]             

Charges consumed when tool is used, -1 means no charges are consumed ]],

"using": [ Requirement IDs and multipliers of tools and materials used

 [ "req_a", 3 ],            

Second number multiplies requirement materials by that amount

 [ "req_b", 5 ],            

Need 3x everything in req_a, 5x everything in req_b ],

"components": [ Items (or item alternatives) required to craft this recipe

 [
   [ "item_a", 5 ]          

First ingredient: need 5 of item_a

 ],
 [
   [ "item_b", 2 ],         

Also need 2 of item_b...

   [ "item_c", 4 ]          

OR 4 of item_c (but do not need both)

 ],
 [
   

... any number of other component ingredients (see below)

 ]

]

Overlapping recipe component requirements

If recipes have requirements which overlap, this makes it more difficult for the game to calculate whether it is possible to craft a recipe at all.

For example, the survivor telescope recipe has the following requirements (amongst others):

    1 high-quality lens
    AND
    1 high-quality lens OR 1 small high-quality lens

These overlap because both list the high-quality lens.

A small amount of overlap (such as the above) can be handled, but if you have too many component lists which overlap in too many ways, then you may see an error during recipe finalization that your recipe is too complex. In this case, the game may not be able to correctly predict whether it can be crafted.

To work around this issue, if you do not wish to simplify the recipe requirements, then you can split your recipe into multiple steps. For example, if we wanted to simplify the above survivor telescope recipe we could introduce an intermediate item "survivor eyepiece", which requires one of either lens, and then the telescope would require a high-quality lens and an eyepiece. Overall, the requirements are the same, but neither recipe has any overlap.

See Also