Loader Reference
Module defined in `lua/common/jbeam/loader.lua`. Main orchestrator for the JBeam vehicle loading pipeline. Coordinates all processing stages from file loading to 3D mesh attachment.
Module defined in lua/common/jbeam/loader.lua. Main orchestrator for the JBeam vehicle loading pipeline. Coordinates all processing stages from file loading to 3D mesh attachment.
Exports
Functions
M.loadVehicleStage1(objID, vehicleDir, vehicleConfig)
Entry point for vehicle loading. Runs on both vehicle and GE Lua. Normalizes directory paths, calls loadJbeam for the full processing pipeline, optionally writes debug files, then calls loadBundle for 3D object setup.
- Parameters:
objID- number - Object ID of the vehicle being spawnedvehicleDir- string - Vehicle directory path (e.g."/vehicles/pickup/")vehicleConfig- table - Configuration withparts/partsTree,paints/colors,mainPartName,additionalVehicleData, etc.
- Returns:
self(module table, for chaining)
M.loadBundle(objID, vehicleBundle, loadingProgress)
Second stage: attaches 3D objects to the vehicle. Processes events, license plates, skins, colors, paints, initial node positions, ref nodes, flexbodies, props, visual ropes, materials, and mirrors. Requires the game engine (vehicleObj from scenetree).
- Parameters:
objID- number - Object IDvehicleBundle- table - Bundle fromloadVehicleStage1loadingProgress- object|nil - Loading progress reporter
- Returns: nil
Variables
M.defaultBeamSpring
- Type: number
- Description: Default beam spring constant
- Expected structure:
4300000
M.defaultBeamDeform
- Type: number
- Description: Default beam deformation threshold
- Expected structure:
220000
M.defaultBeamDamp
- Type: number
- Description: Default beam damping value
- Expected structure:
580
M.defaultNodeWeight
- Type: number
- Description: Default node weight in kg
- Expected structure:
25
M.defaultBeamStrength
- Type: number
- Description: Default beam breaking strength
- Expected structure:
math.huge(infinite - beams don't break by default)
M.data
- Type: table
- Description: General-purpose data storage table
- Expected structure:
{}(empty by default)
M._noSerialize
- Type: boolean
- Description: Flag to prevent serialization of this module
- Expected structure:
true
Internal Notes
-
Loading pipeline order (inside
loadJbeam):jbeamIO.startLoading- parse all .jbeam filesjbeamSlotSystem.findParts- resolve part tree from configjbeamVariables.getAllVariables→processComponents→processParts- variable resolutionjbeamSlotSystem.unifyPartJournal- merge parts togetherjbeamVariables.postProcessVariables+cleanupjbeamTableSchema.process- convert table schemas to objectssectionMerger.process- merge renamed sectionsjbeamLinks.prepareLinksDestructive- find cross-referencesjbeamOptimization.assignCIDs- assign continuous IDsjbeamLinks.resolveLinks- resolve references to CIDsjbeamNodeBeam.process- nodes/hydros/ropes/quadsjbeamCamera.process- camera setup (GE only)jbeamWheels.processWheels- wheel constructionjbeamLinks.resolveGroupLinks- group referencesjbeamAssorted.process,processRotators,jbeamGroups.process,jbeamScaling.process- Default beam/node options applied
jbeamOptimization.process- cleanup and dereferencejbeamIO.finishLoading- clears some cachesjbeamInteraction.process- input action loading
-
M.materialsandM.materialsMapare loaded fromparticles.getMaterialsParticlesTable()at module load time. -
Debug output controlled by
-debugVehicleLoadingcommand-line arg. -
Runs on both GE and vehicle Lua; camera processing only happens on GE (
vmType == 'game').
Links Reference
Module defined in `lua/common/jbeam/links.lua`. Resolves cross-references between JBeam sections (e.g. node name strings → CID integers), handling the `key:section` link syntax.
Materials Reference
Module defined in `lua/common/jbeam/materials.lua`. Processes material switches, glow maps, and deform group material bindings for vehicle 3D objects.