Modding:Creating Recipes/ru: Difference between revisions

From Vintage Story Wiki
change separator (tab to comma)
(Created page with "Прежде чем создавать рецепты, рекомендуем сначала прочитать Основа предмета, чтобы пон...")
(change separator (tab to comma))
(29 intermediate revisions by 2 users not shown)
Line 1: Line 1:


Прежде чем создавать рецепты, рекомендуем сначала прочитать [[Basic Item|Основа предмета]], чтобы понять этот учебник.
Прежде чем создавать рецепты, рекомендуем сначала прочитать [[Basic Item|Основа предмета]], чтобы понять это руководство.


== Basics ==
== Основы ==


Let's create a recipe for our wand, which we added in [[Basic Item|basic items]] tutorial.  
Давайте создадим рецепт для нашей палочки, который мы добавили в руководстве [[Basic Item|основа предмета]].  


=== Ingredient Pattern ===
=== Шаблон ингредиентов ===


Let's begin by declaring the pattern or layout of the recipe, in our example we'll want the player to place a pickaxe on top of 2 sticks
Давайте начнем с объявления шаблона или макета рецепта, в нашем примере мы хотим, чтобы игрок поместил кирку поверх двух палочек.


[[File:Recipe Wand Pickaxe.png]]
[[File:Recipe Wand Pickaxe.png]]


which would look like this:
который будет выглядеть так:
<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> and <code>S</code> are identifiers which will be defined later. Every row is separated with a tab, while an empty cell is marked with an underscore <code>_</code>. The <code>width</code> of this recipe is <code>1</code> and it is <code>3</code> rows high. Don't put spaces between the cells for example <code>_ P _</code> is 5 not 3 cells.
<code>P</code> и <code>S</code> являются идентификаторами, которые будут определены позже. Каждая строка разделена запятой, а пустая ячейка помечена подчеркиванием <code>_</code>. <code>Ширина</code> этого рецепта <code>1</code> и в нем <code>3</code> строки. Не ставьте пробелы между ячейками, например <code>_ P _</code> это 5, а не 3 ячейки.


=== Ingredients ===
=== Ингредиенты ===


All we need to do now is to define the identifiers we have used before. In our example <code>P</code> stands for a copper pickaxe and <code>S</code> for an ordinary stick.
Все, что нам нужно сделать сейчас, это определить идентификаторы, которые мы использовали ранее. В нашем примере <code>P</code> обозначает медную кирку, а <code>S</code> - обычную палку.


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


<code>Type</code> is either <code>block</code> or <code>item</code> depending whether it's an item or a block.
<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