GE Lua Documentation

Press F to search!

requestList

Definition


-- @/lua/ge/extensions/core/vehicles.lua:1034

-- get the list of all available vehicles for ui
local function notifyUI()
  if p then
    p:add("CEF response to guihook")
  else
    if profilerEnabled then p = LuaProfiler("Vehicle Selector menu WITHOUT profiling the first CEF stages (because the menu was triggered programmatically, not through binding)") end
    if p then p:start() end
  end
  local modelList, configList = {}, {}
  for modelName, _ in pairs(getModelsData()) do
    if p then p:add("model begin") end
    local model = getModel(modelName)
    if p then p:add("model get") end
    table.insert(modelList, model.model)
    if p then p:add("model insert") end
    for _, config in pairs(model.configs or {}) do
      table.insert(configList, config)
    end
    if p then p:add("model configs") end
  end

  if career_career.isActive() and gameplay_garageMode.getGarageMenuState() == "myCars" then
    local vehicles = career_modules_inventory.getVehicles()
    configList = {}
    for id, vehicle in pairs(vehicles) do
      -- configList
      local configInfo = {}
      configInfo.Name = id .. " - " .. (vehicle.niceName or vehicle.model)
      configInfo.model_key = vehicle.model
      configInfo.preview = "/vehicles/" .. vehicle.model .. "/default.jpg"
      configInfo.is_default_config = true
      configInfo.key = nil
      configInfo.aggregates = {Source = {
        ["Career"] = true
      },
      Type = {
        Car = true
      }}
      configInfo.Source = "Career"
      configInfo.spawnFunction = "career_modules_inventory.enterVehicle(" .. id .. ")"
      table.insert(configList, configInfo)
    end
  end

  guihooks.trigger('sendVehicleList', {models = modelList, configs = configList, filters = createFilters(modelList), displayInfo = displayInfo})
  if p then p:add("CEF request") end
end

Callers

@/ui/modules/vehicleselect/vehicleselect.js

        bngApi.engineLua('core_vehicles.requestList()')
        return d.promise