Mod

Mod

A Factorio mod.

Constructor

new Mod(manifest, directory)

Source:
Parameters:
Name Type Description
manifest Object

the manifest file for this mod.

directory String

the location for mod files.

Members

_cleanupTasks :Array.<function()>

Source:

A list of cleanup tasks that will remove temporary files. Tasks can return a Promise for longer-running tasks.

Type:
  • Array.<function()>

_parsedDependencies :Array.<ModDependency>

Source:

Other mods that this mod is dependent on.

Type:

Methods

(static) loadFromManifest(dir) → {Promise.<Mod>}

Source:

Loads an unpacked Mod by path.

Parameters:
Name Type Description
dir String

the directory containing a manifest (info.json) file. directory.

Returns:

the loaded Mod.

Type
Promise.<Mod>

(static) loadFromZip(zip) → {Promise.<Mod>}

Source:

Loads a Mod given the path to the mod's zipped data.

Parameters:
Name Type Description
zip String

the patht to a zipped mod directory.

Returns:

the loaded Mod.

Type
Promise.<Mod>

(static) versionGreater(version, test) → {Boolean}

Source:

Checks that the version is larger than the test version.

Parameters:
Name Type Description
version String

the version that should be larger.

test String

the version that should be smaller.

Returns:

true if version is larger than test.

Type
Boolean

addCleanup(task) → {void}

Source:

Add a task to execute when cleaning up this Mod.

Parameters:
Name Type Description
task function

the additional task to run during cleanup. Can return a Promise for longer tasks.

Returns:
Type
void

cleanup() → {Promise}

Source:

Run all cleanup tasks to remove temporary files used when creating the mod.

Returns:

resolves when all temporary files have been cleaned up.

Type
Promise

dependsOn(mod, ignoreOptional) → {Boolean}

Source:

Determines if this mod depends on the given mod.

Parameters:
Name Type Description
mod Mod

the mod to compare

ignoreOptional Boolean

if true, optional dependencies are not compared. Defaults to false.

Returns:

true if this mod depends on the given mod.

Type
Boolean

(private) parseDependencies() → {Array.<ModDependency>}

Source:

Parse the dependencies listed for this mod.

Returns:

the dependencies for this mod.

Type
Array.<ModDependency>

satisfiesDependency(dep) → {Boolean}

Source:

Determines if this mod satisfies the given dependency selection.

Parameters:
Name Type Description
dep ModDependency

the dependency to check against.

Returns:

true if the mod satisfies the dependency.

Type
Boolean