Available Callbacks

General

  • void Main() - called once when the plugin is loaded, enabled or reloaded.
  • void OnDisabled() - called when the plugin is disabled, removed or the game is closing.
  • void Render() - called on every game frame. You can use this function to render standalone UI windows. To determine how much time has passed since the last frame, use Time::Now.
  • void OnGameStateChanged(TM::GameState state) - called when the game state changes.
  • PluginInfo@ GetPluginInfo() - called before Main(), this function should only return a PluginInfo object with information about the plugin. Any init logic should be contained within the Main() function, and not in this function. This function is required to be implemented.

Race

  • void OnRunStep(SimulationManager@ simManager) - called on every race step (when in normal race). Note that OnRunStep will be called before the race begins (simManager.RaceTime < 0) and after it ends (simManager.TickTime > simManager.RaceTime).

Simulation

  • void OnSimulationBegin(SimulationManager@ simManager) - called when the simulation begins (when clicking the Validate button in the Replays menu).
  • void OnSimulationStep(SimulationManager@ simManager, bool userCancelled) - called on every simulation step. userCancelled switches to true and if the user cancelled the simulation. The value stays true until the next OnSimulationBegin call.
  • void OnSimulationEnd(SimulationManager@ simManager, SimulationResult result) - called when the simulation ends (that matches the OnSimulationBegin call).

Race & simulation events

  • void OnCheckpointCountChanged(SimulationManager@ simManager, int current, int target) - called when a new checkpoint is passed. Inspect simManager.PlayerInfo.CheckpointStates to get which checkpoint has been just passed. While the condition current == target can be used to determine if the race has finished, it is recommended to evaluate simManager.PlayerInfo.RaceFinished instead.

  • void OnLapCountChanged(SimulationManager@ simManager, int current, int target) - called when a new lap is passed.