typed-factorio 1.4.0 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- package/Changelog.md +28 -8
- package/README.md +14 -19
- package/custom-index-template.d.ts +1 -0
- package/generated/builtin-types.d.ts +24 -19
- package/generated/classes.d.ts +6382 -8710
- package/generated/concepts.d.ts +3110 -1937
- package/generated/defines.d.ts +126 -193
- package/generated/events.d.ts +250 -446
- package/generated/global-functions.d.ts +33 -0
- package/generated/global-objects.d.ts +7 -14
- package/package.json +22 -21
- package/runtime/index.d.ts +1 -0
- package/runtime/librariesAndFunctions.d.ts +0 -32
@@ -0,0 +1,33 @@
|
|
1
|
+
// This is an auto-generated file. Do not edit directly!
|
2
|
+
|
3
|
+
/** @noSelfInFile */
|
4
|
+
|
5
|
+
/**
|
6
|
+
* `log()` can print {@link LocalisedString LocalisedStrings} to the Factorio {@linkplain https://wiki.factorio.com/Log_file log file}. This, in combination with the serpent library, makes debugging in the data stage easier because it allows the inspection of entire prototype tables. For example, printing all properties of the sulfur item prototype can be done like so: `log(serpent.block(data.raw["item"]["sulfur"]))`
|
7
|
+
* @see {@link https://lua-api.factorio.com/latest/Libraries.html#2.-new-functions Online documentation}
|
8
|
+
*/
|
9
|
+
declare function log(string: LocalisedString): void
|
10
|
+
|
11
|
+
/**
|
12
|
+
* `localised_print()` allows printing {@link LocalisedString} to stdout without polluting the Factorio {@linkplain https://wiki.factorio.com/Log_file log file}. This is primarily useful when communicating with external tools that launch Factorio as a child process.
|
13
|
+
* @see {@link https://lua-api.factorio.com/latest/Libraries.html#2.-new-functions Online documentation}
|
14
|
+
*/
|
15
|
+
declare function localised_print(string: LocalisedString): void
|
16
|
+
|
17
|
+
/**
|
18
|
+
* Factorio provides the `table_size()` function as a simple way to determine the size of tables with non-continuous keys, as the standard `#` operator does not work correctly for these. The function is a C++ implementation of the following Lua code, which is faster than doing the same in Lua:
|
19
|
+
*
|
20
|
+
* ```
|
21
|
+
* local function size(t)
|
22
|
+
* local count = 0
|
23
|
+
* for k,v in pairs(t) do
|
24
|
+
* count = count + 1
|
25
|
+
* end
|
26
|
+
* return count
|
27
|
+
* end
|
28
|
+
* ```
|
29
|
+
*
|
30
|
+
* Note that `table_size()` does not work correctly for {@link LuaCustomTable}, their size has to be determined with {@link LuaCustomTable#length LuaCustomTable::length} instead.
|
31
|
+
* @see {@link https://lua-api.factorio.com/latest/Libraries.html#2.-new-functions Online documentation}
|
32
|
+
*/
|
33
|
+
declare function table_size(table: table): uint
|
@@ -4,49 +4,42 @@
|
|
4
4
|
|
5
5
|
/**
|
6
6
|
* This is the main object, through which most of the API is accessed. It is, however, not available inside handlers registered with {@link LuaBootstrap#on_load LuaBootstrap::on_load}.
|
7
|
-
*
|
8
|
-
* {@link https://lua-api.factorio.com/latest/ View documentation}
|
7
|
+
* @see {@link https://lua-api.factorio.com/latest/ Online documentation}
|
9
8
|
*/
|
10
9
|
declare const game: LuaGameScript
|
11
10
|
|
12
11
|
/**
|
13
12
|
* Provides an interface for registering event handlers.
|
14
|
-
*
|
15
|
-
* {@link https://lua-api.factorio.com/latest/ View documentation}
|
13
|
+
* @see {@link https://lua-api.factorio.com/latest/ Online documentation}
|
16
14
|
*/
|
17
15
|
declare const script: LuaBootstrap
|
18
16
|
|
19
17
|
/**
|
20
18
|
* Allows inter-mod communication by way of providing a repository of interfaces that is shared by all mods.
|
21
|
-
*
|
22
|
-
* {@link https://lua-api.factorio.com/latest/ View documentation}
|
19
|
+
* @see {@link https://lua-api.factorio.com/latest/ Online documentation}
|
23
20
|
*/
|
24
21
|
declare const remote: LuaRemote
|
25
22
|
|
26
23
|
/**
|
27
24
|
* Allows registering custom commands for the in-game console accessible via the grave key.
|
28
|
-
*
|
29
|
-
* {@link https://lua-api.factorio.com/latest/ View documentation}
|
25
|
+
* @see {@link https://lua-api.factorio.com/latest/ Online documentation}
|
30
26
|
*/
|
31
27
|
declare const commands: LuaCommandProcessor
|
32
28
|
|
33
29
|
/**
|
34
30
|
* Allows reading the current mod settings.
|
35
|
-
*
|
36
|
-
* {@link https://lua-api.factorio.com/latest/ View documentation}
|
31
|
+
* @see {@link https://lua-api.factorio.com/latest/ Online documentation}
|
37
32
|
*/
|
38
33
|
declare const settings: LuaSettings
|
39
34
|
|
40
35
|
/**
|
41
36
|
* Allows printing messages to the calling RCON instance if any.
|
42
|
-
*
|
43
|
-
* {@link https://lua-api.factorio.com/latest/ View documentation}
|
37
|
+
* @see {@link https://lua-api.factorio.com/latest/ Online documentation}
|
44
38
|
*/
|
45
39
|
declare const rcon: LuaRCON
|
46
40
|
|
47
41
|
/**
|
48
42
|
* Allows rendering of geometric shapes, text and sprites in the game world.
|
49
|
-
*
|
50
|
-
* {@link https://lua-api.factorio.com/latest/ View documentation}
|
43
|
+
* @see {@link https://lua-api.factorio.com/latest/ Online documentation}
|
51
44
|
*/
|
52
45
|
declare const rendering: LuaRendering
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "typed-factorio",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.5.0",
|
4
4
|
"description": "Featureful typescript definitions for the the Factorio modding lua api.",
|
5
5
|
"keywords": [
|
6
6
|
"factorio",
|
@@ -27,29 +27,30 @@
|
|
27
27
|
},
|
28
28
|
"peerDependencies": {
|
29
29
|
"lua-types": "^2.11.0",
|
30
|
-
"typescript-to-lua": "^1.
|
30
|
+
"typescript-to-lua": "^1.6.1"
|
31
31
|
},
|
32
32
|
"devDependencies": {
|
33
|
-
"@types/jest": "^
|
34
|
-
"@types/node": "^
|
35
|
-
"@types/prettier": "^2.4
|
36
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
37
|
-
"@typescript-eslint/parser": "^5.
|
38
|
-
"chalk": "^
|
39
|
-
"eslint": "^8.
|
40
|
-
"eslint-config-prettier": "^8.
|
41
|
-
"eslint-config-standard": "^
|
42
|
-
"eslint-import-resolver-typescript": "^
|
43
|
-
"eslint-plugin-import": "^2.
|
33
|
+
"@types/jest": "^28.1.6",
|
34
|
+
"@types/node": "^18.6.2",
|
35
|
+
"@types/prettier": "^2.6.4",
|
36
|
+
"@typescript-eslint/eslint-plugin": "^5.31.0",
|
37
|
+
"@typescript-eslint/parser": "^5.31.0",
|
38
|
+
"chalk": "^4.1.2",
|
39
|
+
"eslint": "^8.20.0",
|
40
|
+
"eslint-config-prettier": "^8.5.0",
|
41
|
+
"eslint-config-standard": "^17.0.0",
|
42
|
+
"eslint-import-resolver-typescript": "^3.3.0",
|
43
|
+
"eslint-plugin-import": "^2.26.0",
|
44
|
+
"eslint-plugin-n": "^15.2.4",
|
44
45
|
"eslint-plugin-node": "^11.1.0",
|
45
|
-
"eslint-plugin-prettier": "^4.
|
46
|
-
"eslint-plugin-promise": "^
|
47
|
-
"jest": "^
|
46
|
+
"eslint-plugin-prettier": "^4.2.1",
|
47
|
+
"eslint-plugin-promise": "^6.0.0",
|
48
|
+
"jest": "^28.1.3",
|
48
49
|
"lua-types": "^2.11.0",
|
49
|
-
"prettier": "^2.
|
50
|
-
"ts-jest": "^
|
51
|
-
"ts-node": "^10.
|
52
|
-
"typescript": "4.
|
53
|
-
"typescript-to-lua": "^1.
|
50
|
+
"prettier": "^2.7.1",
|
51
|
+
"ts-jest": "^28.0.7",
|
52
|
+
"ts-node": "^10.9.1",
|
53
|
+
"typescript": "^4.7.4",
|
54
|
+
"typescript-to-lua": "^1.7.1"
|
54
55
|
}
|
55
56
|
}
|
package/runtime/index.d.ts
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
// generated
|
4
4
|
/// <reference path="../generated/builtin-types.d.ts" />
|
5
5
|
/// <reference path="../generated/global-objects.d.ts" />
|
6
|
+
/// <reference path="../generated/global-functions.d.ts" />
|
6
7
|
/// <reference path="../generated/defines.d.ts" />
|
7
8
|
/// <reference path="../generated/events.d.ts" />
|
8
9
|
/// <reference path="../generated/classes.d.ts" />
|
@@ -89,35 +89,3 @@ declare namespace serpent {
|
|
89
89
|
*/
|
90
90
|
function load<T>(str: string, options?: { safe?: boolean }): LuaMultiReturn<[true, T] | [false, string]>
|
91
91
|
}
|
92
|
-
|
93
|
-
/**
|
94
|
-
* This function allows to log {@link LocalisedString} to the Factorio
|
95
|
-
* {@link https://wiki.factorio.com/Log_file log file}. This, in combination with serpent, makes debugging in the data
|
96
|
-
* stage easier, because it allows to simply inspect entire prototype tables. For example, this allows to see all
|
97
|
-
* properties of the sulfur item prototype: `log(serpent.block(data.raw["item"]["sulfur"]))`
|
98
|
-
*/
|
99
|
-
declare function log(ls: LocalisedString): void
|
100
|
-
|
101
|
-
/**
|
102
|
-
* This function allows printing {@link LocalisedString}s to stdout without polluting the logfile. This is primarily
|
103
|
-
* useful for communicating with external tools that launch Factorio as a child process.
|
104
|
-
*/
|
105
|
-
declare function localised_print(ls: LocalisedString): void
|
106
|
-
|
107
|
-
/**
|
108
|
-
* Factorio provides the function `table_size()` as a simple way to find the size of tables with non-continuous keys,
|
109
|
-
* because the standard `#` does not work correctly for these. The function is a C++-side implementation of the
|
110
|
-
* following Lua code, thus it is faster than using this code in Lua:
|
111
|
-
*
|
112
|
-
* local function size(t)
|
113
|
-
* local count = 0
|
114
|
-
* for k,v in pairs(t) do
|
115
|
-
* count = count + 1
|
116
|
-
* end
|
117
|
-
* return count
|
118
|
-
* end
|
119
|
-
*
|
120
|
-
* Note that `table_size()` does not work correctly for {@link LuaCustomTable}s, their size has to be determined with
|
121
|
-
* {@link LuaCustomTable.length LuaCustomTable::operator #} instead.
|
122
|
-
*/
|
123
|
-
declare function table_size(tbl: table): number
|