GE Lua Documentation

Press F to search!

getMissionReplayFiles

Definition


-- @/lua/ge/extensions/core/replay.lua:325

local function getMissionReplayFiles(mission, returnOnlyWithAttempt)
  local files = {}
  local filesWithUserSaved = {}

  if returnOnlyWithAttempt == nil then
    returnOnlyWithAttempt = false
  end

  -- add all the missions replays that have been automatically recorded
  for i, file in ipairs(FS:findFiles(M.getMissionReplaysPath(), '*.rpl', 0, false, false)) do
    table.insert(filesWithUserSaved, {file = file})
  end
  -- add all the user saved replays that correspong to the current environment. Ie freeroam or career, save slot
  for i, file in ipairs(FS:findFiles(getCurrentUserSavedReplayFilesPath(), '*.rpl', 0, false, false)) do
    table.insert(filesWithUserSaved, {file = file, userSaved = true})
  end

  local currentSaveSlot, _ = career_saveSystem.getCurrentSaveSlot()
  local isCurrentlyInCareer = career_career and career_career.isActive()

  local ret = {}
  for _, file in ipairs(filesWithUserSaved) do
    local dir, fn, ext = path.split(file.file)
    local metaFileName = dir .. fn .. ".rplMeta.json"
    local meta = jsonReadFile(metaFileName)
    if meta and meta.missionId == mission.id and ((returnOnlyWithAttempt and meta.attempt) or not returnOnlyWithAttempt) and ((isCurrentlyInCareer and meta.context.saveSlot == currentSaveSlot) or not isCurrentlyInCareer) then
      table.insert(ret, {
        replayFile = file.file,
        replayFileName = fn,
        meta = meta,
        userSaved = file.userSaved
      })
    end
  end


  table.sort(ret, function(a,b) return a.meta.time < b.meta.time end)
  return ret
end

Callers

@/lua/ge/extensions/flowgraph/modules/uiModule.lua
      header = "Replay Recording",
      recordingFiles = core_replay.getMissionReplayFiles(self.mgr.activity),
      pages = {
@/lua/ge/extensions/gameplay/missions/progress.lua

  local autoRecordings = core_replay.getMissionReplayFiles(mission, true)
@/lua/ge/extensions/flowgraph/modules/missionReplayModule.lua

function C:getMissionReplayFiles()
  local orderedReplays = {}
function C:deleteByCount()
  local files = self:getMissionReplayFiles()
  local diff = #files - settings.getValue('countReplayCapMode')
function C:deleteByMaxSize()
  local files = self:getMissionReplayFiles()
  local totalSize = 0
  if lastFrameState ~= "playback" and state.state == "playback" then
    currentMissionReplayFiles = core_replay.getMissionReplayFiles(self.mgr.activity)
@/lua/ge/extensions/core/replay.lua
  local meta = jsonReadFile(finalPath..fn..".rplMeta.json")
  local recordingFiles = getMissionReplayFiles(gameplay_missions_missions.getMissionById(meta.missionId))
  guihooks.trigger("recordingFilesUpdated", recordingFiles)
  local meta = jsonReadFile(missionReplaysPath..fn..".rplMeta.json")
  local recordingFiles = getMissionReplayFiles(gameplay_missions_missions.getMissionById(meta.missionId))
  guihooks.trigger("recordingFilesUpdated", recordingFiles)