GE Lua Documentation

Press F to search!

getList

Definition


-- @/lua/ge/extensions/scenario/scenariosLoader.lua:325
-- this function is used by the UI to display the list of scenarios, and by techCore to get the list of available scenarios
local function getList(subdirectory, includeAll, skipMissions)
  displayedRestrictMessage = false
  local levelPaths = core_levels.getLevelPaths()
  local scenarios = {}
  local paths = {}
  for _, path in ipairs(levelPaths) do
    if subdirectory ~= nil then
      path = path .. 'scenarios/' .. subdirectory .. '/'
    else
      path = path ..'scenarios/'
    end
    table.insert(paths, path)
  end
  table.insert(paths, "flowgraphEditor/scenarios/")
  -- find all normal scenarios.
  for _, path in ipairs(paths) do
    local subfiles = FS:findFiles(path, '*.json', -1, true, false)
    for _, scenarioFilename in ipairs(subfiles) do
      local newScenario = loadScenario(scenarioFilename)
      if newScenario then
        if (not shipping_build or includeAll)  or  (shipping_build and not newScenario.restrictToCampaign) then
          table.insert(scenarios, newScenario)
        end
      end
    end
  end
  -- find all Scenario-enabled flowgraphs.
  for _, p in ipairs(paths) do
    local fgFiles = FS:findFiles(p, '*.flow.json', -1, true, false)
    for _, fgPath in ipairs(fgFiles) do
      local fgData = jsonReadFile(fgPath)

      local dir, fn, ext = path.splitWithoutExt(fgPath, true)
      if fgData.isScenario then
        local scenarioData = {
          name = fgData.name or "New Flowgraph Scenario",
          description =  string.gsub(fgData.description or "No Description", "\\n", "\n"),
          authors = fgData.authors or "Anonymous",
          difficulty = fgData.difficulty or 40,
          date = (fgData.date or os.time()).."",
          flowgraph = fgPath,
          scenarioName = fn
        }
        local newScenario = processScenarioData(nil, scenarioData, fgPath)
        if newScenario then
          if (not shipping_build or includeAll)  or  (shipping_build and not newScenario.restrictToCampaign) then
            table.insert(scenarios, newScenario)
          end
        end
      end
    end
  end

  if not skipMissions then
    for _, m in ipairs(gameplay_missions_missions.get()) do
      if m.startTrigger.level and core_levels.getLevelByName(m.startTrigger.level) and m.isAvailableAsScenario then
        local scenarioData = M.getScenarioDataForMission(m)
        if scenarioData then
          if (not shipping_build or includeAll)  or  (shipping_build and not scenarioData.restrictToCampaign) then
            table.insert(scenarios, scenarioData)
          end
        end
      end
    end
  end

  return scenarios
end

Callers

@/lua/ge/extensions/gameplay/garageMode.lua
    local levelInfo = {}
    for _, level in ipairs(core_levels.getList()) do
      if string.lower(level.levelName) == string.lower(getCurrentLevelIdentifier()) then
@/lua/ge/extensions/scenario/scenariosLoader.lua
  -- refresh the list
  local scenarios = getList()
  -- select the scenario again
local function load(name)
  local list = getList()
  for _, v in ipairs(list) do
@/lua/ge/extensions/gameplay/sites/sitesManager.lua
  local fileCount = 0
  for _, info in ipairs(core_levels.getList()) do
    local level = string.lower(info.levelName)
@/lua/ge/extensions/core/input/bindings.lua
  actionToControl = nil
  for i,s in pairs(ActionMap:getList())do
    for j,v in ipairs(s) do
@/lua/ge/extensions/ui/gameplaySelector/tileGenerators/campaignTiles.lua
  if backend.backendName == "gameplaySelector" then
    for _, campaign in ipairs(campaign_campaignsLoader.getList()) do
      local item = {
@/lua/ge/extensions/ui/gameplaySelector/tileGenerators/scenarioTiles.lua
  if backend.backendName == "gameplaySelector" then
    for _, scenario in ipairs(scenario_scenariosLoader.getList(nil, false, true)) do
      local item = {
@/lua/ge/extensions/ui/gameplaySelector/tileGenerators/levelTiles.lua
local function onGameplaySelectorGetTiles(items)
  for _, level in ipairs(core_levels.getList()) do
    local defaultSpawnPointCount = 0
@/lua/ge/extensions/core/levels.lua

local function getList()
  if cache ~= nil then
  local res = {}
  for _, level in ipairs(getList()) do
    table.insert(res, level.levelName)
  local res = {}
  for _, level in ipairs(getList()) do
    table.insert(res, level.dir.."/")
  levelName = string.lower(levelName)
  for _, l in ipairs(getList()) do
    if string.lower(l.levelName) == levelName then
local function getListWithStats()
  return { levels = getList(), uiStats = freeroam_levelStats.getUiStats() }
end
@/lua/ge/extensions/editor/missionEditor.lua

  for _, scenario in ipairs(scenario_scenariosLoader.getList()) do
    local origin = "Scenario"
@/lua/ge/extensions/tech/techCore.lua
  scenarios = {}
  local scenarioList = scenariosLoader.getList(nil, true)
  for _, v in ipairs(scenarioList) do
M.handleGetLevels = function(request)
  local list = core_levels.getList()
  local resp = {type = 'GetLevels', result = list}
@/lua/ge/extensions/ui/apps/minimap/additionalInfo.lua
  else
    for _, lvl in ipairs(core_levels.getList()) do
      if string.lower(lvl.levelName) == getCurrentLevelIdentifier() then
@/lua/ge/extensions/util/stepHandler.lua
    local foundLevel = false
    for i, v in ipairs(core_levels.getList()) do
      if v.levelName:lower() == step.level:lower() then
@/ui/modules/rallyselect/rallyselect.js

  bngApi.engineLua('scenario_scenariosLoader.getList()', function(res) {
    $scope.filtered = []
@/lua/ge/extensions/freeroam/vueBigMap.lua
  }
  for _, lvl in ipairs(core_levels.getList()) do
    if string.lower(lvl.levelName) == getCurrentLevelIdentifier() then
@/ui/modules/campaignselect/campaignselect.js

    bngApi.engineLua('campaign_campaignsLoader.getList()', function(res) {
      $scope.filtered = []
@/lua/ge/extensions/util/docCreator.lua

  local levels = deepcopy(extensions.core_levels.getList())
  cleanupTable(job, levels)
@/ui/modules/scenarioselect/scenarioselect.js

  bngApi.engineLua('scenario_scenariosLoader.getList()', function(res) {
    $scope.filtered = []
@/lua/ge/extensions/gameplay/missions/missionManager.lua
    local foundLevel = false
    for i, v in ipairs(core_levels.getList()) do
      if v.levelName:lower() == step.level:lower() then
@/lua/ge/extensions/freeroam/bigMapPoiProvider.lua

  for _, lvl in ipairs(core_levels.getList()) do
    if string.lower(lvl.levelName) == getCurrentLevelIdentifier() then
@/lua/ge/extensions/career/modules/uiUtils.lua
local function getCareerCurrentLevelName()
  for _, lvl in ipairs(core_levels.getList()) do
    if string.lower(lvl.levelName) == getCurrentLevelIdentifier() then
@/lua/ge/extensions/editor/flowgraphEditor.lua
local function isActionMapEnabled(map)
  local list = ActionMap:getList()
  if list and list.active then
@/lua/ge/extensions/util/precompileShaders.lua
local function onInit()
    local allLevels = core_levels.getList()
    for _, value in pairs(allLevels) do
@/lua/ge/extensions/ui/bindingsLegend.lua
  local name = actionMapName.."ActionMap"
  for _, actionMap in ipairs(ActionMap:getList().active) do
    if actionMap.enabled and actionMap.name == name then
@/lua/ge/extensions/career/modules/spawnPoints.lua
    levelInfo = nil
    for _, info in ipairs(core_levels.getList()) do
      if string.lower(info.levelName) == string.lower(currentLevel) then
@/lua/ge/extensions/campaign/campaignsLoader.lua

local function getList()
  -- log('D', logTag, 'getList called...')

  local campaigns = getList()
  for _,campaign in pairs(campaigns) do
local function startByFolder(path, endCallback)
  local campaignList = getList()
  for _,camp in ipairs(campaignList) do