checkUnlocks
Definition
-- @/lua/ge/extensions/career/branches.lua:460
local function checkUnlocks()
for id, branch in pairs(getBranches()) do
branch.unlocked = true
branch.unlockInfo = nil
branch.lockedReason = nil
branch.unlockInfos = nil
if branch.unlockCondition then
if branch.unlockCondition.type == "unlockFlag" then
branch.unlocked = career_modules_unlockFlags.getFlag(branch.unlockCondition.unlockFlag)
if not branch.unlocked then
local flagDefinition = career_modules_unlockFlags.getFlagDefinition(branch.unlockCondition.unlockFlag)
if flagDefinition then
branch.unlockInfo = flagDefinition.unlockInfo
branch.lockedReason = flagDefinition.lockedReason
end
end
elseif branch.unlockCondition.type == "anyNunlockFlags" then
local flags = branch.unlockCondition.unlockFlags
local n = branch.unlockCondition.n
branch.unlockInfos = {}
local met = 0
for _, flag in ipairs(flags) do
if career_modules_unlockFlags.getFlag(flag) then
met = met + 1
local flagDefinition = career_modules_unlockFlags.getFlagDefinition(flag)
if flagDefinition then
table.insert(branch.unlockInfos, {label = flagDefinition.label, icon = "badgeRoundStar", status = "completed", color = flagDefinition.color})
end
end
end
if met < n then
branch.unlocked = false
end
while met < n do
table.insert(branch.unlockInfos, {label = "ui.career.certification.anyCertification", icon = "badgeRoundStar", status = "open"})
met = met + 1
end
elseif branch.unlockCondition.type == "never" then
branch.unlocked = false
branch.unlockInfo = {type = "locked", label = "ui.career.inDevelopment"}
branch.lockedReason = {type = "locked", label = "ui.career.inDevelopment", icon = "lockClosed"}
end
end
end
end
Callers
@/lua/ge/extensions/career/modules/branches/landing.lua
-- first get all branches. then get all skills
career_branches.checkUnlocks()
local br = career_branches.getBranchById(branchId)
@/lua/ge/extensions/career/modules/partShopping.lua
local function isCargoLogisticsMaterialsUnlocked()
career_branches.checkUnlocks()
return career_branches.getBranchByPath('logistics-materials').unlocked