-
Notifications
You must be signed in to change notification settings - Fork 2
Using events
Leaxx edited this page Oct 25, 2024
·
4 revisions
Events provide a powerful mechanism for communication between different parts of your mod, other mods, the modloader, or even the game. The EventsManager allows scripts to subscribe to various events and respond accordingly. Let's explore how you can leverage these events to enhance the functionality of your mod.
- OnMenuLoad: Triggered when the in-game menu is loaded.
- OnLoadStart: Signifies the start of the game loading process.
- OnGameLoad: Indicates that the game has finished loading.
- OnGameUnload: Occurs when the game finishes unloading (player quits to menu)
- OnSave: Triggered when the game is saved.
- OnException: Triggered whenever any exception is thrown.
- OnTransaction: Occurs when the player commits any transaction.
- OnRouteGenerated: Fired when a travel route is generated.
- OnSettingsLoaded: Triggered when modloader settings are successfully loaded.
- OnSettingsSaved: Indicates that modloader settings have been saved.
- OnCustomObjectsRegisterFinished: Occurs after the registration of custom objects is completed.
- OnUILoadFinished: Fires when the JaLoader UI finishes loading.
You can subscribe to these events by using the += operator, and unsubscribe using -=. For example:
void Start()
{
EventsManager.Instance.OnTransaction += OnPlayerTransaction; // subscribe to it
}
void AnotherFunction()
{
EventsManager.Instance.OnTransaction -= OnPlayerTransaction; // unsubscribe from it
}- Full Linux guide
- Installing JaLoader via JaPatcher
- Installing mods
- Adding Custom Songs
- Custom Paintjobs