GE Lua Documentation

Press F to search!

activateCareer

Definition


-- @/lua/ge/extensions/career/career.lua:219

local function activateCareer(removeVehicles)
  if careerActive then return end
  -- load career
  local saveSlot, savePath = career_saveSystem.getCurrentSaveSlot()
  if not saveSlot then return end
  extensions.hook("onBeforeCareerActivate")
  if removeVehicles == nil then
    removeVehicles = true
  end
  if core_groundMarkers then core_groundMarkers.setPath(nil) end

  careerActive = true
  log("I", "Loading career from " .. savePath .. "/career/" .. saveFile)
  local careerData = (savePath and jsonReadFile(savePath .. "/career/" .. saveFile)) or {}
  local newSave = tableIsEmpty(careerData)
  local levelToLoad = careerData.level or levelName
  boughtStarterVehicle = careerData.boughtStarterVehicle
  organizationInteraction = careerData.organizationInteraction or {}

  if not getCurrentLevelIdentifier() or (getCurrentLevelIdentifier() ~= levelToLoad) then
    spawn.preventPlayerSpawning = true
    freeroam_freeroam.startFreeroam(path.getPathLevelMain(levelToLoad), nil, false, nil, function()
      toggleCareerModules(true)
      initAfterLevelLoad(newSave)
      server.fadeoutLoadingScreen()
    end)
  else
    if removeVehicles then
      core_vehicles.removeAll()
    else
      removeNonTrafficVehicles()
    end
    toggleCareerModules(true, true)
    M.closeAllMenus()
    M.onUpdate = onUpdate
    initAfterLevelLoad(newSave)
  end
end

Callers

@/lua/ge/extensions/career/career.lua
    end
    activateCareer()
    return true
  if v.reactivate then
    activateCareer(false)
  end