Modding:Load Order

From Vintage Story Wiki
Jump to navigation Jump to search

Most code mods will work fine when loaded by the game at the default time.

However, ModSystems can specify a particular place in the pipeline when they should be loaded by the game, by overriding the method ModSystem.ExecuteOrder() and returning a value between 0.0 and 1.0, inclusive.

The following are some example mod systems from the base game and when they are loaded (from the API comments on 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;
        }

To provide a concrete example, if you would like your ModSystem to be loaded as early as possible in the game's pipeline, you could configure your code similar to the following:

    public class ExampleMod : ModSystem
    {
        public override double ExecuteOrder() => 0;
        //...
    }


Main Page: Modding
Green Items require C# coding
Basics

Getting Started | Mod Types | Simple Examples

Asset System | Textures | Items | Recipes | Blocks | Model Creator | Animation Basics | VTML & Icons | Mod Packaging & Release | Modinfo | Debugging

Advanced

JSON Patching | Advanced JSON Items | The Remapper | Server-Client Considerations

Setting Up Your Development Environment (General - Windows - Linux)

Advanced Blocks | Advanced Items | Item-Block Interactions | Block Behavior | Block Entities | Particle Effects | World Access | Inventory Handling | Chat Commands | GUIs | Server-Client Networking | Monkey patching (Harmony)

Data Management

Savegame Data Storage | ModConfig File | Chunk Data Storage | Tree Attribute

Worldgen

WorldGen Concepts | Terrain | Ores | Trees | WorldGen API

Rendering

Shaders and Renderers

Property Overview

Item | Entity | Block | Block Behaviors | Block Classes | Block Entities | Block Entity Behaviors

Workflows & Infrastructure

Modding Efficiency Tips | Mod Extensibility | Load Order

Additional Resources

List of server commands | List of client commands | Client startup parameters | Creative Starter Guide | ServerBlockTicking | Bot System | WorldEdit | Cinematic Camera

Example Mods | API Docs | GitHub Repository