API Reference GE Extensions gameplay Parking System Reference for `gameplay_parking`, which manages spawning, positioning, and recycling of AI parked vehicles using parking spot site data and vehicle active pooling.
Reference for gameplay_parking, which manages spawning, positioning, and recycling of AI parked vehicles using parking spot site data and vehicle active pooling.
Function Signature Description setState(val)Activates or deactivates the parking system getState() → boolReturns active state setSites(data)Sets custom sites data (filepath string or table) setupVehicles(amount, options) → boolSpawns parked vehicles via multiSpawn activate(vehIds, ignoreScatter)Activates vehicles as parked cars deactivate()Deactivates all parked vehicles deleteVehicles(amount?)Deletes parked vehicles resetAll()Full reset of parking system
Function Signature Description insertVehicle(id)Registers a vehicle as parked removeVehicle(id)Unregisters a vehicle getParkedCarsAmount(activeOnly?) → numberCount of parked vehicles getParkedCarsList() → tableArray of parked vehicle IDs getParkedCarsData() → tablePer-vehicle parking data moveToParkingSpot(vehId, parkingSpot, lowPrecision)Teleports vehicle to a parking spot forceTeleport(vehId, psList, minDist, maxDist)Forces vehicle to a new spot scatterParkedCars(vehIds, minDist, maxDist)Randomly redistributes all parked cars
Function Signature Description getParkingSpots() → tableReturns all parking spots from sites data findParkingSpots(pos, minRadius, maxRadius) → tableFinds spots sorted by distance filterParkingSpots(psList, filters) → tableFilters by probability, time-of-day, vehicles getRandomParkingSpots(originPos, min, max, count, filters) → tableRandom selection with distance bias checkParkingSpot(vehId, parkingSpot) → boolChecks if spot is available and fits vehicle getCurrentParkingSpot(vehId) → id|nilReturns spot ID if vehicle is properly parked
Function Signature Description enableTracking(vehId, autoDisable)Starts tracking parking status for a driven vehicle disableTracking(vehId)Stops tracking getTrackingData() → tableReturns all tracked vehicle data
Function Signature Description setParkingVars(data, reset?)Sets parking variables getParkingVars() → tableGets current parking variables setActiveAmount(amount)Sets max visible parked vehicles
Function Signature Description processVehicles(vehIds, ignoreScatter)Alias for activate
Function Description onUpdatePer-frame: tracks parking status, recycles parked vehicles onVehicleActiveChangedHandles teleport flags when vehicles activate/deactivate in pool onVehicleDestroyedRemoves destroyed vehicle from parking data onVehicleGroupSpawnedActivates parking after autoParking multiSpawn completes onClientStartMissionSets worldLoaded flag onClientEndMissionFull reset of parking system onSerializeSerializes parking state for hot-reload onDeserializedRestores parking state after hot-reload
Field Type Default Description debugLevelnumber 0Debug visualization level (0=off, 1=spots, 2=corners, 3=full)
Variable Default Description precision0.8 Required parking accuracy for valid park neatness0 How precisely AI parks (0 = sloppy, 1 = perfect) parkingDelay0.5 Seconds before a parked position is confirmed baseProbability0.75 Spawn probability per spot (0–1) activeAmount∞ Max simultaneously visible parked cars
local function moveToParkingSpot (vehId, parkingSpot, lowPrecision)
-- 1. Determine facing: forwards/backwards tag, or random (75%+ forwards)
-- 2. Unless "perfect" tag: randomize position offset within gap
-- and rotation offset, scaled by (1 - neatness²)
-- 3. Teleport to spot via parkingSpot:moveResetVehicleTo()
-- 4. Set ignition to 0
-- 5. Enable/disable map tracking based on "street" tag
-- 6. Optionally randomize paint
end
Each frame, one parked vehicle is checked for recycling:
Check if vehicle is far enough from all non-parked vehicles
Account for player direction and speed for activeRadius
If too far: processNextSpawn() cycles the vehicle pool and teleports to a new spot ahead of the player
Parking spot search is throttled: only re-queries when the look-ahead point moves far enough from the last check
Event Trigger enterVehicle corners enter a parking spot exitVehicle leaves the parking spot area validVehicle properly parked for parkingDelay seconds invalidPreviously parked vehicle moved out of position M.activate(vehIds, ignoreScatter)M.checkParkingSpot(vehId, parkingSpot)M.deactivate()M.debugLevelvalue M.deleteVehicles(amount)M.dependenciesvalue M.disableTracking(vehId)M.enableTracking(vehId, autoDisable)M.filterParkingSpots(psList, filters)M.findParkingSpots(pos, minRadius, maxRadius)M.forceTeleport(vehId, psList, minDist, maxDist)M.getCurrentParkingSpot(vehId)M.getParkedCarsAmount(activeOnly)M.getParkedCarsData()M.getParkedCarsList()M.getParkingSpots()M.getParkingVars()M.getRandomParkingSpots(originPos, minDist, maxDist, minCount, filters)M.getState()M.getTrackingData()M.insertVehicle(id)M.moveToParkingSpot(vehId, parkingSpot, lowPrecision)M.onClientEndMission()M.onClientStartMission()M.onDeserialized(data)M.onSerialize()M.onUpdate(dt, dtSim)M.onVehicleActiveChanged(vehId, active)M.onVehicleDestroyed(id)M.onVehicleGroupSpawned(vehList, groupId, groupName)M.processVehicles(vehIds, ignoreScatter)M.removeVehicle(id)M.resetAll()M.scatterParkedCars(vehIds, minDist, maxDist)M.setActiveAmount(amount)M.setParkingVars(data, reset)M.setSites(data)M.setState(val)M.setupVehicles(amount, options)
Hook: onVehicleParkingStatus(vehId, trackingData)
Sites data loaded from city.sites.json in the current level (via gameplay_city)
Uses core_vehicleActivePooling for efficient vehicle show/hide management
Probability filtering accounts for time-of-day (day spots more likely at noon, night spots at midnight)
Spawned vehicles use propparked filter and level region for vehicle selection
Default parking spot size check: 2.5 × 6 × 3 meters
Free camera height increases the look-ahead distance for parking spot search
Vehicles tagged with ignoreForceTeleport won't be recycled
Central system for rendering and interacting with playmode markers (mission markers, parking spots, gas stations, etc.). Manages marker visibility, speed-based interaction gating, activity prompts, na
Gameplay Playmode Markers
Clusters POI data into playmode marker groups (missions, parking, zones, walking, gas stations, drift lines, etc.) and provides spatial queries via a KD-tree for efficient visibility lookups.