GE Lua Documentation

Press F to search!

onGameplaySelectorGetTiles

Definition


-- @/lua/ge/extensions/ui/gameplaySelector/tileGenerators/scenarioTiles.lua:8

local function onGameplaySelectorGetTiles(items, backend)
  if backend.backendName == "gameplaySelector" then
    for _, scenario in ipairs(scenario_scenariosLoader.getList(nil, false, true)) do
      local item = {
        name = scenario.name,
        preview = scenario.previews and scenario.previews[1] or nil,
        favouriteIdx = 0,
        showFavouriteIconPercent = 0,
        showDetails = {scenarioSourceFile = scenario.sourceFile},

        system = "Scenarios (deprecated)",
        type = "Scenario (deprecated)",
        level = scenario.levelName,
        sourceIcons = {},
        order = -tonumber(scenario.date or 0) or 0,
        isLegacy = true,
        validBackends = {gameplaySelector = true},
        date = tonumber(scenario.date),
      }
      item.key = getKeyFromDetails(item.showDetails)
      item.showDetails.key = item.key
      if item.level then
        item.level = core_levels.getLevelTitle(item.level) or "Other..."
        item.level = translate(item.level)
      end

      if item.name then
        item.name = translate(item.name)
      end
      if scenario.official then
        table.insert(item.sourceIcons, {icon = "beamNG"})
      end
      if scenario.isAuxiliary then
        table.insert(item.sourceIcons, {icon = "bug"})
      end
      table.insert(items, item)
    end
  end
  --[[
  table.insert(items, {
    name = "More Scenarios...",
    system = "Other Gameplay",
    key = "moreScenarios",
    order = 100,
    isLegacy = true,
    validBackends = {freeroamSelector = true}
  })
    ]]
end

Callers

@/lua/ge/extensions/ui/gameplaySelector/tileGenerators/levelTiles.lua

local function onGameplaySelectorGetTiles(items)
  for _, level in ipairs(core_levels.getList()) do
@/lua/ge/extensions/ui/gameplaySelector/tileGenerators/missionTiles.lua

local function onGameplaySelectorGetTiles(items, backend)
  if backend.backendName == "gameplaySelector" then
@/lua/ge/extensions/ui/gameplaySelector/tileGenerators/campaignTiles.lua

local function onGameplaySelectorGetTiles(items, backend)
  if backend.backendName == "gameplaySelector" then