Modding:Developing a Content Mod/ru: Difference between revisions

From Vintage Story Wiki
(Created page with "Разработка Content Mod может быть простой, но необходимо правильно настроить определенные файлы и папки. Для получения дополнительной информации о том, чего можно достичь с помощью модификации контента, см. Content Mods.")
(Created page with "=== Папка с активами ===")
 
(22 intermediate revisions by the same user not shown)
Line 5: Line 5:
Разработка Content Mod может быть простой, но необходимо правильно настроить определенные файлы и папки. Для получения дополнительной информации о том, чего можно достичь с помощью модификации контента, см. [[Modding:Content Mods|Content Mods]].
Разработка Content Mod может быть простой, но необходимо правильно настроить определенные файлы и папки. Для получения дополнительной информации о том, чего можно достичь с помощью модификации контента, см. [[Modding:Content Mods|Content Mods]].


<div lang="en" dir="ltr" class="mw-content-ltr">
== Выбор IDE ==
== Selecting an IDE ==
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
При создании content mod вы, скорее всего, будете использовать много файлов в формате JSON. Хотя формат JSON удобен для чтения человеком, все же может оказаться полезным использовать '''Интегрированную Среду Разработки''' (IDE). Проще говоря, для модификации файлов JSON, IDE работает как необычный текстовый редактор, который помогает с форматированием.
When creating a content mod, you will likely be using a lot of JSON files. Although JSON is a human-readable format, it can still be beneficial to equip yourself with an '''Integrated Development Environment''' (IDE). Simply put, for the purpose of modifying JSON files, an IDE works as a fancy text editor that helps with formatting.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
Рекомендуется выбрать одну из приведенных ниже IDE.
It is recommended to select from one of the IDEs below.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
{| class="wikitable sortable"
{| class="wikitable sortable"
!Name
!Название
!Free?
!Бесплатно?
!Works on...
!Работает на...
!Recommended for '''''Code''''' Mods
!Рекомендуем для '''''Code''''' Mods
|-
|-
|[https://visualstudio.microsoft.com/vs/community/ Visual Studio] (Recommended)
|[https://visualstudio.microsoft.com/vs/community/ Visual Studio] (Рекомендуем)
|Yes - Community Edition
|Да - Community Edition
|Windows
|Windows
|Yes
|Да
|-
|-
|[https://code.visualstudio.com/?wt.mc_id=vscom_downloads Visual Studio Code]
|[https://code.visualstudio.com/?wt.mc_id=vscom_downloads Visual Studio Code]
|Yes
|Да
|Windows, macOS, Linux
|Windows, macOS, Linux
|Yes
|Да
|-
|-
|[https://www.jetbrains.com/rider/ JetBrains Rider]
|[https://www.jetbrains.com/rider/ JetBrains Rider]
|No
|Нет
|Windows, macOS, Linux
|Windows, macOS, Linux
|Yes
|Да
|-
|-
|[https://notepad-plus-plus.org/ Notepad++]
|[https://notepad-plus-plus.org/ Notepad++]
|Yes
|Да
|Windows
|Windows
|No
|Нет
|}
|}
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
== Шаблон/Пример настройки мода ==
== Template/Example Mod Setup ==
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
Если вы хотите заняться моддингом и не хотите вручную настраивать свои папки, есть два варианта. Файл '''template''' содержит modinfo, modicon и структуру папок для вашего мода. Файл '''example''' идентичен, однако содержит ряд существующих ресурсов, которые используются в руководствах wiki. Оба файла можно найти и загрузить c [https://github.com/Nateonus/vsmodexamples/releases/latest GitHub]. Просто распакуйте их в папку с модами вашей игры.  
If you want to get into modding and do not wish to manually setup your folders, there are two options. The ''template'' file contains a modinfo, modicon, and folder structure for your mod. The ''example'' file is identical, however contains a number of existing assets which are used within the wiki's tutorials. Both files can be found and downloaded [https://github.com/Nateonus/vsmodexamples/releases/latest from GitHub]. Simply unzip them into your game's mod folder.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
== Ручная настройка мода ==
== Manual Mod Setup ==
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
Если вы хотите самостоятельно настроить мод контента или хотите лучше разобраться в файлах, следуйте приведенным ниже инструкциям.  
If you wish to setup a content mod on your own, or want more understanding of the files, follow the instructions below.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
=== Рабочее пространство мода ===
=== Mod Workspace ===
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
Чтобы начать настройку вашего мода, перейдите к месту установки Vintage Story и войдите в папку mods. Создайте новую папку с названием вашего мода - в нее будут помещены все файлы, связанные с модом. Рекомендуется открыть эту папку в выбранной вами IDE.
To start setting up your mod, navigate to your Vintage Story install location, and enter the mods folder. Create a new folder with your mod's name - This will be where all mod-related files will be placed. It is recommended to open this folder in your selected IDE.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
'''Обратите внимание, что для создания файлов JSON может потребоваться изменить расширения файлов. Если вы не знаете, как это сделать, [https://www.indeed.com/career-advice/career-development/how-to-change-file-type следуйте этим инструкциям].'''
'''Note that creating JSON files may require changing file extensions. If you do not know how to do this, [https://www.indeed.com/career-advice/career-development/how-to-change-file-type follow these instructions].'''
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
=== ModInfo.json ===
=== ModInfo.json ===
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
Чтобы ваш мод был успешно загружен, вы должны передать Vintage Story о том, что наш мод существует, а также сообщить некоторые подробности о нем. Чтобы сделать это, создайте новый файл с именем '<nowiki/>''modinfo.json''' в вашей папке с модом, либо используя вашу IDE, либо через Windows. Обратите внимание, что этот файл нельзя создать во вложенной папке - он должен находиться в корневой папке вашего мода. Откройте файл и вставьте следующий json-код:
For your mod to successfully load, you have to tell Vintage Story that our mod exists, as well as some details about it. To do this, create a new file called '<nowiki/>''modinfo.json''' inside your mod workspace folder, either using your IDE or through Windows. Note that this cannot be created in a subfolder - It must be inside the root mod workspace folder. Open the file, and paste the following json code:
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
<syntaxhighlight lang="json">
<syntaxhighlight lang="json">
{
{
Line 95: Line 68:
}
}
</syntaxhighlight>
</syntaxhighlight>
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
Этот файл является очень хорошим примером того, как форматируется файл json, и вы заметите, что почти каждый ресурс использует этот формат. В файлах JSON содержится набор записей "ключ": "значение", что позволяет вам изменять эти значения в соответствии с желаемым. В этом случае следующие ключи представляют:
This file is a very good example of how a json file is formatted, and you will notice that nearly every asset uses this file format. Json files list a set of "key": "value" entries, allowing you to change those values to fit what is desired. In this case, the following keys represent:
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
* '''"type": "content"''' - Это говорит Vintage Story о том, что мод является типом content mod и должен загружать предоставленные ресурсы. Здесь доступны следующие варианты: "[[Modding:Theme Pack|theme]]", "[[Modding:Content Mods|content]]" или "code", однако для этого типа модов вы будете использовать "content".
* '''"type": "content"''' - This tells Vintage Story that the mod is a content mod, and should load the provided assets. The options here are "[[Modding:Theme Pack|theme]]", "[[Modding:Content Mods|content]]", or "code", however for this mod type you will use "content".
* '''"modid": "examplecontentmod"''' - Это ваш '''уникальный''' идентификатор мода (ID), который может представлять собой любую комбинацию '''строчных''' букв и цифр.
* '''"modid": "examplecontentmod"''' - This is your '''unique''' mod ID, which can be any combination of '''lowercase''' letters and numbers.
* '''"name": "..."''' - Это название вашего мода, и оно показывает, как он должен отображаться в игре. Обратите внимание, что это только для показа и не влияет на создаваемые вами ресурсы.
* '''"name": "..."''' - This is your mod's name, and displays how it should be displayed within the game. Note that this is just for display and does not affect the assets you create.
* '''"authors": [ "..." ]''' - Это ''массив'' авторов модов. Из-за того, что в этой записи используются квадратные скобки ('''[ ]''')''',''' это говорит о том, что это значение может принимать несколько значений, разделенных запятыми.
* '''"authors": [ "..." ]''' - This is an ''array'' of mod authors. Due to this entry using square brackets ('''[ ]''')''',''' it tells you that this value can accept multiple values, which are seperated by commas.
* '''"description": "..."''' - Это описание мода, которое будет показано на экране менеджера модов в игре.
* '''"description": "..."''' - This is the mod description, which will be shown on the mod manager screen in game.
* '''"version": "1.0.0"''' - Это версия вашего мода. Он соответствует формату "major.minor.patch", который называется [https://semver.org/ семантическое управление версиями].
* '''"version": "1.0.0"''' - This is your mod's version. It follows the format of "major.minor.patch", called [https://semver.org/ semantic versioning].
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
Также обратите внимание, что наш файл начинается и заканчивается фигурными скобками ('''{ }'''). Это говорит нам о том, что этот файл содержит '''одиночный''' объект. Если json-файл начинается с квадратных скобок ('''[ ]'''), это говорит нам о том, что вы можете включить несколько объектов в один файл.
Also note that our file starts and ends with curly brackets ('''{ }'''). This tells us that this file contains a ''single'' object. If a json file starts with square brackets ('''[ ]'''), this tells us that you can include multiple objects within that single file.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
Вы можете дополнить приведенные выше значения вашей собственной информацией о моде или оставить их прежними. В большинстве руководств на wiki будет использоваться этот (или очень похожий) файл modinfo.
You can fill in the values above with your own mod info, or keep them the same. Most tutorials on the wiki will use this (or a very similar) modinfo file.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
Это всего лишь базовый файл modinfo. Для получения дополнительной информации и более полного списка доступных свойств посетите страницу [[Modinfo]].
This is just a basic modinfo file. For more information, and a more comprehensive list of available properties, visit the [[Modinfo]] page.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
=== Modicon.png ===
=== Modicon.png ===
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
При желании файл с изображением под названием '<nowiki/>''modicon.png''' можно поместить или создать в корневой папке вашего рабочего пространства с модом. Он будет автоматически загружен в Vintage Story и отобразится рядом с вашим модом в меню mod manager.
If desired, an image file called '<nowiki/>''modicon.png''' can be placed or created inside the root folder of your mod workspace. This will automatically be loaded into Vintage Story, and be displayed next to your mod on the mod manager menu.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
=== Папка с активами ===
=== Assets Folder ===
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">

Latest revision as of 09:26, 5 July 2024

Other languages:

Эта страница проверялась в последний раз для версии Vintage Story 1.19.4.

Разработка Content Mod может быть простой, но необходимо правильно настроить определенные файлы и папки. Для получения дополнительной информации о том, чего можно достичь с помощью модификации контента, см. Content Mods.

Выбор IDE

При создании content mod вы, скорее всего, будете использовать много файлов в формате JSON. Хотя формат JSON удобен для чтения человеком, все же может оказаться полезным использовать Интегрированную Среду Разработки (IDE). Проще говоря, для модификации файлов JSON, IDE работает как необычный текстовый редактор, который помогает с форматированием.

Рекомендуется выбрать одну из приведенных ниже IDE.

Название Бесплатно? Работает на... Рекомендуем для Code Mods
Visual Studio (Рекомендуем) Да - Community Edition Windows Да
Visual Studio Code Да Windows, macOS, Linux Да
JetBrains Rider Нет Windows, macOS, Linux Да
Notepad++ Да Windows Нет

Шаблон/Пример настройки мода

Если вы хотите заняться моддингом и не хотите вручную настраивать свои папки, есть два варианта. Файл template содержит modinfo, modicon и структуру папок для вашего мода. Файл example идентичен, однако содержит ряд существующих ресурсов, которые используются в руководствах wiki. Оба файла можно найти и загрузить c GitHub. Просто распакуйте их в папку с модами вашей игры.

Ручная настройка мода

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

Рабочее пространство мода

Чтобы начать настройку вашего мода, перейдите к месту установки Vintage Story и войдите в папку mods. Создайте новую папку с названием вашего мода - в нее будут помещены все файлы, связанные с модом. Рекомендуется открыть эту папку в выбранной вами IDE.

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

ModInfo.json

Чтобы ваш мод был успешно загружен, вы должны передать Vintage Story о том, что наш мод существует, а также сообщить некоторые подробности о нем. Чтобы сделать это, создайте новый файл с именем 'modinfo.json' в вашей папке с модом, либо используя вашу IDE, либо через Windows. Обратите внимание, что этот файл нельзя создать во вложенной папке - он должен находиться в корневой папке вашего мода. Откройте файл и вставьте следующий json-код:

{
  "type": "content",
  "modid": "examplecontentmod",
  "name": "VS Wiki Example Content Mod",
  "authors": [
    "Nat @ Vintage Story Wiki"
  ],
  "description": "An example showcase of content mod additions.",
  "version": "1.0.0"
}

Этот файл является очень хорошим примером того, как форматируется файл json, и вы заметите, что почти каждый ресурс использует этот формат. В файлах JSON содержится набор записей "ключ": "значение", что позволяет вам изменять эти значения в соответствии с желаемым. В этом случае следующие ключи представляют:

  • "type": "content" - Это говорит Vintage Story о том, что мод является типом content mod и должен загружать предоставленные ресурсы. Здесь доступны следующие варианты: "theme", "content" или "code", однако для этого типа модов вы будете использовать "content".
  • "modid": "examplecontentmod" - Это ваш уникальный идентификатор мода (ID), который может представлять собой любую комбинацию строчных букв и цифр.
  • "name": "..." - Это название вашего мода, и оно показывает, как он должен отображаться в игре. Обратите внимание, что это только для показа и не влияет на создаваемые вами ресурсы.
  • "authors": [ "..." ] - Это массив авторов модов. Из-за того, что в этой записи используются квадратные скобки ([ ]), это говорит о том, что это значение может принимать несколько значений, разделенных запятыми.
  • "description": "..." - Это описание мода, которое будет показано на экране менеджера модов в игре.
  • "version": "1.0.0" - Это версия вашего мода. Он соответствует формату "major.minor.patch", который называется семантическое управление версиями.

Также обратите внимание, что наш файл начинается и заканчивается фигурными скобками ({ }). Это говорит нам о том, что этот файл содержит одиночный объект. Если json-файл начинается с квадратных скобок ([ ]), это говорит нам о том, что вы можете включить несколько объектов в один файл.

Вы можете дополнить приведенные выше значения вашей собственной информацией о моде или оставить их прежними. В большинстве руководств на wiki будет использоваться этот (или очень похожий) файл modinfo.

Это всего лишь базовый файл modinfo. Для получения дополнительной информации и более полного списка доступных свойств посетите страницу Modinfo.

Modicon.png

При желании файл с изображением под названием 'modicon.png' можно поместить или создать в корневой папке вашего рабочего пространства с модом. Он будет автоматически загружен в Vintage Story и отобразится рядом с вашим модом в меню mod manager.

Папка с активами

To actually create and modify game assets, Vintage Story searches for specific filepaths. Inside your mod workspace, create a folder called 'assets'.

Inside the new assets folder, create another new folder with the same name as your mod id. For example, my folder would be called 'examplecontentmod', as this is my mod id. This new folder is called a domain, and a single mod can be made up of a number of domains. Therefore, domains can actually have any name, but they must also be made from lowercase letters and numbers. This new folder is where your mod assets will be created! If a tutorial refers to your 'mod assets' folder, it is likely referring to this folder.

When your mod assets folder has been created, you are officially ready to start modding! Check out the 'What's Next' section to link to tutorials, and come back here when you need a reminder of how to organise your content mod.

Mod Domains

Each subfolder inside your mod's root assets folder dictates a mod domain. A domain works as an identifier to seperate assets from multiple mods, and must be made up of lowercase letters and numbers.

For example, imagine there exists two mods which both add in a new metal called 'Natium'. Without domains, Vintage Story would not be able to isolate these items based on the code alone, so it prefixes the domain to every asset. The code for Natium in Mod A now becomes "moda:natium", and the code for Mod B now becomes "modb:natium".

When creating content mods, you will access many different assets from inside your files, and it is important to understand how domains affect this. If you wish to reference an asset that exists in another domain, including the base game, you will need to prefix the reference with the domain ID. If you are referencing an asset in the same domain, you do not have to add a prefix to your reference.

For example, let us assume that 'Asset A' in the 'examplecontentmod' domain wishes to access the default copper texture, which is located at 'block/metal/ingot/copper'. If you use that asset location inside Asset A, Vintage Story will change it to "examplecontentmod:block/metal/ingot/copper', which will proceed to not work due to the file not existing in that domain. To counter this, you need to prefix the asset location manually with the default game prefix, and place it as "game:block/metal/ingot/copper". This can also be used with other mod domains to use assets from other mods.

Note that all base game assets are placed under the 'game' domain.

Publishing a Content Mod

If you want to distribute your mod for others to play, it is a good idea to pack your mod into a zip file. Most operating systems include functionality to zip a set of files, but the 7-zip program is a good alternative to this.

To pack your mod on Windows, select your modinfo, modicon, and assets folder, and right click on one of the files. In the context window, hover over "Send to", and then select "Compressed (zipped) folder". When entering a name for your zip file, most mods follow the format of "modid-version". This allows users of your mod to easily differentiate between versions of your created mod.

This article gives information on how to zip a set of files on other operating systems.

This file can then be uploaded for people to use on the Vintage Story ModDB.

After each publish, it is recommended to increase your version number in your modinfo file.

Updating a Content Mod to a new Game Version

When Vintage Story updates, it is highly unlikely that your content mod will need modifying. When a new major version is released, there may be rare instances where some formatting changes can cause side-effects, however these are very rare and would mainly happen when using more complex functionality.

What's Next?

Now your content mod has been setup, see what's next on the Content Mod page.

Content Modding
Basics Content Mods Developing a Content Mod
Tutorials
Concepts Modding Concepts Variants Domains Patching Remapping World Properties
Uncategorized
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.

Modding
Modding Introduction Getting Started Пакет тем
Content Modding Content Mods Developing a Content Mod Basic Tutorials Intermediate Tutorials Advanced Tutorials Content Mod Concepts
Code Modding Code Mods Setting up your Development Environment
Property Overview ItemEntityBlockBlock BehaviorsBlock ClassesBlock EntitiesBlock Entity BehaviorsWorld properties
Workflows & Infrastructure Modding Efficiency TipsMod-engine compatibilityMod ExtensibilityVS Engine
Additional Resources Community Resources Modding API Updates Programming Languages List of server commandsList of client commandsClient startup parametersServer startup parameters
Example ModsAPI DocsGitHub Repository