RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

server/commands - Camera & Input Commandsge_utils - Game Engine Utility Functionsmain.lua - GE Lua Entry Point & Game Loopmap.lua - Navigation Graph (AI Road Map)screenshot.lua - Screenshot Systemserver/server - Level Loading & Game ServerserverConnection - Client-Server Connection Manager`setSpawnpoint` - Default Spawn Point Persistence`simTimeAuthority` - Simulation Time & Bullet Time Control`spawn` - Vehicle Spawning & Safe Placement`suspensionFrequencyTester` - Suspension Natural Frequency Analysis
Activity ManagerAudio Bank ManagerAudio Ribbon SystemBus Route ManagerCamera SystemCore Chat (IRC)Core CheckpointsCore Command HandlerCoupler Camera ModifierDevices (RGB Peripherals)Dynamic PropsEnvironmentFlowgraph ManagerForestFun StuffGame ContextGame StateGround Marker ArrowsGround MarkersHardware InfoHighscoresHotlappingInventoryJob SystemLap TimesLevelsLoad Map CommandMetricsMod ManagerMultiseatMultiseat CameraMulti SpawnOnlinePaths (Camera Paths)Quick Access (Radial Menu)Recovery PromptRemote ControllerReplayRepositoryRope Visual TestScheme Command ServerCore SnapshotCore SoundsCore TerrainTraffic SignalsTrailer RespawnVehicle Active PoolingVehicle Bridge (GE ↔ VLua Communication)Vehicle MirrorsVehicle PaintsCore VehiclesVehicle TriggersVersion UpdateWeather SystemWindows Console

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 ReferenceGE Extensionscore

Inventory

Simple key-value inventory system for tracking items (vehicles, parts, currency) during campaigns/scenarios. Supports adding, removing, and querying items by type, with campaign save/resume hooks.

Simple key-value inventory system for tracking items (vehicles, parts, currency) during campaigns/scenarios. Supports adding, removing, and querying items by type, with campaign save/resume hooks.


Public Functions

FunctionSignatureDescription
M.addItem(itemType, valueObj)Adds an item - numeric values accumulate, table values are appended if unique
M.removeItem(itemType, valueObj)Removes an item - numeric values subtract, table entries matched by model+config
M.getItem(itemType, itemId) → itemGets a single item by type and itemId, or the numeric total
M.getItemList(itemType) → tableReturns a deep copy of all items for a given type
M.processOnEvent(onEventData, earnedMedal)Processes add/remove operations from event reward data
M.onSaveCampaign(saveCallback)Serializes inventory for campaign save
M.onResumeCampaign(campaignInProgress, data)Restores inventory from campaign data
M.onSerialize() → tableReturns deep copy of items table for serialization
M.onDeserialized(data)Called on deserialization (no-op)
M.itemsTableTable. Stores all inventory items.

Item Storage

Item TypeValue TypeBehavior
Numeric (e.g. "$$$_MONEY")numberAccumulated via addition/subtraction
Table (e.g. "$$$_VEHICLE")tableStored as array of unique objects

Item types are automatically uppercased. The processTable helper prefixes keys with $$$_.


Module State

VariableTypeDefault
itemsTabletable{}

Usage Example

-- Add currency
core_inventory.addItem("$$$_MONEY", 200)

-- Add a vehicle to inventory
core_inventory.addItem("$$$_VEHICLE", {
  model = "etk800",
  config = "etk800_m",
  color = "1 1 1 1"
})

-- Check currency balance
local balance = core_inventory.getItem("$$$_MONEY")
print("Balance: " .. balance)

-- Remove a vehicle
core_inventory.removeItem("$$$_VEHICLE", {
  model = "etk800",
  config = "etk800_m"
})

-- Get all vehicles
local vehicles = core_inventory.getItemList("$$$_VEHICLE")

Event Processing

The processOnEvent function handles structured reward data with optional medal-based branching:

-- Medal-dependent rewards
local eventData = {
  remove = {
    gold = {
      vehicles = {{model = "pickup", config = "v8_4wd_rusty"}},
      money = 2500
    }
  }
}
core_inventory.processOnEvent(eventData, "gold")

Notes

  • Duplicate detection for table items compares all key-value pairs.
  • Table items are removed by matching model and config fields specifically.
  • This is a legacy/scenario inventory system - career mode uses career_modules_inventory.

See Also

  • globals - Core engine API

Hotlapping

Full hotlapping / lap timing system. Supports creating custom circuits in freeroam (edit mode), running timed laps with checkpoint splits, best-lap tracking, and integration with both the old scenario

Job System

Coroutine-based job system for running background tasks without blocking the game. Jobs yield control back to the engine periodically, allowing frame rendering to continue during long operations.

On this page

Public FunctionsItem StorageModule StateUsage ExampleEvent ProcessingNotesSee Also