Modding:Creating Recipes: Difference between revisions
From Vintage Story Wiki
Ninjanomnom (talk | contribs) m (Double checked information and added version) |
Craluminum (talk | contribs) (Added information about toolDurabilityCost, recipeGroup, requiresTrait and copyAttributesFrom) |
||
Line 164: | Line 164: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
=== Consuming more than one durability per tool === <!--T:35--> | |||
To balance durability consuming, it can be done by adding <code>toolDurabilityCost</code> and <code>isTool</code>. This is recipe for pulverizer pounder: | |||
<syntaxhighlight lang="json"> | |||
{ | |||
ingredientPattern: "HL_,CL_,_L_", | |||
ingredients: { | |||
"H": { type: "item", code: "hammer-*", isTool: true, toolDurabilityCost: 10 }, | |||
"C": { type: "item", code: "chisel-*", isTool: true, toolDurabilityCost: 10 }, | |||
"L": { type: "block", code: "log-placed-*-ud", name: "wood" } | |||
}, | |||
width: 3, | |||
height: 3, | |||
output: { type: "item", code: "pounder-oak", quantity: 1 } | |||
} | |||
</syntaxhighlight> | |||
<!--T: | === Separating recipes on the same handbook page === <!--T:36--> | ||
Sometimes amount of recipes for one item can become overwhelming, to separate important ones, it can be done by adding <code>recipeGroup</code>. These are recipes for wooden ladder: | |||
<syntaxhighlight lang="json"> | |||
{ | |||
ingredientPattern: "S_S SSS S_S", | |||
ingredients: { | |||
"S": { type: "item", code: "stick" } | |||
}, | |||
width: 3, | |||
height: 3, | |||
recipeGroup: 1, | |||
output: { type: "block", code: "ladder-wood-north", quantity: 3 } | |||
}, | |||
{ | |||
ingredientPattern: "P_P PSP P_P", | |||
ingredients: { | |||
"P": { type: "item", code: "plank-*" }, | |||
"S": { type: "item", code: "stick" } | |||
}, | |||
width: 3, | |||
height: 3, | |||
output: { type: "block", code: "ladder-wood-north", quantity: 3 } | |||
} | |||
</syntaxhighlight> | |||
=== Restricting to a specific class === <!--T:37--> | |||
The recipe can be limited to a specific [[Classes|class]]. This can be done by adding <code>requiresTrait</code>. This is recipe for sewing kit: | |||
<syntaxhighlight lang="json"> | |||
{ | |||
ingredientPattern: "FFS FF_", | |||
requiresTrait: "clothier", | |||
ingredients: { | |||
"F": { type: "item", code: "flaxtwine" }, | |||
"S": { type: "item", code: "stick" } | |||
}, | |||
width: 3, | |||
height: 2, | |||
output: { type: "item", code: "sewingkit" } | |||
} | |||
</syntaxhighlight> | |||
=== Copying attributes === <!--T:38--> | |||
Some recipes can require to copy attributes. This is can be done by adding <code>copyAttributesFrom</code>. This is recipe for labeled crate: | |||
<syntaxhighlight lang="json"> | |||
{ | |||
ingredientPattern: "S,C", | |||
ingredients: { | |||
"S": { type: "item", code: "paper-parchment" }, | |||
"C": { type: "block", code: "crate" } | |||
}, | |||
shapeless: true, | |||
copyAttributesFrom: 'C', | |||
width: 1, | |||
height: 2, | |||
output: { type: "block", code: "crate", attributes: { label: "paper-empty" } } | |||
} | |||
</syntaxhighlight> | |||
<!--T:39--> | |||
{{Navbox/modding|Vintage Story}} | {{Navbox/modding|Vintage Story}} | ||
</translate> | </translate> |