API ReferenceGE Extensionscore
Vehicle Bridge (GE ↔ VLua Communication)
Black-box communication layer between GE Lua and vehicle Lua (VLua). All gameplay-related VLua requests should go through this bridge via `gameplayInterface` on the vehicle side.
Black-box communication layer between GE Lua and vehicle Lua (VLua). All gameplay-related VLua requests should go through this bridge via gameplayInterface on the vehicle side.
Public API
| Function | Signature | Description |
|---|---|---|
M.requestValue | (veh, callback, ...) | Requests data from VLua; callback receives deserialized result |
M.executeAction | (veh, ...) | Executes a gameplay action on the vehicle side |
M.callbackFromVlua | (vehId, callbackId, ...) | Internal - called by VLua to return data to GE |
M.registerValueChangeNotification | (veh, electricsKey) | Subscribes to electrics value change events |
M.unregisterValueChangeNotification | (veh, electricsKey) | Unsubscribes from value change events |
M.getCachedVehicleData | (vehId, key) | Returns cached electrics data for a vehicle |
M.setLogCommands | (enabled) | Enables/disables command logging to console |
M.logCommandFunction | (veh, command) | Logs vehicle command to console (the actual logging function) |
Fields
| Field | Type | Description |
|---|---|---|
M.vehicleData | table | Cached data per vehicle id {data={}, registeredCallbacks={}} |
M.logCommand | function | Current logging function; nop by default, set to logCommandFunction via setLogCommands(true) |
Fields
| Field | Type | Description |
|---|---|---|
M.vehicleData | table | Cached data per vehicle id {data={}, registeredCallbacks={}} |
Hooks
| Hook | Description |
|---|---|
M.onVehicleDestroyed | Clears cached data for the vehicle |
M.onVehicleReplaced | Clears cached data for the replaced vehicle |
Usage Example
local bridge = extensions.core_vehicleBridge
local veh = getPlayerVehicle(0)
-- Request a value from the vehicle
bridge.requestValue(veh, function(data)
log("I", "", "Got data: " .. dumps(data))
end, "someSystemKey")
-- Execute an action on vehicle side
bridge.executeAction(veh, "setFreeze", true)
-- Subscribe to electrics changes
bridge.registerValueChangeNotification(veh, "rpm")
-- Later read cached value
local rpm = bridge.getCachedVehicleData(veh:getID(), "rpm")Vehicle Active Pooling
Manages pools of vehicles with active/inactive states for performance. Controls which vehicles are visible (active) based on configurable limits and distance culling.
Vehicle Mirrors
Renders vehicle mirror reflections by computing reflection camera transforms from mirror node positions and the player camera.