Модинг:Система ассетов

From Vintage Story Wiki
Revision as of 15:44, 12 July 2020 by NlgEndlessplay (talk | contribs) (Достаточно сложный для понимания и перевода участок, если кто-то сможет перевести или сформулировать лучше, буду рад. / It’s a difficult enough place for understanding and translation, if someone can translate or formulate it better, I’ll be glad.)

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


Vintage Story загружает большую часть игрового контента из JSON файлов. Многие примеры этого можно найти в каталоге assets внутри вашей папки с игрой. Такие вещи, как блоки, предметы, генерация мира, рецепты и т. Д., Загружаются из ресурсов во время запуска.

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

Все действующие ресурсы для Vintage Story видны в папке с игрой, что позволяет вам просматривать их и учиться писать свои собственные. Вы можете найти эти файлы, используя следующие методы для каждого типа ОС, на которой вы играете в Vintage Story. Если вы ищете исходный код (то есть классы C#), ваш лучший вариант - погрузиться в Vintage Story Github и просмотреть репозитории vsapi, vssurvivalmod, vsessentialsmod и vscreativemod для ссылок на классы.

Windows

Если вы используете Vintage Story в Windows, вы можете перейти к нужной папке, набрав %appdata% в строке поиска в меню пуск, и вы попадете в папку roaming вашего компьютера. Найдите папку Vintagestory, и вы сразу же наткнетесь на папку ресурсов, которая содержит ресурсы "creative", "game" и "survival".

  • creative содержит ресурсы только для творческого режима.
  • game содержит много универсальных ресурсов, таких как файлы lang, модели объектов и другие важные ресурсы для игры.
  • survival содержит большую часть фактического контента, с которым сталкивается большинство игроков, и содержит все ресурсы, используемые Vintage Story, такие как текстуры звуков и генерация мира.

Список типов активов

Ниже приведены категории ресурсов, которые вы можете использовать при моддинге для Vintage Story. Каждый из них легко модифицируем и может быть использован для простого добавления собственного контента или изменений без необходимости какого-либо сложного кодирования. Вы также можете прочитать примеры, чтобы узнать, что вы можете с ними сделать.

Name Affects Gameplay Side Type Usage
AssetCategory
blocktypes
true universal Defines all the blocks that are in the game
itemtypes
true universal Defines all the Items that are in the game
lang
false universal Translation
worldproperties
true universal Contains some commonly used lists of properties
abstract
true universal
block
true universal
sounds
false universal Sounds
shapes
false universal Contains the 3d models for all the items, blocks and creatures
config
true universal Used for generic data that does not fit into the other categories.
block
false universal Shapes for blocks
entity
false universal Shapes for entities
item
false universal Shapes for items
recipes
true server only The crafting, knapping, smithing and clay forming recipes
alloy
true server only How metals can be combined to create alloys
grid
true server only Recipes for 3x3 grid crafting
smithing
true server only Recipes for smithing on the anvil
worldgen
true server only Contains all the configuration for world generation
terrain
true server only Defines how the terrain should look and with what it should be decorated with
tree
true server only Defines the shapes of trees
entity
true server only Creatures and other entities
shaders
false client only Contains GLSL source code, that defines how the game is rendered
shaderincludes
false client only Contains GLSL source code, that defines how the game is rendered
textures
false client only Contains all the graphics of the game
block
false client only Block textures
item
false client only Item textures
decal
false client only Decaltextures
entities
false client only Entities textures
environment
false client only Environment textures (Sky, Moon, Sun, etc.)
gui
false client only Gui textures
hud
false client only Hud textures
particle
false client only Particle textures
music
false client only The games music tracks and its configuration
dialog
false client only Contains some of the dialog layouts

Домены

Домены используются для отделения мод-контента от оригинального. По сути, домен - это префикс для любого заданного кода (идентификатор элемента, блока и т.д.) Или пути (текстуры, звуки и т.д.). Сама по себе Vintage Story имеет свой собственный префикс game.

Когда пакуете мод вы указываете домен, помещая каталог в каталог мода assets со всеми вашими активами мода внутри. Имя каталога вашего домена будет «текущим доменом» для всех активов в нем. Если в коде ресурса не указан домен, игра предположит, что он находится в текущем домене, то есть вам нужно добавить префикс домена только в том случае, если вы хотите сослаться на что-то за пределами текущего домена.

For example, if you want to create a new block which uses the original leather texture, you would have to specify the domain (since your block has a different one). Instead of using assets/textures/blocks/leather.png, you would have add the prefix for the domain game:assets/textures/blocks/leather.png.


Overwriting assets

There are no limitations to the system. So you can overwrite assets from Vintagestory itself by using the game domain folder.

To overwrite the bed blocktype you can put your own json flie inside your mod zip archive with the following path: assets/game/blocktypes/bed.json. So Vintagestory will load your json file instead of the original one.

Theme packs can only override assets that do not effect game mechanics, the other mod types can override any asset.

Accessing assets in code

To access assets in a code mod, you can use the AssetManager.

Moving Forward

Once you have an idea of what assets are and how they're organized, it's time to move onto your first content mod. Head over to the Basic Block page to learn how to make your first block, or go to the Basic Item page if you'd like to start by making an item. Both are great ways to learn how to make your first mod.

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