GE Lua Documentation

Press F to search!

activateAllMods

Definition


-- @/lua/ge/extensions/core/modmanager.lua:929

local function activateAllMods()
  local mountList = {}
  local mountedFilesChange = {}
  local modScripts = {}
  for modname, v in pairs(mods) do
    if not FS:isMounted(v.fullpath) then
      addMountEntryToList( mountList, v.fullpath, v.mountPoint )

      --fs notif and modscript
      local newMountedFilesChange = _getModFsNotifFileList(modname,"added")
      mountedFilesChange = arrayConcat(mountedFilesChange,newMountedFilesChange)
      local newModScripts = _getModScriptFiles(modname)
      if newModScripts and #newModScripts>0 then
        modScripts = arrayConcat(modScripts,newModScripts)
      end
    end

    if mods[modname] and not mods[modname].active then
      mods[modname].active = true
      extensions.hook('onModActivated', deepcopy(mods[modname]))
    end
  end

  if( #mountList > 0) then
    if not FS:mountList(mountList) then
      guihooks.trigger('modmanagerError', 'Error mounting mods')
      log('E', 'activateAllMods', 'mountList Error')
    end
  end

  log('D', 'activateAllMods', 'modScripts' .. dumps(modScripts))

  for k,v in ipairs(modScripts) do
    local status, ret = pcall(dofile, v)
    if not status then
      log('E', 'activateAllMods.modScript', 'Failed to execute ' .. v)
      log('E', 'activateAllMods.modScript', dumps(ret))
    end
  end
  _G.onFileChanged(mountedFilesChange) --main.lua

  loadManualUnloadExtensions()

  stateChanged()
end

Callers

@/ui/modules/modmanager/modmanager.js
      Utils.waitForCefAndAngular(() => {
        bngApi.engineLua('core_modmanager.activateAllMods()')
      })