RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

AI Module ReferenceBackwards Compatibility Module ReferenceBdebug Module ReferenceBdebugImpl Module ReferenceBeamstate Module ReferenceBullettime Module ReferenceController Module ReferenceDamageTracker Module ReferenceDrivetrain Module ReferenceElectrics Module ReferenceElectrics Custom Value ParserEnergyStorage Module ReferenceExtensions Module ReferenceFire Module ReferenceVehicle Engine True GlobalsGuihooks Module ReferenceGUI Streams Module ReferenceHTML Texture Module ReferenceHydros Module ReferenceInput Module ReferenceJBeam-Lua Integration GuideMapmgr Module ReferenceMaterial Module ReferenceBeamNG Math & Unit Conversions Referenceobj (Vehicle C++ Object)PartCondition Module ReferenceParticlefilter Module ReferenceParticles Module ReferencePowertrain Module ReferenceVehicle Property & Module TreeProps Module ReferenceProtocols Module ReferenceRecovery Module ReferenceScriptAI Module ReferenceSensors Module ReferenceSounds Module ReferenceStreams Module ReferenceThrusters Module Reference`v` (Vehicle Data & JBeam)Wheels Module Reference

UI

Resources

BeamNG Game Engine Lua Cheat SheetGE Developer RecipesMCP Server Setup

// RLS.STUDIOS=true

Premium Mods for BeamNG.drive. Career systems, custom vehicles, and immersive gameplay experiences.

Index

HomeProjectsPatreon

Socials

DiscordPatreon (RLS)Patreon (Vehicles)

© 2026 RLS Studios. All rights reserved.

Modding since 2024

API Referenceve

Beamstate Module Reference

Module defined in `lua/vehicle/beamstate.lua`. This module manages the vehicle's structural integrity, including beam breakage and deformation, couplers (towing/attachment), breakgroups, and tire defl

Module defined in lua/vehicle/beamstate.lua. This module manages the vehicle's structural integrity, including beam breakage and deformation, couplers (towing/attachment), breakgroups, and tire deflation.

See Also

  • DamageTracker: High-level damage reporting.
  • DamageOverview: Summary of all damage systems.
  • PartCondition: Persistent part health and mileage.
  • Wheels: For tire physics and initial pressure state.

Core Module Variables

VariableTypeDescription
damagenumberTotal damage score (physics energy + external damage).
damageExtnumberManual damage accumulator for non-physics events (e.g., punctures).
monetaryDamagenumberEstimated repair cost based on part damage values.
lowpressurebooleanTrue if any tire on the vehicle has lost pressure.
activePartstableList of all currently installed/active part names.
deformedBeamstableTracks the current deformation ratio of structural beams.
attachedCouplerstableMaps local nodes to remote vehicle/node connection info.
nodeNameMaptableMaps JBeam node names (strings) to physical IDs (e.g., f15 = 143).
deformGroupDamagetableTracks normalized damage (0-1) for every defined deformGroup.
deformGroupsTriggerBeamtableMaps deformGroups to the CID of the first beam that triggered them.
couplerCachetableMetadata for all available couplers (name, strength, tags, etc.).
tagBeamMaptableMaps JBeam tags to lists of associated beam IDs.
linkTagBeamMaptableMaps linkTags to lists of associated beam IDs.

Public API - Core & Lifecycle

FunctionSignatureDescription
beamstate.init() / reset()Module initialization and state clearing. Rebuilds caches for beams, groups, and couplers.
beamstate.load(filename) / save(filename)Restores or serializes the vehicle's physical state (damage, broken beams) to a JSON file.
beamstate.update(dt)Handles time-based precompression logic during initialization.
beamstate.updateGFX(dt)Main frame update. Ticks planet TTL timers, recalculates total damage score from dissipated energy + external damage, computes monetary damage from part damage coefficients, sends skeleton state updates to UI when beam damage changes, handles auto-coupling retry logic, and transmits electrics/input data across coupled vehicle links.

Public API - Damage & Structural Status

FunctionSignatureDescription
beamstate.addDamage(val)Manually adds to the vehicle's external damage score (damageExt).
beamstate.beamBroken(id, energy)Engine callback for beam snaps. Triggers breakgroups and punctures.
beamstate.onBeamDeformed(id, ratio)Engine callback for permanent beam deformation. Triggers deformgroups.
beamstate.torsionBarBroken(id, energy)Callback for torsional spring failure.
beamstate.isTriangleBroken(triId)Checks if a specific collision/aerodynamic triangle has been destroyed.

Public API - Breakgroups & Deform Groups

FunctionSignatureDescription
beamstate.breakBreakGroup(name) / breakAllBreakgroups()Forces a specific group (or all groups) of beams to snap simultaneously.
beamstate.breakHinges()Convenience function to break all breakgroups containing "hinge" or "latch".
beamstate.triggerDeformGroup(name)Manually triggers the visual effects (glass cracks, light damage) for a group.

Public API - Couplers & Attachment

FunctionSignatureDescription
beamstate.activateAutoCoupling(tag) / disableAutoCoupling()Enables/disables automatic attachment to nearby compatible couplers.
beamstate.attachCouplers(tag) / detachCouplers(tag, forceLocked, forceWelded)Manually triggers attachment or detachment for couplers, optionally filtered by tag.
beamstate.toggleCouplers(tag)Cycles through coupler states (Attach -> Auto -> Detach).
beamstate.couplerExists(tag) / hasCouplers()Checks for existence of specific coupler tags or any couplers on the vehicle. Returns boolean.
beamstate.getCouplerOffset(tag)Returns the relative position of couplers compared to the reference node.
beamstate.setCouplerVisiblityExternal(id, visible)Remote call to highlight specific coupler tags.
beamstate.exportCouplerData(nodeId, data) / importCouplerData(...)Logic for transmitting and receiving data (electrics/input) across a coupled link.

Public API - Wheels & Tires (Structural)

FunctionSignatureDescription
beamstate.deflateTire(wheelIndex) / deflateTires()Triggers immediate pressure loss for specific or all tires.
beamstate.deflateRandomTire()Selects a random inflated tire and triggers a puncture.

Public API - Skeleton & Parts

FunctionSignatureDescription
beamstate.getPartCondition(partId, partTypeData)Evaluates the physical condition of a part by checking its breakgroups and beam damage. Determines if the part needs replacement based on thresholds for broken beams, deformed beams, and broken breakgroups. Returns partCondition (table with integrityValue, integrityState, visualValue, visualState), canProvideCondition (boolean)`.
beamstate.setPartCondition(partId, partTypeData, odometer, integrity, visual)Intended to restore part condition from saved data. Currently a partial stub - accepts and normalizes parameters but does not apply physical changes.
beamstate.getPartDamageData() / exportPartDamageData()Exports a map of damage coefficients for every installed part.
beamstate.requestSkeleton() / requestSkeletonState()Triggers UI events to render the vehicle's beam structure and damage state.
beamstate.getVehicleState()Returns a summary table of high-level state (position, direction, condition).

Public API - Physics & Environment (Misc)

FunctionSignatureDescription
beamstate.addPlanet(center, radius, mass, ttl) / delPlanet(...)Manages point-gravity sources ("planets") that affect the vehicle's nodes.
beamstate.setPlanets(table)Bulk-sets multiple gravity sources.

Public API - Internal & Debug

FunctionSignatureDescription
beamstate.debugDraw(dt)Renders coupler ranges and tags when coupler debug is enabled.
beamstate.updateRemoteElectrics(retain)Merges electrics data received from coupled vehicles into local state.
module.onCouplerAttached(nodeId, obj2id, obj2nodeId, attachSpeed, attachEnergy)check if we are dealing with couplers within the same vehicle
module.isPhysicsStepUsed()Checks if physics step used. Returns M.update == update.

BdebugImpl Module Reference

Module defined in `lua/vehicle/bdebugImpl.lua`. The full-featured debugger implementation for visualizing vehicle physics state. Renders node positions, beam stress/deformation, collision triangles, skeleton overlays, and center-of-gravity markers in the 3D world. Loaded on demand by the lightweight `bdebug` proxy.

Bullettime Module Reference

Module defined in `lua/vehicle/bullettime.lua`. Manages slow-motion (bullet time) effects for the vehicle by adjusting the simulation time scale. Used for dramatic replays, crash analysis, and cinematic moments.

On this page

See AlsoCore Module VariablesPublic API - Core & LifecyclePublic API - Damage & Structural StatusPublic API - Breakgroups & Deform GroupsPublic API - Couplers & AttachmentPublic API - Wheels & Tires (Structural)Public API - Skeleton & PartsPublic API - Physics & Environment (Misc)Public API - Internal & Debug