Vehicle Selector – Tiles
Generates the grouped, clustered, and sorted tile grid for the vehicle selector.
Generates the grouped, clustered, and sorted tile grid for the vehicle selector.
Overview
ui_vehicleSelector_tiles is the tile generation engine for the vehicle selector. It converts filtered vehicle configs into grouped, clustered, sorted tile arrays for the UI grid. Supports two path types: allModels (overview with grouping) and configsForBrandSubModelOrModel (individual configs for a model).
Extension path: lua/ge/extensions/ui/vehicleSelector/tiles.lua
Dependencies (require): tileSorting, tileGrouping, tileClustering, tilesModule
Exports (M)
| Function | Signature | Description |
|---|---|---|
getTiles | (path, pathChanged) → groups[] | Main entry: returns sorted tile groups for a path. |
configToTile | (config, fullName) → tile | Converts a single config into a tile object. |
clusterItems | (configs) → clusters | Clusters configs using current display mode. |
overrideDefaultSelectedTile | (tile) | Forces a specific tile to be pre-selected. |
onExtensionLoaded | () | Creates the tilesModule instance. |
emptyProfiler | () | Returns a no-op profiler instance. |
Re-exported from submodules
getClusteredItemsFavouriteIconPercent, getClusteredItemsStats, getSources, sortByNameButOtherAlwaysLast, sortByValue, sortByYears, groupModeFunctions, getConfigOrModelPropValue
Internals
Path Handlers
allModels
- Filters all configs through
passesFilters. - Groups configs by the current group mode (Type, Brand, etc.) via
tileGrouping. - Clusters configs within each group via
tileClustering. - Creates tiles from clusters (or directly for unclustered favourites/recent).
- Sorts tiles per group (automatic or user-selected mode).
- Adds special Favourites/Recent groups with appropriate sorting.
configsForBrandSubModelOrModel
- Iterates configs for a specific model.
- Filters by submodel, brand, auxiliary, and current filters.
- Optionally filters by Favourites/Recent group context.
- Converts each matching config to a tile via
configToTile. - Sorts and sets default selection.
configToTile
Creates a tile with:
key-"modelKey/configKey"name- Configuration name or full namepreview,model_key,config_key,configTypeshowDetails/doubleClickDetails- for UI interaction- Performance stats, favourite/recent indices, source icons
tilesModule Instance
On onExtensionLoaded, creates a generic tilesModule instance configured with vehicle-specific handlers, clustering, grouping, sorting, data source, and filter functions.
How It Works
- UI calls
getTiles({keys: ["allModels"]})orgetTiles({keys: ["configsForBrandSubModelOrModel", model, ...]}). - The appropriate path handler filters, groups, clusters, and sorts configs.
- Returns an array of group objects, each containing sorted tiles.
- The UI renders the tile grid from these groups.
Lua Examples
-- Get tiles for the overview
local groups = extensions.ui_vehicleSelector_tiles.getTiles(
{keys = {"allModels"}}, true
)
-- Convert a single config to a tile
local tile = extensions.ui_vehicleSelector_tiles.configToTile(myConfig, true)Hooks
| Hook | When |
|---|---|
onVehicleSelectorGetTiles (ext) | Config path handler starts (with model/sub/brand/group params) |
Additional Exports
The following exports are available but not yet documented in detail:
M.clusterItemsM.configToTileM.emptyProfilerM.getClusteredItemsFavouriteIconPercentM.getClusteredItemsStatsM.getConfigOrModelPropValueM.getSourcesM.getTilesM.groupModeFunctionsM.onExtensionLoadedM.overrideDefaultSelectedTileM.sortByNameButOtherAlwaysLastM.sortByValueM.sortByYears