Automation (integrations) - ihsoft/TimberbornMods GitHub Wiki
This guide covers Advanced Automation 4.12.0 for Timberborn 1.1, released on November 10th, 2026. These integrations are not included in Advanced Automation 4.0.11 for Timberborn 1.0.
Integrating other mods
Advanced Automation can expose a mod's existing properties and methods as signals and actions through JSON configuration. You do not need to compile against Automation, include its DLL or helper sources, or call registration and update APIs. Players use these capabilities in the rule constructor or scripts.
This guide explains the practical workflow. The complete JSON contract for 4.12.0 documents every field, supported signature, value conversion, and error case.
Package the configuration
Place an AutomationHooks*.json file alongside your mod's manifest in the selected version directory, for example:
YourMod/
version-1.1/
manifest.json
AutomationHooks.YourMod.json
Do not place it inside Scripts or outside the version directory. For an unversioned mod, use the mod directory itself.
Automation scans enabled mods once per world load, without searching subdirectories. Reload the world after edits.
Provide referenced localization keys through your mod's normal localization files.
Do not add a required Automation dependency just for this optional integration. Without Automation, these files are unused. A separate compatibility mod can also supply configuration for another loaded mod. If the named assembly is absent, Automation skips that target and logs an informational message.
Real example: Moddable Weathers
Automation ships the complete Moddable Weathers configuration.
It is a full working example, not a template requiring a separate integration mod. Enable Automation and Moddable Weathers
to obtain the global signal Mods.ModdableWeathers.Season.
The file declares provider ModdableWeathers, targeting ModdableWeathers.Cycles.WeatherCycleService in assembly
ModdableWeathers. The omitted Scope defaults to Singleton: Automation uses the existing game service.
The important signal declaration is:
"Id": "Season",
"NameLocKey": "IgorZ.Automation.Scriptable.Weather.Signal.Season",
"Read": "CurrentStage.Stage.Weather.Id"
Provider ID plus signal ID produces Mods.ModdableWeathers.Season. NameLocKey supplies the localized label;
the editor separately shows ModdableWeathers as the origin. The read path returns the current weather ID.
With no explicit Watch, Automation watches the setter of the first property, CurrentStage.
The signal's Value.OptionsSource gets dropdown entries from the weather registry:
{
"Assembly": "ModdableWeathers",
"Type": "ModdableWeathers.Weathers.ModdableWeatherRegistry",
"Read": "Weathers",
"ValuePath": "Id",
"NameLocKeyPath": "Spec.NameLocKey"
}
These choices are captured during world initialization, not continuously refreshed. Scripts use the stored IDs;
the constructor displays localized weather names. Select a weather there to obtain the correct script value.
The built-in Weather.Season remains separate, and old rules using it are not automatically rewritten.
Describe your own source
Use the exact assembly name without .dll and the full CLR type name, verified from the target mod's source or assembly.
Configuration references existing objects; it does not create services or attach components.
| Scope | Source | Availability |
|---|---|---|
Singleton (default) |
Existing singleton in the game's service container | Global |
Static |
Static members of the named type | Global |
Building |
Component on the rule owner's building | Only buildings with that component |
Provider and capability IDs must start with an ASCII letter and contain only ASCII letters and digits. They are case-sensitive and form saved script identities, so keep them stable across updates. The first successful registration of a given provider/capability/kind wins; later duplicates do not override it.
Read accepts properties and explicitly marked parameterless methods, such as GetPressure(), but not fields, indexers,
method arguments, or arbitrary expressions. The final value must be bool, int, float, double, or string.
Expose a conversion getter in your mod for enums or other unsupported types.
Make changes observable
A readable value alone is not enough for a useful signal. Watch names properties whose managed setters are called
when that value may change. It defaults to the first property of Read; a method-based read needs an explicit watch list.
Watching an outer property does not automatically observe independent changes inside a nested object.
Automation samples subscribed values at the end of the frame and notifies rules only when the converted value changes. Several setter calls can become one observation: intermediate states are not guaranteed. Use a counter for repeated events. Getters must be cheap, side-effect free, and safe at that time; configured members must be used on the game thread.
There is no polling fallback. Watch: [] is not a workaround for a missing notification: subscribed reads use a cached
baseline and do not keep a changing value fresh. Direct backing-field writes do not call a setter and therefore do not
notify Automation. Verify actual setter interception in game.
Expose actions and value controls
An action declares its Id, NameLocKey, target Method, and ordered Arguments. The method must return void.
Each argument specifies its exact CLR Type; the number, order, and types must match the method signature, including
parameters that have C# defaults. The constructor supports separate controls for multiple arguments.
Optional argument NameLocKey fields label those controls, while the action label can use {0}, {1}, and so on.
See the contract's complete signal-and-action example
for a minimal file with localization records. Unlike the shipped Moddable Weathers integration, its ExampleMod service
is illustrative: it must be replaced with an actual source and matching method in your mod.
Important value conventions:
- Booleans appear as On/Off and use script numbers
1/0. - Floating-point values use the scripting engine's two-decimal precision;
doubledoes not add precision. Percent: truechanges display formatting, not units:0.75means 75%, including in bounds and scripts.MinandMaxconstrain editor inputs, not runtime values. Your action still owns its runtime validation.- String values can use fixed
Optionsor anOptionsSource, but not both. Dynamic options are captured once at initialization.
Validate the integration
Check the packaged JSON and localization files, then test the intended Automation and provider versions in game:
- Load a world and check registration logs and the signal/action labels, origin, scope, and argument controls.
- Change real provider state and confirm notifications, including action-driven changes and repeated same-value assignments.
- Save and reload; verify restored rules and provider state. Automation saves its signal baseline, not your mod's state.
- For building scope, verify that two buildings remain independent.
- Disable the optional target mod and confirm the integration is skipped normally.
Unknown JSON fields reject the entire file. Missing types or members in a loaded assembly indicate an invalid or incompatible declaration, unlike an absent optional assembly. Fix the configuration and reload the world. A successful JSON parse or registration does not prove that runtime changes are being observed.