GE Lua Documentation

Press F to search!

saveBoundary

Definition


-- @/lua/ge/extensions/gameplay/crawl/saveSystem.lua:322

M.saveBoundary = function(boundary, filePath)
  if not boundary then
    log('E', logTag, 'No boundary to save')
    return false
  end

  if not filePath then
    log('E', logTag, 'No file path provided for boundary')
    return false
  end

  local serializedData = serializeBoundary(boundary)
  if not serializedData then
    return false
  end

  local dir = string.match(filePath, "^(.*)/[^/]*$")
  if dir then
    FS:directoryCreate(dir)
  end

  local success = jsonWriteFile(filePath, serializedData, true)
  if success then
    -- Update cache
    if not cache.boundaries then
      cache.boundaries = {}
    end
    cache.boundaries[filePath] = boundary
    return true
  else
    log('E', logTag, 'Failed to save boundary to: ' .. filePath)
    return false
  end
end

Callers

@/lua/ge/extensions/editor/crawlEditor/missionPortTool.lua

  local boundarySuccess = gameplay_crawl_saveSystem.saveBoundary(boundary, boundaryFile)
  local pathSuccess = gameplay_crawl_saveSystem.savePath(path, pathFile)
@/lua/ge/extensions/editor/crawlEditor.lua
    elseif objectType == "boundary" then
      gameplay_crawl_saveSystem.saveBoundary(object, newFilePath)
    elseif objectType == "startingPosition" then
      boundary._missionName = nil
      gameplay_crawl_saveSystem.saveBoundary(boundary, boundary._filePath)
    end
    if newObject then
      success = gameplay_crawl_saveSystem.saveBoundary(newObject, filePath)
    end
            if boundary._dirty then
              if gameplay_crawl_saveSystem.saveBoundary(boundary, boundary._filePath) then
                savedCount = savedCount + 1
            if boundary._dirty then
              if gameplay_crawl_saveSystem.saveBoundary(boundary, boundary._filePath) then
                savedCount = savedCount + 1
          if selectedBoundary then
            if gameplay_crawl_saveSystem.saveBoundary(selectedBoundary, selectedBoundary._filePath) then
              selectedBoundary._dirty = false