Constructor
new Extractor(gamePath, output)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
gamePath |
String | the path to the Factorio directory - contains "mods", "config", "data", etc. |
output |
String | the target output directory to dump a JSON of the Factorio data into. |
Members
(static) dataFiles :Array.<String>
- Source:
The Lua scripts that contain data information.
Type:
- Array.<String>
(static) itemTypes :Array.<String>
- Source:
The different categories of items in Factorio.
Type:
- Array.<String>
(private, static) utilScript :String
- Source:
A script that shims Factorio core utilities. Adapted from Foreman's DataCache.cs
Type:
- String
Methods
addLuaPath(addition) → {Promise}
- Source:
- To Do:
-
- Write unit tests.
Add a path to the Lua package lookup.
Parameters:
Name | Type | Description |
---|---|---|
addition |
String | the Lua source file, without a file extension. |
Returns:
resolves when the path has been added to the current Lua scope.
- Type
- Promise
clearLoadedPackages() → {Promise}
- Source:
- To Do:
-
- Write unit tests.
Because many mods use the same path to refer to different files, we need to clear the 'loaded' table so Lua doesn't think they're already loaded
Returns:
resolves when all packages have been cleared.
- Type
- Promise
extract() → {Promise}
- Source:
- To Do:
-
- Include list of mods in output.
- Parse images linked by resources, and (optionally) load them into the data.
Extract all of the game data, and save into a json
file.
Returns:
resolves once all tasks have been run.
- Type
- Promise
filterFields(objs, filters) → {Object}
- Source:
- To Do:
-
- Write unit tests.
Filters out repetitive fields to reduce the file output size.
Parameters:
Name | Type | Description |
---|---|---|
objs |
Object | the object to filter |
filters |
Object | fields to filter out. |
Returns:
obj
after the filters have been executed.
- Type
- Object
getLuaPath() → {Promise.<String>}
- Source:
- To Do:
-
- Write unit tests.
Get the current Lua path.
Returns:
the current Lua package path.
- Type
- Promise.<String>
setLuaPath(path) → {Promise}
- Source:
- To Do:
-
- Write unit tests.
Set the Lua path.
Parameters:
Name | Type | Description |
---|---|---|
path |
String | the new package path. |
Returns:
resolves when the Lua path has been set.
- Type
- Promise