Modding:Creating Recipes/ru: Difference between revisions
From Vintage Story Wiki
(change separator (tab to comma)) |
(Updating to match new version of source page) |
||
Line 1: | Line 1: | ||
<languages/> | |||
{{GameVersion|1.16}} | |||
Прежде чем создавать рецепты, рекомендуем сначала прочитать [[Basic Item|Основа предмета]], чтобы понять это руководство. | Прежде чем создавать рецепты, рекомендуем сначала прочитать [[Basic Item|Основа предмета]], чтобы понять это руководство. | ||
Line 4: | Line 6: | ||
== Основы == | == Основы == | ||
Давайте создадим рецепт для нашей палочки, который мы добавили в руководстве [[Basic Item|основа предмета]]. | <div class="mw-translate-fuzzy"> | ||
Давайте создадим рецепт для нашей палочки, который мы добавили в руководстве [[Basic Item|основа предмета]]. | |||
</div> | |||
=== Шаблон ингредиентов === | === Шаблон ингредиентов === | ||
Line 12: | Line 16: | ||
[[File:Recipe Wand Pickaxe.png]] | [[File:Recipe Wand Pickaxe.png]] | ||
<div class="mw-translate-fuzzy"> | |||
который будет выглядеть так: | который будет выглядеть так: | ||
<syntaxhighlight lang="json"> | <syntaxhighlight lang="json"> | ||
Line 18: | Line 23: | ||
height: 3, | height: 3, | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</div> | |||
<div class="mw-translate-fuzzy"> | |||
<code>P</code> и <code>S</code> являются идентификаторами, которые будут определены позже. Каждая строка разделена запятой, а пустая ячейка помечена подчеркиванием <code>_</code>. <code>Ширина</code> этого рецепта <code>1</code> и в нем <code>3</code> строки. Не ставьте пробелы между ячейками, например <code>_ P _</code> это 5, а не 3 ячейки. | <code>P</code> и <code>S</code> являются идентификаторами, которые будут определены позже. Каждая строка разделена запятой, а пустая ячейка помечена подчеркиванием <code>_</code>. <code>Ширина</code> этого рецепта <code>1</code> и в нем <code>3</code> строки. Не ставьте пробелы между ячейками, например <code>_ P _</code> это 5, а не 3 ячейки. | ||
</div> | |||
=== Ингредиенты === | === Ингредиенты === | ||
Line 74: | Line 82: | ||
Вот как выглядит наш последний рецепт: | Вот как выглядит наш последний рецепт: | ||
<div class="mw-translate-fuzzy"> | |||
<syntaxhighlight lang="json"> | <syntaxhighlight lang="json"> | ||
{ | { | ||
Line 86: | Line 95: | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</div> | |||
Чтобы добавить эти рецепты для крафта в ваш мод, вам нужно создать еще одну папку в вашем рабочем пространстве <code>assets/myadvancedwand/recipes/grid/</code> и скопировать туда файлы. | Чтобы добавить эти рецепты для крафта в ваш мод, вам нужно создать еще одну папку в вашем рабочем пространстве <code>assets/myadvancedwand/recipes/grid/</code> и скопировать туда файлы. | ||
<div class="mw-translate-fuzzy"> | |||
Вы можете скачать полный мод, включая предметы [[Media:MyWandRecipe.zip|здесь]]. | Вы можете скачать полный мод, включая предметы [[Media:MyWandRecipe.zip|здесь]]. | ||
</div> | |||
== Продвинутые рецепты == | == Продвинутые рецепты == | ||
Line 95: | Line 107: | ||
=== Типовые рецепты === | === Типовые рецепты === | ||
<div class="mw-translate-fuzzy"> | |||
Есть более сложные вещи, которые вы можете сделать с рецептами. Это рецепт для деревянных досок, которые сделаны из бревен: | Есть более сложные вещи, которые вы можете сделать с рецептами. Это рецепт для деревянных досок, которые сделаны из бревен: | ||
<syntaxhighlight lang="json"> | <syntaxhighlight lang="json"> | ||
Line 107: | Line 120: | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</div> | |||
Вместо того, чтобы иметь рецепт для каждого типа древесины, вы можете назначить имя ингредиенту (в данном случае это <code>name: "wood"</code>), и все обозначенное <code>*</code>, позже будет заменено на выходе. Значение <code>{wood}</code> будет заменено типом используемого дерева. | Вместо того, чтобы иметь рецепт для каждого типа древесины, вы можете назначить имя ингредиенту (в данном случае это <code>name: "wood"</code>), и все обозначенное <code>*</code>, позже будет заменено на выходе. Значение <code>{wood}</code> будет заменено типом используемого дерева. | ||
<div class="mw-translate-fuzzy"> | |||
Например, если бы у нас был блок бревна березы, его код был бы <code>log-birch-ud</code>, поэтому <code>*</code> будет означать <code>birch</code>, поэтому выходные данные будут преобразованы из <code>code: "planks-{wood}"</code> в <code>code: "planks-birch"</code>. | Например, если бы у нас был блок бревна березы, его код был бы <code>log-birch-ud</code>, поэтому <code>*</code> будет означать <code>birch</code>, поэтому выходные данные будут преобразованы из <code>code: "planks-{wood}"</code> в <code>code: "planks-birch"</code>. | ||
</div> | |||
<div class="mw-translate-fuzzy"> | |||
{{Navbox/modding|Vintage Story}} | |||
</div> | |||
Continuing with the honey-sulfur poultice example, a bowl of honey as an ingredient looks like <code>"B": { type: "block", code: "bowl-honey" }</code>, but the player would lose the bowl if the recipe were written this way. We need to add <code>returnedStack</code> to the ingredient's properties and indicate which item to replace it with. In this case, the player should receive an empty bowl in place of the bowl of honey <code>returnedStack: { type: "block", code: "bowl-burned" }</code>. This property is placed alongside the <code>type</code> and <code>code</code> properties of an ingredient. Putting it all together: | |||
<syntaxhighlight lang="json"> | |||
{ | |||
ingredientPattern: "SBS,_L_", | |||
ingredients: { | |||
"L": { type: "block", code: "linen-*" }, | |||
"S": { type: "item", code: "powderedsulfur" }, | |||
"B": { | |||
type: "block", | |||
code: "bowl-honey", | |||
returnedStack: { type: "block", code: "bowl-burned" } | |||
} | |||
}, | |||
width: 3, | |||
height: 2, | |||
output: { type: "item", code: "poultice-linen-honey-sulfur", quantity: 4 } | |||
} | |||
</syntaxhighlight> | |||
=== Consuming more than one durability per tool === | |||
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> | |||
=== Separating recipes on the same handbook page === | |||
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 === | |||
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 === | |||
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> | |||
{{Navbox/modding|Vintage Story}} | {{Navbox/modding|Vintage Story}} |