Моддинг: Порядок загрузки

From Vintage Story Wiki
This page is a translated version of the page Modding:Load Order and the translation is 100% complete.
Other languages:

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


Большинство кода модов будут нормально работать при загрузке игрой в обычных условиях.

Однако ModSystems может указать конкретное место в конвейере, когда они должны быть загружены игрой, переопределив метод ModSystem.ExecuteOrder() и возвращая значение от 0,0 до 1,0 включительно.

Ниже приведены некоторые примеры систем модов из базовой игры и при их загрузке (из комментариев API на ModSystem. ExecuteOrder):

        /// <summary>
        /// If you need mods to be executed in a certain order, adjust this methods return value.
        /// The server will call each Mods StartPre() & Start() methods in ascending order of each mods execute order value. And thus, as long as every mod registers it's event handlers in the Start() method, all event handlers will be called in the same execution order.
        /// Default execute order of some survival mod parts
        /// Worldgen:
        /// - GenTerra: 0 
        /// - RockStrata: 0.1
        /// - Deposits: 0.2
        /// - Caves: 0.3
        /// - Blocklayers: 0.4
        /// Asset Loading
        /// - Json Overrides loader: 0.05
        /// - Load hardcoded mantle block: 0.1
        /// - Block and Item Loader: 0.2
        /// - Recipes (Smithing, Knapping, Clayforming, Grid recipes, Alloys) Loader: 1
        /// </summary>
        /// <returns></returns>
        public virtual double ExecuteOrder()
        {
            return 0.1;
        }

Чтобы привести конкретный пример, если вы хотите, чтобы ваша ModSystem загружалась как можно раньше в игровой конвейер, вы можете настроить свой код следующим образом:

    public class ExampleMod : ModSystem
    {
        public override double ExecuteOrder() => 0;
        //...
    }
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.