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 aPluginInfo
object 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 thatOnRunStep
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 nextOnSimulationBegin
call.void OnSimulationEnd(SimulationManager@ simManager, SimulationResult result)
- called when the simulation ends (that matches theOnSimulationBegin
call).
Race & simulation events
-
void OnCheckpointCountChanged(SimulationManager@ simManager, int current, int target)
- called when a new checkpoint is passed. InspectsimManager.PlayerInfo.CheckpointStates
to get which checkpoint has been just passed. While the conditioncurrent == target
can be used to determine if the race has finished, it is recommended to evaluatesimManager.PlayerInfo.RaceFinished
instead. -
void OnLapCountChanged(SimulationManager@ simManager, int current, int target)
- called when a new lap is passed.