IGearsModApi
The callback contract a C# mod implements to be told about its settings.
public interface IGearsModApiThe callback contract a C# mod implements to be told about its settings. Gears scans every assembly of a mod for concrete classes implementing this interface, instantiates each through its public parameterless constructor, and invokes every callback on every instance. See the Get Started with C# guide for the order and timing.
Methods
InitMod(IGearsMod)
void InitMod(IGearsMod modInstance);Called at GameAwake once every mod's ModSettings.xml has been parsed, and before the player's saved global values are restored. Create settings from code here, and bind settings classes here.
The settings tree already holds everything ModSettings.xml declared, so GetOrCreateTab / GetOrCreateSetting hand back the XML's objects and anything this callback assigns onto them wins. A setting declared in both places must use the same type in both, or GetOrCreateSetting throws.
Because every setting exists by now, this is also where to call BindSettingsClass, for global and world settings alike. Values are not final yet - the saved global values are restored after this returns, silently - so ask for them with SyncSettingsToClass in OnGlobalSettingsLoaded rather than reading them here.
OnGlobalSettingsLoaded(IModGlobalSettings)
void OnGlobalSettingsLoaded(IModGlobalSettings modSettings);Called once every mod's ModSettings.xml has been parsed and the player's saved global values restored. Global values are final from here.
OnWorldSettingsLoaded(IModWorldSettings)
void OnWorldSettingsLoaded(IModWorldSettings worldSettings);Called when a world's settings become known: on world start when hosting, when the server's settings arrive when joining, or after a reset to defaults when the server sent none. May fire more than once per session. Not called for a mod with no world settings, and not called on the host for the Empty and Playtesting worlds the prefab editor uses.