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, useTime::Now.void OnGameStateChanged(TM::GameState state)- called when the game state changes.PluginInfo@ GetPluginInfo()- called beforeMain(), this function should only return aPluginInfoobject with information about the plugin. Any init logic should be contained within theMain()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 thatOnRunStepwill 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.userCancelledswitches to true and if the user cancelled the simulation. The value stays true until the nextOnSimulationBegincall.void OnSimulationEnd(SimulationManager@ simManager, SimulationResult result)- called when the simulation ends (that matches theOnSimulationBegincall).
Race & simulation events
-
void OnCheckpointCountChanged(SimulationManager@ simManager, int current, int target)- called when a new checkpoint is passed. InspectsimManager.PlayerInfo.CheckpointStatesto get which checkpoint has been just passed. While the conditioncurrent == targetcan be used to determine if the race has finished, it is recommended to evaluatesimManager.PlayerInfo.RaceFinishedinstead. -
void OnLapCountChanged(SimulationManager@ simManager, int current, int target)- called when a new lap is passed.