Freeroam Facilities
Manages level facilities (garages, gas stations, dealerships, computers, delivery providers, dragstrips). Loads facility definitions from JSON, provides parking spot lookups, and formats facilities as
Manages level facilities (garages, gas stations, dealerships, computers, delivery providers, dragstrips). Loads facility definitions from JSON, provides parking spot lookups, and formats facilities as POI elements for the big map and playmode markers.
Public API
| Function | Signature | Returns | Description |
|---|---|---|---|
M.getFacilities | (levelName) | table | Returns all facilities for a level, keyed by type list name |
M.getFacility | (type, id) | table|nil | Returns a single facility by type and ID |
M.getFacilitiesByType | (type, levelName?) | table | Returns all facilities of a given type |
M.getGarage | (id) | table|nil | Shortcut for getFacility("garage", id) |
M.getGasStation | (id) | table|nil | Shortcut for gas station |
M.getDealership | (id) | table|nil | Shortcut for dealership |
M.getParkingSpotsForFacility | (facility) | table | Returns parking spots from sites file |
M.getZonesForFacility | (facility) | table | Returns zones from sites file |
M.getAverageDoorPositionForFacility | (facility) | vec3 | Average position of facility doors |
M.getClosestDoorPositionForFacility | (facility) | vec3 | Closest door to camera |
M.getGaragePosRot | (poi, veh) | vec3, quat | Best parking spot position/rotation for a vehicle |
M.teleportToGarage | (garageId, veh, resetVeh) | nil | Teleports vehicle to garage parking spot |
M.formatFacilityToRawPoi | (f, elements) | nil | Converts facility to raw POI element |
| M.onGetRawPoiListForLevel | (levelIdentifier, elements) | nil | Formats dealerships, computers, dragstrips as POI elements for the level |
| M.onActivityAcceptGatherData | (elemData, activityData) | nil | Provides context-specific accept buttons for facility activities |
| M.walkingMarkerFormatFacility | (f, elements) | - |
| M.zoneMarkerFormatFacility | (f, elements, bigMapIcon) | - |
Facility Types
| Type | List Name | Marker Type |
|---|---|---|
garage | garages | zoneMarker |
gasStation | gasStations | gasStationMarker |
dealership | dealerships | walkingMarker |
computer | computers | walkingMarker |
privateSeller | privateSellers | - |
deliveryProvider | deliveryProviders | walkingMarker |
dragstrip | dragstrips | walkingMarker |
How It Works
- Loading:
getFacilities(levelName)parsesinfo.json+*.facilities.jsonfiles in the level'sfacilities/folder - Parsing: Each facility entry gets sanitized with defaults for
id,preview,sitesFile,zoneNames,parkingSpotNames - POI Integration:
onGetRawPoiListForLevelformats dealerships, computers, and dragstrips as POI elements - Activity Accept:
onActivityAcceptGatherDataprovides context-specific buttons (open garage, view inventory, use computer, view drag history)
Facility JSON Structure
{
"garages": [{
"id": "garage_west",
"name": "West Garage",
"preview": "garage_west.jpg",
"sitesFile": "facilities.sites.json",
"parkingSpotNames": ["spot1", "spot2"],
"zoneNames": ["zone_garage"],
"doors": [["doorObj", 0, 6]]
}]
}Notes
- Facilities are cached per level in
facilitiesByLevel - Sites files can be a single string or array of paths
- Preview images fall back to
noPreview.jpg - Career-only: dealerships, computers shown as POIs; garages via zone markers
See Also
- Freeroam Big Map Markers - Related reference
- Freeroam Big Map Mode - Related reference
- Freeroam Big Map POI Provider - Related reference
- Freeroam Guide - Guide