GE Lua Documentation

Press F to search!

expandUnlocks

Definition


-- @/lua/ge/extensions/career/branches.lua:396


local function expandUnlocks(skill, level, unlocks)
  local newUnlocks = {}
  for _, unlock in ipairs(unlocks) do
    if unlock.type == "automaticMission" then
      -- find all missions that are unloked by this skill and level
      local missions = {}
      for i, mission in ipairs(gameplay_missions_missions.get()) do
        if mission.careerSetup.showInCareer then
          for branchKey, _ in pairs(mission.unlocks.branchTags) do
            if branchKey == skill.id then
              table.insert(missions, mission)
            end
          end
        end
      end
      table.insert(newUnlocks, {
        type="unlockCard",
        heading="New Challenges",
        description=string.format("%d new challenges available.", #missions)
      })
    else
      table.insert(newUnlocks, unlock)
    end
  end
  return newUnlocks

end

Callers

@/lua/ge/extensions/career/branches.lua
    if level.unlocks then
      level.unlocks = M.expandUnlocks(branch, i, level.unlocks)
    end