Upcoming API to enable easier Timberborn modding
Currently has the following features:
- Bind your code to Timberborn to allow Dependency Injection. Supports InGame, MainMenu, and MapEditor
- Listen to any event. Extend the Listener class and use
[OnEvent]
- Add labels to localization
Wiki (with general Timberborn modding info too! Wiki Link
To use this API, add this BepInEx annotation:
[BepInDependency("com.timberapi.timberapi")]
- Create a configurator and bind your class:
public class ExampleConfigurator : IConfigurator {
public void Configure(IContainerDefinition containerDefinition) {
containerDefinition.Bind<ExampleListener>().AsSingleton();
}
}
- Register it with the game
TimberAPI.Dependencies.AddConfigurator(new ExampleConfigurator());
- Extend the TimberAPI Listener class, which will automatically hook the eventbus
- Listen to an event with
[OnEvent
public class ExampleListener : Listener {
[OnEvent]
public void OnDroughtStarted(DroughtStartedEvent droughtStartedEvent) {...}
- Register your class with the game through a configurator (see Dependency Injection)
- Add a label
TimberAPI.Localization.AddLabel("ExampleMod.ToolGroups.ExampleToolGroup", "Example Label");
See ExamplePlugin for more examples