Thrusters Module Reference
Module defined in `lua/vehicle/thrusters.lua`. This module manages the application of continuous forces (thrusters) and temporary impulses to the vehicle structure. It supports both JBeam-defined thru
Module defined in lua/vehicle/thrusters.lua. This module manages the application of continuous forces (thrusters) and temporary impulses to the vehicle structure. It supports both JBeam-defined thrusters and dynamic force commands from other Lua scripts.
See Also
- Obj: For the underlying
applyForceandapplyClusterLinearAngularAccelmethods. - Electrics: For thrusters controlled by electrical signals.
Public API - Manual Force Application
Used by other modules (e.g., AI, specialized controllers) to apply dynamic forces.
| Function | Signature | Description |
|---|---|---|
thrusters.applyImpulse | (n1, n2, force, dt) | Applies a constant force between two nodes for a specified duration. |
thrusters.applyImpulseBody | (force, dt) | Applies a force along the vehicle's primary forward axis (using reference nodes). |
thrusters.applyAccel | (accel, dt, nodeId, angularAccel) | Applies a constant linear and/or angular acceleration to a specific node cluster. |
thrusters.applyVelocity | (velocity, dt, nodeId) | Calculates and applies the necessary acceleration to make a node cluster match the target velocity. |
Public API - Utility
| Function | Signature | Description |
|---|---|---|
thrusters.getAccelDt | (nodeId) | Returns the remaining time (TTL) for an active acceleration command on a specific cluster. |
thrusters.isPhysicsStepUsed | () | Returns true if there are currently any active forces being applied that require high-frequency physics updates. |
Public API - Lifecycle
| Function | Signature | Description |
|---|---|---|
thrusters.init | () / reset() | Standard lifecycle hooks. Loads JBeam thruster definitions and separates them into "auto" (constantly active) and "controlled" (electrics-driven) groups. |
thrusters.update | () | Dispatched by the engine during physics steps. Iterates through all active impulses and thrusters, applying forces via obj:applyForce. |
thrusters.updateGFX | () | Dispatched by the engine during graphics frames. Maps electrics.values to the magnitude of controlled thrusters based on their JBeam control property. |
Streams Module Reference
Module defined in `lua/vehicle/guistreams.lua`. Manages the subscription-based data streaming system that feeds real-time vehicle telemetry to UI apps. When a UI app registers interest in a data category (e.g., engine data, wheel thermals), this module evaluates the corresponding handler each frame and sends results via `guihooks`. Prevents wasted computation by only evaluating streams that have active subscribers.
`v` (Vehicle Data & JBeam)
The `v` global manages the vehicle's JBeam data and configuration. It is primarily used to access the compiled physical structure and the JBeam configuration of the vehicle.