API ReferenceGE Extensionscore
Load Map Command
Handles deep-link/startup commands to load a specific map with optional camera position. Parses level paths and camera transforms from structured command data.
Handles deep-link/startup commands to load a specific map with optional camera position. Parses level paths and camera transforms from structured command data.
Public Functions
| Function | Signature | Description |
|---|---|---|
M.set | (data, startCmd) | Sets map load parameters; triggers load when mod manager is ready |
M.onModManagerReady | () | Attempts to load the pending map after mods are initialized |
M.onWorldReadyState | (state) | Applies camera position/rotation after world loads (state == 2) |
M.onExtensionLoaded | () | No-op lifecycle hook |
M.onExtensionUnloaded | () | No-op lifecycle hook |
M.onClientPostStartMission | () | No-op lifecycle hook |
M.onSerialize | () → table | Returns {ignoreStartupCmd = true} to prevent re-execution |
M.onDeserialized | (d) | Restores ignoreStartupCmd flag |
Command Data Format
-- URL format: beamng:v1/openMap/{...}
local data = {
level = "levels/gridmap/info.json", -- Level path (required)
camPos = {58.78, -181.10, 604.18}, -- Camera position (optional)
camRot = {0.50, -0.49, 0.49, 0.50}, -- Camera quaternion (optional)
track = "trackName" -- Track to load (optional)
}
core_loadMapCmd.set(data)Flow
set()parses the level path and stores arguments- If mod manager is ready, immediately calls
changeMap() - Otherwise,
onModManagerReadytriggerschangeMap()later - After world loads (state 2), camera is positioned and optional track loaded
- A toast notification confirms the jump
Notes
- The
ignoreStartupCmdflag prevents GE reloads from re-executing the command. - If the map is already loaded in freeroam, skips to camera positioning directly.
- Uses
freeroam_freeroam.startFreeroam()to load the level. - Supports the
util/trackBuilder/splineTrackextension for loading tracks.
See Also
Levels
Level discovery, metadata, and loading system. Scans `/levels/` for available maps, enriches data with previews/spawn points/mod info, and provides the API for starting levels.
Metrics
ImGui-based performance metrics overlay. Displays FPS, frame times, GPU wait times, and detailed rendering statistics with three display modes.