GE Lua Documentation

Press F to search!

startWithLoadingLevel

Definition


-- @/lua/ge/extensions/gameplay/missions/missionManager.lua:905

local function startWithLoadingLevel(mission, userSettings, level)
  if not mission then
    log("E", logTag, "Couldn't start mission, mission id not found. " .. dumpsz(mission, 2))
    return true
  end
  if mission._isOngoing then
    log("E", logTag, "Couldn't start mission, it's already ongoing: "..dumpsz(mission, 2))
    return true
  end
  if taskData.active then
    log("W", logTag, "Attempting to start mission while there is an active task: " .. dumpsz(taskData, 3))
    return
  end

  local level = level or mission.startTrigger.level
  if not level then
    log("E", logTag, "Couldn't start mission, level not found. " .. dumpsz(mission, 2))
    return true
  end

  if foregroundMissionId then
    M.stopForegroundMissionInstantly()
  end


  taskData.data = {mission = mission, userSettings = userSettings, level = level}
  taskData.type = "start"
  taskData.steps = {
    {
      name = "taskLoadLevelStep",
      processTask = taskLoadLevelStep,
      level = level
    }, {
      name = "taskStartPreMissionHandling",
      processTask = taskStartPreMissionHandling
    }, {
      name = "taskStartVehicleStep",
      processTask = taskStartVehicleStep
    }, {
      name = "taskStartTrafficStep",
      processTask = taskStartTrafficStep
    }, {
      name = "taskStartMissionStep",
      processTask = taskStartMissionStep
    }
  }
  taskData.active = true
  taskData.currentStep = 1



  log("I", logTag, "Starting mission with loading level.")
end

Callers

@/lua/ge/extensions/gameplay/discover.lua
      local mission = gameplay_missions_missions.getMissionById(discover.missionId)
      gameplay_missions_missionManager.startWithLoadingLevel(mission)
    else
@/lua/ge/extensions/ui/gameplaySelector/tileGenerators/missionTiles.lua
        -- Start mission
        gameplay_missions_missionManager.startWithLoadingLevel(mission)
      end, {