These are called in extensions. For example, the following module has some hooks:
local M = {}
M.onBeamNGTrigger = function(data)
-- ...
end
M.onUpdate = function()
-- ...
end
return M
- activated(anyPlayerSeated: boolean)
- onAiModeChange(vehicleID, newAiMode)
- onAttemptCompleted(attemptData: table)
- onAttemptFailed(attemptData: table)
- onBeamNGTrigger(data: table)
data = { subjectName = "thePlayer", subjectID = 17119, triggerName = "prestageTrigR", triggerID = 14814, triggerEvent = 0, event = "enter" or "exit", }
- onBeamNGWaypoint(args)
- onBeforeMountEntry(filename: string, mountPoint: string)
- onCameraModeChanged(name: string)
- onCameraToggled(data: table)
data = { cameraType = "GameCam" or "FreeCam", }
- onChatConnect()
- onChatMessage(user, channel, message: string)
- onClientPostStartMission(levelpath: string)
- onClientPreStartMission(levelpath: string)
- onClientStartMission(levelpath: string)
- onCountdownEnded()
- onCountdownStarted()
- onCouplerAttached(objId1, objId2, nodeId, obj2nodeId)
- onCouplerDetach(objId, nodeId)
- onCouplerDetached(objId1, objId2)
- onCouplerFound(nodeId, obj2id, obj2nodeId)
- onDebugDraw(focuspos: float3)
- onDebugDrawActive(focuspos: float3)
- onDrawDebug(focuspos: float3, dtReal: number, dtSim: number, dtRaw: number)
- onEditorActivated()
- onEditorAfterLoadPreferences()
- onEditorAfterNewLevel()
- onEditorAfterOpenLevel()
- onEditorAfterSaveLevel()
- onEditorAxisGizmoAligmentChanged()
- onEditorBeforeNewLevel()
- onEditorBeforeOpenLevel()
- onEditorBeforeSaveLevel()
- onEditorBeforeSavePreferences()
- onEditorCopy()
- onEditorCut()
- onEditorDeactivated()
- onEditorDeleteSelection()
- onEditorDeselect()
- onEditorDuplicate()
- onEditorEnabled()
- onEditorExitLevel()
- onEditorGui()
- onEditorGuiEditModesToolbar()
- onEditorGuiEditModeToolbar()
- onEditorGuiGeneralToolbar()
- onEditorGuiMainMenu()
- onEditorGuiStatusBar()
- onEditorGuiToolBar()
- onEditorInspectorDynFieldChanged()
- onEditorInspectorFieldChanged()
- onEditorInspectorHeaderGui()
- onEditorLoadState(state: table)
- onEditorMainMenuBar(windowsize: float2)
- onEditorObjectSelectionChanged()
- onEditorPaste()
- onEditorSaveState(state: table)
- onEditorSelectAll()
- onEditorShutdown()
- onEditorToolWindowGotFocus(windowname: string)
- onEditorToolWindowHide(windowname: string)
- onEditorToolWindowLostFocus(windowname: string)
- onEditorToolWindowShow(windowname: string)
- onEndScenario(countDownTime: number)
- onExit()
- onFailureTimerFired(failureTriggerTime: number)
- onFileChanged(filename: string, type: string)
- onFileChangedEnd()
- onFirstUpdate()
- onFreeroamLoaded(mission: string)
- onGameStateUpdate(state: table)
- onInit()
- onInputBindingsChanged(assignedPlayers: table)
- onJobDone(job: table, numleft: number)
- onLastAttemptTaken()
- onLoadCustomPrefabs(scenario: table)
- onLoadingScreenFadeout()
- onMenuToggled(showMenu: boolean)
- onModActivated(mod: table)
- onModDeactivated(mod: table)
- onModManagerReady()
- onMouseLocked(locked: boolean)
- onMouseToolSwitchTool(value: string)
- onNewAttempt(attemptData: table)
- onObjectCollision(vehicleID: number, otherObjID: number)
- onPhysicsEngineEvent(...)
- onPhysicsPaused()
- onPhysicsUnpaused()
- onPreRender(dtReal: number, dtSim: number, dtRaw: number)
- onRaceBranchChosen(data: table)
data = { branchName = "", time = 0, vehicleId = 0, vehicleName = "", }
- onRaceFinished(scenario: table)
- onRaceGoalsInitilised(scenario: table)
- onRaceInit()
- onRaceLap(data: table)
data = { lap: 0, time: 0, vehicleName: "", currentLapConfig = {}, historicalLapConfig = {}, }
- onRaceResult(data: table)
data = { finalTime = 0, }
- onRaceStart()
- onRaceTick(raceTickTime: number, timer: number)
- onRaceWaypoint(data: table)
- onRaceWaypointReached(data: table)
- onReplayStateChanged(state: table)
- onReset(retainDebug: boolean)
- onResetGameplay(playerID: number)
- onSaveCampaign(callback: function(moduleKey: string, data: table))
- onScenarioChange(scenario: table)
- onScenarioFinished(scenario: table)
- onScenarioLoaded(scenario: table)
- onScenarioRestarted(scenario: table)
- onScenarioUIReady(state: string)
- onSettingsChanged()
- onSpineAnimationFinished()
- onTrafficStart()
- onUiChangedState(to: string, from: string)
- onUIInitialised()
- onUIOnlineMessageHide(msg)
- onUIOnlineMessageReady()
- onUiReady()
- onUpdate(dtReal: number, dtSim: number, dtRaw: number)
- onUploadScreenshot(metadata: table)
- onVEditorGuiMainMenu()
- onVEditorGuiMainTabBar()
- onVehicleAIStateChanged(info: table)
- onVehicleCameraConfigChanged(id: number, cameraData: table)
- onVehicleDestroyed(vid: number)
- onVehicleFocusChanged(data: table)
- onVehicleLoaded(retainDebug: boolean)
- onVehicleResetted(vehicleID: number)
- onVehicleSelected(vehicle: table)
- onVehicleSpawned(vid: number)
- onVehicleStoppedMoving(vehicleID: number, damaged: boolean)
- onVehicleSwitched(oldID: number, newID: number, player: number)
- onVehicleTakenDamage(vehicleID: number, delataDamage: number)
- onWindowResized(displaySize: float2)
- onWorldReadyState(worldReadyState: number)
- startTracking(activity: table)
- stopTracking(activity: table)
- trackAIAllVeh(state: string)
- trackAISingleVeh(mode: string, vehicleID: number)
- trackCamMode()
- trackNewVeh(vehicleID: number)
- trackVehReset(vehicleID: number)
- updateGFX(dtSim: number)