RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

Server CommandsGE UtilitiesGame Engine MainNavigation GraphScreenshot CaptureServerServer ConnectionSpawnpoint ManagerSimulation TimeVehicle SpawningSuspension Frequency Tester
Gameplay AchievementGameplay CityDiscoverForce FieldGarage ModeMarker InteractionParking SystemGameplay Playmode MarkersGameplay PoliceGameplay RallyGameplay Rally LoopGameplay Raw POIsGameplay Skidpad TestSpeed Trap LeaderboardsSpeed Traps and CamerasGameplay StatisticsTaxi Ride SystemTraffic SystemVehicle PerformanceWalking
Sites Custom FieldsSites LocationSites Parking SpotSites ContainerSites ManagerSites Zone

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 Extensionsgameplaysites

Sites Manager

Extension that manages loading, caching, and lifecycle of `*.sites.json` files across all levels. Provides utility functions for finding sites files and best parking spots.

Extension that manages loading, caching, and lifecycle of *.sites.json files across all levels. Provides utility functions for finding sites files and best parking spots.


Public API

FunctionSignatureReturnsDescription
getAllLevelSites()nilScan all levels for *.sites.json files
loadSites(filepath, force, ignoreCache)sites?Load and cache a sites file
getSitesFilesByLevel()tableMap of level → sites file paths
getCurrentLevelSitesFiles()tableSites files for current level
getCurrentLevelSitesFileByName(name)string?Find sites file by name prefix
getBestParkingSpotForVehicleFromList(vehId, spots)spotBest fitting unoccupied spot

Extension Hooks

HookPurpose
onModManagerReadyScan all levels for sites files
onClientStartMissionRecord current level
onClientEndMissionClear sites cache
onSerializeSave cache state for hot-reload
onDeserializedRestore cache from hot-reload data
M.getAllLevelSites()
M.getBestParkingSpotForVehicleFromList(vehId, parkingSpots)
M.getCurrentLevelSitesFileByName(name)
M.getCurrentLevelSitesFiles(name)
M.getSitesFilesByLevel()
M.loadSites(filepath, force, ignoreCache)
M.onClientEndMission()
M.onClientStartMission()
M.onDeserialized(data)
M.onModManagerReady()
M.onSerialize()

Internals

  • sitesCache: Map of filepath → Sites object (cached after first load)
  • sitesByLevel: Map of levelName → array of sites file paths
  • currentLevel: Current level identifier

How It Works

  1. onModManagerReady scans all levels via core_levels.getList() for *.sites.json files
  2. loadSites reads a file, deserializes into a Sites object, calls finalizeSites(), and caches it
  3. Cache is cleared on mission end to free memory
  4. Serialization/deserialization support enables hot-reload without re-scanning
-- Load sites for a specific file
local sites = gameplay_sites_sitesManager.loadSites("/levels/west_coast_usa/main.sites.json")

-- Find by name
local filepath = gameplay_sites_sitesManager.getCurrentLevelSitesFileByName("main")
local sites = gameplay_sites_sitesManager.loadSites(filepath)

-- Find best parking spot
local spots = sites.parkingSpots.sorted
local best = gameplay_sites_sitesManager.getBestParkingSpotForVehicleFromList(vehId, spots)
best:moveResetVehicleTo(vehId)

Dependencies

  • gameplay/sites/sites - Sites container class
  • core_levels - level listing and paths

Notes

  • loadSites with force=true bypasses cache; ignoreCache=true loads without storing in cache
  • getBestParkingSpotForVehicleFromList checks vehicleFits and hasAnyVehicles, falls back to last spot
  • Sites file naming convention: <name>.sites.json

See Also

  • Sites Custom Fields - Related reference
  • Sites Location - Related reference
  • Sites Parking Spot - Related reference
  • Gameplay Systems Guide - Guide

Sites Container

Class that holds all site data for a level: locations, zones, and parking spots. Provides spatial queries via KD-trees and manages relationships between zones and their contained objects.

Sites Zone

Class representing a 2D polygon zone with optional top/bottom bounding planes. Used for defining areas (parking zones, restricted areas, etc.) within the sites system.

On this page

Public APIExtension HooksInternalsHow It WorksDependenciesNotesSee Also