ModuleLoader

ModuleLoader

Locates Factorio modules, determines dependencies, and filters by enabled mods.

Constructor

new ModuleLoader(loadOpts)

Source:
Parameters:
Name Type Description
loadOpts ModuleLoaderOptions

default options to use when searching for mods.

Members

(private, static) defaultLoadOptions :ModuleLoaderOptions

Source:

The default loading options.

Type:

(private) _loadOpts :ModuleLoaderOptions

Source:

The default options to use when searching for mods.

Type:

Mod

Source:

The Mod class to use when creating new Mod instances. Can be overridden for testing, etc.

Methods

(private) added(modPath) → {Promise.<ModArray>}

Source:

Finds user-added game components.

Parameters:
Name Type Description
modPath String

the path to the mods directory inside a Factorio install, where user-added mods are located.

Returns:

The mods installed by the user.

Type
Promise.<ModArray>

all(opts) → {Promise.<ModArray>}

Source:
To Do:
  • Test returning only `vanilla` or only `added`

Find all Factorio Mods installed.

Parameters:
Name Type Description
opts ModuleLoaderOptions

options to control searching for mods.

Returns:

all mods installed.

Type
Promise.<ModArray>

enabled(modsopt, optsopt) → {Promise.<ModArray>}

Source:

Find all Factorio Mods that are enabled.

Parameters:
Name Type Attributes Description
mods ModArray <optional>

Optional The mods to filter. Defaults to searching for all mods.

opts ModuleLoaderOptions <optional>

options to control searching for mods.

Returns:

all mods installed and enabled.

Type
Promise.<ModArray>

(private) parseOpts(opts) → {ModuleLoaderOptions}

Source:

Merge the temporary options with the default options for this class instance and the global default options, including processing dependent options (like factorioDataPath defaulting to factorioPath + "/data")

Parameters:
Name Type Description
opts ModuleLoaderOptions

the current instance options

Returns:

the merged options

Type
ModuleLoaderOptions

sortedDependencies(modsopt) → {Promise.<ModArray>}

Source:
See:

Sort Factorio mods, so mods with dependencies are loaded after the dependencies.

Parameters:
Name Type Attributes Description
mods ModArray <optional>

Optional The mods to sort. Defaults to searching for all mods.

Returns:

resolves to a sorted list of the given mods.

Type
Promise.<ModArray>

(private) vanilla(dataPath) → {Promise.<ModArray>}

Source:

Finds the vanilla game components.

Parameters:
Name Type Description
dataPath String

the path to the data directory inside a Factorio install, where internal mods are located.

Returns:

The "mods" shipped with the vanilla game.

Type
Promise.<ModArray>