Constructor
new Mod(manifest, directory)
Parameters:
Name | Type | Description |
---|---|---|
manifest |
Object | the manifest file for this mod. |
directory |
String | the location for mod files. |
Members
_cleanupTasks :Array.<function()>
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>
Other mods that this mod is dependent on.
Type:
- Array.<ModDependency>
Methods
(static) loadFromManifest(dir) → {Promise.<Mod>}
Loads an unpacked Mod by path.
Parameters:
Name | Type | Description |
---|---|---|
dir |
String | the directory containing a manifest ( |
Returns:
the loaded Mod.
- Type
- Promise.<Mod>
(static) loadFromZip(zip) → {Promise.<Mod>}
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}
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}
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 |
Returns:
- Type
- void
cleanup() → {Promise}
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}
Determines if this mod depends on the given mod.
Parameters:
Name | Type | Description |
---|---|---|
mod |
Mod | the mod to compare |
ignoreOptional |
Boolean | if |
Returns:
true
if this mod depends on the given mod.
- Type
- Boolean
(private) parseDependencies() → {Array.<ModDependency>}
Parse the dependencies listed for this mod.
Returns:
the dependencies for this mod.
- Type
- Array.<ModDependency>
satisfiesDependency(dep) → {Boolean}
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