GE Lua Documentation

Press F to search!

activateMod

Definition


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

local function activateMod(modname)
  if not mods[modname] then
     log('I', 'activateMod', 'mod not existing ' .. tostring(modname))
    return
  end
  if not FS:isMounted(mods[modname].fullpath) then
    mountEntry(mods[modname].fullpath, mods[modname].mountPoint)
  end

  local mountedFilesChange
  mountedFilesChange = _getModFsNotifFileList(modname,"added")
  local modScripts = _getModScriptFiles(modname)
  local mountPoint = ""
  if mods[modname].mountPoint then
    mountPoint = mods[modname].mountPoint
  end

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

  for k,v in ipairs(modScripts) do
    local status, ret = pcall(dofile, v)
    if not status then
      log('E', 'activateMod.modScript', 'Failed to execute ' .. v)
      log('E', 'activateMod.modScript', dumps(ret))
    end
  end

  mods[modname].active = true
  extensions.hook('onModActivated', deepcopy(mods[modname]))
  if mountedFilesChange and #mountedFilesChange>0 then
    _G.onFileChanged(mountedFilesChange) --main.lua
  end

  loadManualUnloadExtensions()

  stateChanged()
end

Callers

@/ui/modules/automation/automation.js
        } else {
          bngApi.engineLua('core_modmanager.activateMod("' + vm.localData.modname + '")')
        }
@/ui/modules/repository/repository.js
        } else {
          bngApi.engineLua('core_modmanager.activateMod("' + vm.localData.modname + '")')
        }
@/ui/modules/modmanager/modmanager.js
    } else {
      bngApi.engineLua('core_modmanager.activateMod("' + mod.modname + '")')
    }
        } else {
          bngApi.engineLua('core_modmanager.activateMod("' + $scope.mod.modname + '")')
        }
@/lua/ge/extensions/core/modmanager.lua
  if name then
    activateMod(name)
  else
      log('D', '', 'activateMod -- ' .. tostring(filename))
      activateMod(mod.modname)
    end