Modding:Creating Recipes/ru: Difference between revisions

From Vintage Story Wiki
(Created page with "Кроме того, мы могли бы добавить необходимое количество к нашим ингредиентам, поэтому вместо од...")
(Created page with "Еще одна вещь, которую мы могли бы сделать - вместо того, чтобы потреблять кирку, мы могли бы испо...")
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">

Revision as of 19:54, 23 July 2020

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

Основы

Давайте создадим рецепт для нашей палочки, который мы добавили в руководстве основа предмета.

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

Давайте начнем с объявления шаблона или макета рецепта, в нашем примере мы хотим, чтобы игрок поместил кирку поверх двух палочек.

Recipe Wand Pickaxe.png

который будет выглядеть так:

	ingredientPattern: "P	S	S",
	width: 1,
	height: 3,

P и S являются идентификаторами, которые будут определены позже. Каждая строка разделена вкладкой, а пустая ячейка помечена подчеркиванием _. Ширина этого рецепта 1 и в нем 3 строки. Не ставьте пробелы между ячейками, например _ P _ это 5, а не 3 ячейки.

Ингредиенты

Все, что нам нужно сделать сейчас, это определить идентификаторы, которые мы использовали ранее. В нашем примере P обозначает медную кирку, а S - обычную палку.

	ingredients: {
		"P": { type: "item", code: "game:pickaxe-copper"},
		"S": { type: "item", code: "game:stick"}
	},

Type является либо block, либо item, в зависимости от того, является ли он предметом или блоком.

Когда в рецептах есть ванильные предметы, им нужно game: перед названием предмета. Когда они из вашего собственного мода, вы можете просто поставить название предмета.

Чтобы узнать code каждого предмета (или блока), вы можете ввести .edi в консоль, которая добавит свойство code в всплывающую подсказку:

Recipe Stick Tooltip.png


Кроме того, мы могли бы добавить необходимое количество к нашим ингредиентам, поэтому вместо одной палки на слот мы могли бы потребовать больше:

	ingredients: {
		"P": { type: "item", code: "game:pickaxe-copper"},
		"S": { type: "item", code: "game:stick", quantity: 2}
	},

Еще одна вещь, которую мы могли бы сделать - вместо того, чтобы потреблять кирку, мы могли бы использовать ее как инструмент:

	ingredients: {
		"P": { type: "item", code: "game:pickaxe-copper", isTool: true},
		"S": { type: "item", code: "game:stick"}
	},

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:

	output: { type: "item", code: "wand-pickaxe"}

Theoretically, we could add the quantity property here as well.

Distributing

This is what our final recipe looks like:

{
	ingredientPattern: "P	S	S",
	width: 1,
	height: 3,
	ingredients: {
		"P": { type: "item", code: "game:pickaxe-copper"},
		"S": { type: "item", code: "game:stick"}
	},
	output: { type: "item", code: "wand-pickaxe"}
}

In order to add those crafting recipes to your mod, you have to create another folder in your workspace assets/myadvancedwand/recipes/grid/ and copy the files in there.

You can download the full mod including the items here.

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:

{
	ingredientPattern: "L",
	ingredients: {
		"L": { type: "block", code: "game:log-*-ud", name: "wood" }
	},
	width: 1,
	height: 1,
	output: { type: "block", code: "planks-{wood}", quantity: 4  }
}

Instead of having a recipe for every wood type, you can assign a name to an ingredient (in this case it is name: "wood") and everything identified by * will later on replaced be for the output. Meaning {wood} will be replaced by the type of the giving log.

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


Icon Sign.png

Wondering where some links have gone?
The modding navbox is going through some changes! Check out Navigation Box Updates for more info and help finding specific pages.