Enum SaveableLoadOrder
Defines when a modded saveable should load relative to base game saveables.
Override the S1API.Internal.Abstraction.Saveable.LoadOrder property in your S1API.Internal.Abstraction.Saveable class to control load timing.
public enum SaveableLoadOrder
- Extension Methods
Fields
AfterBaseGame = 1Load after base game saveables (default). Runs as a postfix after NPCsLoader.Load (one of the last loaders).
Use this when your mod data depends on base game entities being loaded first, such as:
- Storing references to NPCs, buildings, or vehicles
- Modifying base game entity states after they're loaded
- Most general-purpose mod saveables
This is the default behavior. If you don't override LoadOrder, your saveable will use AfterBaseGame. Base game entities are loaded when S1API.Internal.Abstraction.Saveable.OnLoaded is called.
BeforeBaseGame = 0Load before base game saveables. Runs as a prefix before BuildingsLoader.Load (one of the earliest loaders).
Use this when your mod data needs to be available before base game ISaveables load, such as:
- Setting up hooks that intercept base game load events
- Initializing global state that base game loaders depend on
- Advanced modding scenarios requiring early initialization
Important: When using BeforeBaseGame, base game entities (NPCs, buildings, vehicles) are not yet loaded when S1API.Internal.Abstraction.Saveable.OnLoaded is called.
Examples
public class MyCustomSaveable : Saveable
{
// Override to load BEFORE base game entities
public override SaveableLoadOrder LoadOrder => SaveableLoadOrder.BeforeBaseGame;
[SaveableField("my_data")]
private MyDataClass _myData = new MyDataClass();
}