configToTile
Definition
-- @/lua/ge/extensions/ui/vehicleSelector/tiles.lua:41
local function configToTile(config, fullName)
local model = core_vehicles.getModel(config.model_key).model
local sources = M.getSources(config, model, true) or {}
local sourceIcons = {}
for _, source in ipairs(sources) do
if string.endswith(source, ".svg") then
table.insert(sourceIcons, {svg = source})
else
table.insert(sourceIcons, {icon = source})
end
end
return {
key = config.model_key .. "/" .. config.key,
name = fullName and (config.Name or config.key) or (config.Configuration or config.key),
isConfig = true,
preview = config.preview or ("/vehicles/" .. config.model_key .. "/default.jpg"),
model_key = config.model_key,
config_key = config.key,
configType = config['Config Type'] or "Other...",
showDetails = {model = config.model_key, config = config.key},
doubleClickDetails = {model = config.model_key, config = config.key},
doubleClickMode = "",
subElementCount = 0,
favouriteIdx = ui_vehicleSelector_general.isFavourite(config.model_key, config.key) or 0,
recentIdx = ui_vehicleSelector_general.isRecentVehicle(config.model_key, config.key) or math.huge,
showFavouriteIconPercent = ui_vehicleSelector_general.isFavourite(config.model_key, config.key) and 1 or 0,
sourceIcons = sourceIcons,
isAuxiliary = config.isAuxiliary,
Value = config.Value or model.Value,
Weight = config.Weight or model.Weight,
['Top Speed'] = config['Top Speed'] or model['Top Speed'],
Power = config.Power or model.Power,
['Power/Weight'] = config.Power and config.Weight and config.Weight > 0 and config.Power > 0 and config.Power / config.Weight or math.huge,
['0-60 mph'] = config['0-60 mph'] or config.zeroTo60 or math.huge,
['0-100 km/h'] = config['0-100 km/h'] or config.zeroTo100 or math.huge,
}
end
Callers
@/lua/ge/extensions/editor/gen/exp_meshexplorer.lua
-- sourceIcon = sourceIcons[source]
-- local tile = configToTile(config, true)
end