synthetic-factorio 0.0.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -45
- package/dist/ModManager.d.ts +6 -0
- package/dist/ModManager.js +46 -2
- package/dist/defines.d.ts +1710 -0
- package/dist/defines.js +1710 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +4 -2
- package/util_scripts/data_setup.lua +21 -17
- package/util_scripts/defines.lua +332 -326
- package/util_scripts/require_handler.lua +62 -62
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { FactorioEngine, FactorioEngineOptions } from './FactorioEngine.ts';
|
|
2
2
|
export { ModManager, ModManagerOptions, ModDownloadOptions, ModInstallOptions, ModPortalDownloadOptions } from './ModManager.ts';
|
|
3
3
|
export { tableToArray } from './utils.ts';
|
|
4
|
+
export { defines } from './defines.ts';
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "synthetic-factorio",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Synthetic Factorio runtime for unit testing",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "Spencer Guest",
|
|
7
7
|
"type": "module",
|
|
8
|
+
"repository": "https://github.com/sguest/synthetic-factorio",
|
|
8
9
|
"scripts": {
|
|
9
10
|
"test": "vitest",
|
|
10
11
|
"test:ci": "vitest run",
|
|
11
|
-
"build": "tsc"
|
|
12
|
+
"build": "tsc",
|
|
13
|
+
"generate-defines": "node scripts/generate-defines.ts"
|
|
12
14
|
},
|
|
13
15
|
"files": [
|
|
14
16
|
"dist/**/*.js",
|
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
-- define data and its extend and raw methods in lua, JS will later read this global to extract it
|
|
2
|
-
-- and may inject into data.raw to pre-populate the table
|
|
3
|
-
-- this is handled in lua instead of a JS callback for performance reasons
|
|
4
|
-
-- thousands of data.extend calls doing interop into JS is unusably slow
|
|
5
|
-
|
|
6
|
-
data = data or {}
|
|
7
|
-
data.raw = data.raw or {}
|
|
8
|
-
|
|
9
|
-
function data.extend(self, values)
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
-- define data and its extend and raw methods in lua, JS will later read this global to extract it
|
|
2
|
+
-- and may inject into data.raw to pre-populate the table
|
|
3
|
+
-- this is handled in lua instead of a JS callback for performance reasons
|
|
4
|
+
-- thousands of data.extend calls doing interop into JS is unusably slow
|
|
5
|
+
|
|
6
|
+
data = data or {}
|
|
7
|
+
data.raw = data.raw or {}
|
|
8
|
+
|
|
9
|
+
function data.extend(self, values)
|
|
10
|
+
-- Handle calling data.extend instead of data:extend
|
|
11
|
+
if(values == nil) then
|
|
12
|
+
values = self
|
|
13
|
+
end
|
|
14
|
+
for i, value in ipairs(values) do
|
|
15
|
+
-- space-age tries to extend on the string "./data/__space-age__/sound/ambient/space/interlude-6/interlude-6.lua"
|
|
16
|
+
-- (i.e. not a valid prototype object, just that string) so we need to gracefully handle invalid objects
|
|
17
|
+
if(value.name ~= nil and value.type ~= nil) then
|
|
18
|
+
data.raw[value.type] = data.raw[value.type] or {}
|
|
19
|
+
data.raw[value.type][value.name] = value
|
|
20
|
+
end
|
|
21
|
+
end
|
|
18
22
|
end
|