Modding:Creating Recipes/ru: Difference between revisions

From Vintage Story Wiki
change separator (tab to comma)
(Created page with "<code>Type</code> является либо <code>block</code>, либо <code>item</code>, в зависимости от того, является ли он предмет...")
(change separator (tab to comma))
(19 intermediate revisions by 2 users not shown)
Line 14: Line 14:
который будет выглядеть так:
который будет выглядеть так:
<syntaxhighlight lang="json">
<syntaxhighlight lang="json">
ingredientPattern: "P S S",
ingredientPattern: "P,S,S",
width: 1,
width: 1,
height: 3,
height: 3,
</syntaxhighlight>
</syntaxhighlight>


<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 ячейки.


=== Ингредиенты ===
=== Ингредиенты ===
Line 34: Line 34:
<code>Type</code> является либо <code>block</code>, либо <code>item</code>, в зависимости от того, является ли он предметом или блоком.
<code>Type</code> является либо <code>block</code>, либо <code>item</code>, в зависимости от того, является ли он предметом или блоком.


When recipes have vanilla items they need <code>game:</code> in front of the item name. When they are from your own mod you can just put the item name.
Когда в рецептах есть ванильные предметы, им нужно <code>game:</code> перед названием предмета. Когда они из вашего собственного мода, вы можете просто поставить название предмета.


In order to find out the <code>code</code> of each item (or block), you can type <code>.edi</code> into console, which will add the code property to the tooltip:
Чтобы узнать <code>code</code> каждого предмета (или блока), вы можете ввести <code>.edi</code> в консоль, которая добавит свойство code в всплывающую подсказку:


[[File:Recipe Stick Tooltip.png]]
[[File:Recipe Stick Tooltip.png]]




Furthermore, we could add a required quantity to our ingredients, so instead of one stick per slot we could make it require more:
Кроме того, мы могли бы добавить необходимое количество к нашим ингредиентам, поэтому вместо одной палки на слот мы могли бы потребовать больше:


<syntaxhighlight lang="json">
<syntaxhighlight lang="json">
Line 50: Line 50:
</syntaxhighlight>
</syntaxhighlight>


Another thing we could do is instead of consuming the pickaxe, we could use it as a tool:
Еще одна вещь, которую мы могли бы сделать - вместо того, чтобы потреблять кирку, мы могли бы использовать ее как инструмент:


<syntaxhighlight lang="json">
<syntaxhighlight lang="json">
Line 59: Line 59:
</syntaxhighlight>
</syntaxhighlight>


This would cause the pickaxe to lose one durability during crafting, instead of consuming the whole pickaxe at once.
Это может привести к тому, что кирка потеряет одну прочность во время крафта, вместо того, чтобы потреблять всю кирку сразу.


=== Output ===
=== Возврат (выход) ===


We still need to define the output, which is rather similar to defining the ingredients:
Нам все еще нужно определить результат, который довольно похож на определение ингредиентов:
<syntaxhighlight lang="json">
<syntaxhighlight lang="json">
output: { type: "item", code: "wand-pickaxe"}
output: { type: "item", code: "wand-pickaxe"}
</syntaxhighlight>
</syntaxhighlight>


Theoretically, we could add the <code>quantity</code> property here as well.
Теоретически, мы могли бы также добавить свойство <code>quantity</code> (количество) здесь.


=== Distributing ===
=== Распространение ===


This is what our final recipe looks like:
Вот как выглядит наш последний рецепт:


<syntaxhighlight lang="json">
<syntaxhighlight lang="json">
{
{
ingredientPattern: "P S S",
ingredientPattern: "P,S,S",
width: 1,
width: 1,
height: 3,
height: 3,
Line 87: Line 87:
</syntaxhighlight>
</syntaxhighlight>


In order to add those crafting recipes to your mod, you have to create another folder in your workspace <code>assets/myadvancedwand/recipes/grid/</code> and copy the files in there.
Чтобы добавить эти рецепты для крафта в ваш мод, вам нужно создать еще одну папку в вашем рабочем пространстве <code>assets/myadvancedwand/recipes/grid/</code> и скопировать туда файлы.


You can download the full mod including the items [[Media:MyWandRecipe.zip|here]].
Вы можете скачать полный мод, включая предметы [[Media:MyWandRecipe.zip|здесь]].


== Advanced ==
== Продвинутые рецепты ==


=== Type based recipes ===
=== Типовые рецепты ===


There are more complicated things you can do with recipes. This the recipe for wooden planks which are crafted out of logs:
Есть более сложные вещи, которые вы можете сделать с рецептами. Это рецепт для деревянных досок, которые сделаны из бревен:
<syntaxhighlight lang="json">
<syntaxhighlight lang="json">
{
{
Line 108: Line 108:
</syntaxhighlight>
</syntaxhighlight>


Instead of having a recipe for every wood type, you can assign a name to an ingredient (in this case it is <code>name: "wood"</code>) and everything identified by <code>*</code> will later on replaced be for the output. Meaning <code>{wood}</code> will be replaced by the type of the giving log.
Вместо того, чтобы иметь рецепт для каждого типа древесины, вы можете назначить имя ингредиенту (в данном случае это <code>name: "wood"</code>), и все обозначенное <code>*</code>, позже будет заменено на выходе. Значение <code>{wood}</code> будет заменено типом используемого дерева.


For example if we would have a birch log block, its code would be <code>log-birch-ud</code>, so <code>*</code> would stand for <code>birch</code>, therefore the output will be converted from <code>code: "planks-{wood}"</code> to <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>.




{{Navbox/modding|Vintage Story}}
{{Navbox/modding|Vintage Story}}
Confirmedusers, editor
749

edits