typed-factorio 0.13.2 → 0.16.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/Changelog.md +135 -105
- package/LICENSE +21 -21
- package/README.md +133 -113
- package/data/types.d.ts +13 -13
- package/generated/classes.d.ts +12600 -6696
- package/generated/concepts.d.ts +125 -18
- package/generated/events.d.ts +27 -27
- package/generated/index.d.ts +3 -1
- package/generator/typescript-internal.d.ts +9 -0
- package/package.json +58 -58
- package/runtime/index.d.ts +10 -10
- package/runtime/librariesAndFunctions.d.ts +123 -123
- package/runtime/mod-gui.d.ts +11 -11
- package/runtime/pairs.d.ts +14 -13
- package/runtime/util.d.ts +116 -120
- package/settings/types.d.ts +120 -120
@@ -1,123 +1,123 @@
|
|
1
|
-
// from https://lua-api.factorio.com/latest/Libraries.html
|
2
|
-
// last updated for 1.1.35, 1.1.36, 1.1.37
|
3
|
-
|
4
|
-
/** @noSelfInFile */
|
5
|
-
|
6
|
-
/** @noSelf */
|
7
|
-
interface SerpentOptions {
|
8
|
-
/** Indentation; triggers long multi-line output. */
|
9
|
-
indent: string
|
10
|
-
/** Provide stringified value in a comment (up to maxlevel of depth). */
|
11
|
-
comment: boolean | number
|
12
|
-
/** Sort keys. */
|
13
|
-
sortkeys: boolean | ((this: void, keys: any[], table: any) => void)
|
14
|
-
/** Force sparse encoding (no nil filling based on #t). */
|
15
|
-
sparse: boolean
|
16
|
-
/** Remove spaces. */
|
17
|
-
compact: boolean
|
18
|
-
/** Raise fatal error on non-serializable values. */
|
19
|
-
fatal: boolean
|
20
|
-
/** Disable bytecode serialization for easy comparison. */
|
21
|
-
nocode: boolean
|
22
|
-
/** Disable checking numbers against undefined and huge values. */
|
23
|
-
nohuge: boolean
|
24
|
-
/** Specify max level up to which to expand nested tables. */
|
25
|
-
maxlevel: number
|
26
|
-
/** Specify max number of elements in a table. */
|
27
|
-
maxnum: number
|
28
|
-
/** Specify max length for all table elements. */
|
29
|
-
maxlength: number
|
30
|
-
/**
|
31
|
-
* Use __tostring metamethod when serializing tables (v0.29); set to false to disable and serialize the table as is,
|
32
|
-
* even when __tostring is present.
|
33
|
-
*/
|
34
|
-
metatostring: boolean
|
35
|
-
/**
|
36
|
-
* Specify format for numeric values as shortest possible round-trippable double (v0.30). Use "%.16g" for better
|
37
|
-
* readability and "%.17g" (the default value) to preserve floating point precision.
|
38
|
-
*/
|
39
|
-
numformat: string
|
40
|
-
/** Allows to specify a list of values to ignore (as keys). */
|
41
|
-
valignore: string[]
|
42
|
-
/** Allows to specify the list of keys to be serialized. Any keys not in this list are not included in final output (as keys). */
|
43
|
-
keyallow: string[]
|
44
|
-
/** Allows to specity the list of keys to ignore in serialization. */
|
45
|
-
keyignore: string[]
|
46
|
-
/** Allows to specify a list of value types to ignore (as keys). */
|
47
|
-
valtypeignore: string[]
|
48
|
-
/** Provide custom output for tables. */
|
49
|
-
custom(opts: {
|
50
|
-
/** The name of the current element with '=' or an empty string in case of array index, */
|
51
|
-
tag: string
|
52
|
-
/** An opening table bracket { and associated indentation and newline (if any), */
|
53
|
-
head: string
|
54
|
-
/** Table elements concatenated into a string using commas and indentation/newlines (if any), */
|
55
|
-
body: string
|
56
|
-
/** A closing table bracket } and associated indentation and newline (if any), and */
|
57
|
-
tail: string
|
58
|
-
/** The current level. */
|
59
|
-
level: number
|
60
|
-
}): string
|
61
|
-
/** Name; triggers full serialization with self-ref section. */
|
62
|
-
name: string
|
63
|
-
|
64
|
-
refcomment: boolean | number
|
65
|
-
tablecomment: boolean | number
|
66
|
-
}
|
67
|
-
|
68
|
-
/**
|
69
|
-
* Factorio provides the {@link https://github.com/pkulchenko/serpent serpent library} as a global variable `serpent` for
|
70
|
-
* all mods to use. It allows for easy debugging of tables, because serpent makes it trivial to print them, for example
|
71
|
-
* by using `serpent.block()`. However, serpent cannot pretty-print LuaObjects such as LuaEntity. The serpent library
|
72
|
-
* was modified to improve determinism, e.g. comments are turned off by default to avoid returning table addresses.
|
73
|
-
* Furthermore, two options were added: `refcomment` (true/false/maxlevel) and `tablecomment` (true/false/maxlevel),
|
74
|
-
* which allow to separately control the self-reference and table value output of the `comment` option.
|
75
|
-
*/
|
76
|
-
declare namespace serpent {
|
77
|
-
/** Full serialization; sets name, compact and sparse options; */
|
78
|
-
function dump(tbl: unknown, options?: Partial<SerpentOptions>): string
|
79
|
-
|
80
|
-
/** Single line pretty printing, no self-ref section; sets sortkeys and comment options; */
|
81
|
-
function line(tbl: unknown, options?: Partial<SerpentOptions>): string
|
82
|
-
|
83
|
-
/** Multi-line indented pretty printing, no self-ref section; sets indent, sortkeys, and comment options. */
|
84
|
-
function block(tbl: unknown, options?: Partial<SerpentOptions>): string
|
85
|
-
|
86
|
-
/**
|
87
|
-
* For loading serialized fragments, serpent also provides `load` function that adds safety checks and reports an
|
88
|
-
* error if there is any executable code in the fragment.
|
89
|
-
*/
|
90
|
-
function load<T>(str: string, options?: { safe?: boolean }): LuaMultiReturn<[true, T] | [false, string]>
|
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
|
1
|
+
// from https://lua-api.factorio.com/latest/Libraries.html
|
2
|
+
// last updated for 1.1.35, 1.1.36, 1.1.37
|
3
|
+
|
4
|
+
/** @noSelfInFile */
|
5
|
+
|
6
|
+
/** @noSelf */
|
7
|
+
interface SerpentOptions {
|
8
|
+
/** Indentation; triggers long multi-line output. */
|
9
|
+
indent: string
|
10
|
+
/** Provide stringified value in a comment (up to maxlevel of depth). */
|
11
|
+
comment: boolean | number
|
12
|
+
/** Sort keys. */
|
13
|
+
sortkeys: boolean | ((this: void, keys: any[], table: any) => void)
|
14
|
+
/** Force sparse encoding (no nil filling based on #t). */
|
15
|
+
sparse: boolean
|
16
|
+
/** Remove spaces. */
|
17
|
+
compact: boolean
|
18
|
+
/** Raise fatal error on non-serializable values. */
|
19
|
+
fatal: boolean
|
20
|
+
/** Disable bytecode serialization for easy comparison. */
|
21
|
+
nocode: boolean
|
22
|
+
/** Disable checking numbers against undefined and huge values. */
|
23
|
+
nohuge: boolean
|
24
|
+
/** Specify max level up to which to expand nested tables. */
|
25
|
+
maxlevel: number
|
26
|
+
/** Specify max number of elements in a table. */
|
27
|
+
maxnum: number
|
28
|
+
/** Specify max length for all table elements. */
|
29
|
+
maxlength: number
|
30
|
+
/**
|
31
|
+
* Use __tostring metamethod when serializing tables (v0.29); set to false to disable and serialize the table as is,
|
32
|
+
* even when __tostring is present.
|
33
|
+
*/
|
34
|
+
metatostring: boolean
|
35
|
+
/**
|
36
|
+
* Specify format for numeric values as shortest possible round-trippable double (v0.30). Use "%.16g" for better
|
37
|
+
* readability and "%.17g" (the default value) to preserve floating point precision.
|
38
|
+
*/
|
39
|
+
numformat: string
|
40
|
+
/** Allows to specify a list of values to ignore (as keys). */
|
41
|
+
valignore: string[]
|
42
|
+
/** Allows to specify the list of keys to be serialized. Any keys not in this list are not included in final output (as keys). */
|
43
|
+
keyallow: string[]
|
44
|
+
/** Allows to specity the list of keys to ignore in serialization. */
|
45
|
+
keyignore: string[]
|
46
|
+
/** Allows to specify a list of value types to ignore (as keys). */
|
47
|
+
valtypeignore: string[]
|
48
|
+
/** Provide custom output for tables. */
|
49
|
+
custom(opts: {
|
50
|
+
/** The name of the current element with '=' or an empty string in case of array index, */
|
51
|
+
tag: string
|
52
|
+
/** An opening table bracket { and associated indentation and newline (if any), */
|
53
|
+
head: string
|
54
|
+
/** Table elements concatenated into a string using commas and indentation/newlines (if any), */
|
55
|
+
body: string
|
56
|
+
/** A closing table bracket } and associated indentation and newline (if any), and */
|
57
|
+
tail: string
|
58
|
+
/** The current level. */
|
59
|
+
level: number
|
60
|
+
}): string
|
61
|
+
/** Name; triggers full serialization with self-ref section. */
|
62
|
+
name: string
|
63
|
+
|
64
|
+
refcomment: boolean | number
|
65
|
+
tablecomment: boolean | number
|
66
|
+
}
|
67
|
+
|
68
|
+
/**
|
69
|
+
* Factorio provides the {@link https://github.com/pkulchenko/serpent serpent library} as a global variable `serpent` for
|
70
|
+
* all mods to use. It allows for easy debugging of tables, because serpent makes it trivial to print them, for example
|
71
|
+
* by using `serpent.block()`. However, serpent cannot pretty-print LuaObjects such as LuaEntity. The serpent library
|
72
|
+
* was modified to improve determinism, e.g. comments are turned off by default to avoid returning table addresses.
|
73
|
+
* Furthermore, two options were added: `refcomment` (true/false/maxlevel) and `tablecomment` (true/false/maxlevel),
|
74
|
+
* which allow to separately control the self-reference and table value output of the `comment` option.
|
75
|
+
*/
|
76
|
+
declare namespace serpent {
|
77
|
+
/** Full serialization; sets name, compact and sparse options; */
|
78
|
+
function dump(tbl: unknown, options?: Partial<SerpentOptions>): string
|
79
|
+
|
80
|
+
/** Single line pretty printing, no self-ref section; sets sortkeys and comment options; */
|
81
|
+
function line(tbl: unknown, options?: Partial<SerpentOptions>): string
|
82
|
+
|
83
|
+
/** Multi-line indented pretty printing, no self-ref section; sets indent, sortkeys, and comment options. */
|
84
|
+
function block(tbl: unknown, options?: Partial<SerpentOptions>): string
|
85
|
+
|
86
|
+
/**
|
87
|
+
* For loading serialized fragments, serpent also provides `load` function that adds safety checks and reports an
|
88
|
+
* error if there is any executable code in the fragment.
|
89
|
+
*/
|
90
|
+
function load<T>(str: string, options?: { safe?: boolean }): LuaMultiReturn<[true, T] | [false, string]>
|
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
|
package/runtime/mod-gui.d.ts
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
/** @noSelfInFile */
|
2
|
-
|
3
|
-
/** @noResolution */
|
4
|
-
declare module "mod-gui" {
|
5
|
-
const button_style: string
|
6
|
-
const frame_style: string
|
7
|
-
|
8
|
-
function get_button_flow(player: LuaPlayer): FrameGuiElement
|
9
|
-
|
10
|
-
function get_frame_flow(player: LuaPlayer): FlowGuiElement
|
11
|
-
}
|
1
|
+
/** @noSelfInFile */
|
2
|
+
|
3
|
+
/** @noResolution */
|
4
|
+
declare module "mod-gui" {
|
5
|
+
const button_style: string
|
6
|
+
const frame_style: string
|
7
|
+
|
8
|
+
function get_button_flow(player: LuaPlayer): FrameGuiElement
|
9
|
+
|
10
|
+
function get_frame_flow(player: LuaPlayer): FlowGuiElement
|
11
|
+
}
|
package/runtime/pairs.d.ts
CHANGED
@@ -1,13 +1,14 @@
|
|
1
|
-
/** @noSelfInFile */
|
2
|
-
|
3
|
-
/**
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
1
|
+
/** @noSelfInFile */
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Iterating with `pairs` will only iterate the array part of a {@link LuaCustomTable}.
|
5
|
+
*
|
6
|
+
* **Note**: you can also iterate on a LuaCustomTable directly without using `pairs`, e.g. `for(const [k, v] of table)`.
|
7
|
+
*/
|
8
|
+
declare function pairs<V>(table: LuaCustomTable<number | string, V>): LuaIterable<LuaMultiReturn<[number, V]>>
|
9
|
+
|
10
|
+
/** **Note**: you can also iterate on a LuaCustomTable directly without using `pairs`, e.g. `for(const [k, v] of table)`. */
|
11
|
+
declare function pairs<K extends number | string, V>(table: LuaCustomTable<K, V>): LuaIterable<LuaMultiReturn<[K, V]>>
|
12
|
+
|
13
|
+
/** @deprecated {@link LuaCustomTable} cannot be iterated with `ipairs`; Use {@link pairs} instead. */
|
14
|
+
declare function ipairs(table: LuaCustomTable<any, any>): never
|
package/runtime/util.d.ts
CHANGED
@@ -1,120 +1,116 @@
|
|
1
|
-
// "util" is declared only as a module, even though it also modifies global variables
|
2
|
-
// This is both because of limitations in `declare module`, and that modules are much friendlier to tooling.
|
3
|
-
|
4
|
-
/** @noSelfInFile */
|
5
|
-
|
6
|
-
/** @noResolution */
|
7
|
-
declare module "util" {
|
8
|
-
namespace table {
|
9
|
-
function deepcopy<T>(table: T): T
|
10
|
-
|
11
|
-
function compare<T>(tb1: T, tb2: T): boolean
|
12
|
-
}
|
13
|
-
|
14
|
-
function copy<T>(table: T): T
|
15
|
-
|
16
|
-
function distance(position1: Position, position2: Position): number
|
17
|
-
|
18
|
-
function positiontostr(position: Position): string
|
19
|
-
|
20
|
-
function formattime(ticks: number): string
|
21
|
-
|
22
|
-
/** Supports 'rrggbb', 'rgb', 'rrggbbaa', 'rgba', 'ww', 'w' */
|
23
|
-
function color(hex: string): ColorTable
|
24
|
-
|
25
|
-
function premul_color(color: Color): ColorTable
|
26
|
-
|
27
|
-
function mix_color(c1: Color, c2: Color): ColorArray
|
28
|
-
|
29
|
-
function multiply_color(c1: Color, n: number): ColorArray
|
30
|
-
|
31
|
-
function moveposition(
|
32
|
-
position: Position,
|
33
|
-
direction: defines.direction.north | defines.direction.east | defines.direction.south | defines.direction.west,
|
34
|
-
distance: number
|
35
|
-
): Position
|
36
|
-
function moveposition(
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
function
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
function
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
function
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
function
|
76
|
-
|
77
|
-
function
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
// omitted:
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
}
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
function
|
116
|
-
|
117
|
-
function list_to_map<T extends keyof any>(list: T[]): Record<T, true>
|
118
|
-
function list_to_map<T>(list: T[]): LuaTable<T, true>
|
119
|
-
function list_to_map<T>(list: T): LuaTable<T[keyof T], true>
|
120
|
-
}
|
1
|
+
// "util" is declared only as a module, even though it also modifies global variables
|
2
|
+
// This is both because of limitations in `declare module`, and that modules are much friendlier to tooling.
|
3
|
+
|
4
|
+
/** @noSelfInFile */
|
5
|
+
|
6
|
+
/** @noResolution */
|
7
|
+
declare module "util" {
|
8
|
+
namespace table {
|
9
|
+
function deepcopy<T>(table: T): T
|
10
|
+
|
11
|
+
function compare<T>(tb1: T, tb2: T): boolean
|
12
|
+
}
|
13
|
+
|
14
|
+
function copy<T>(table: T): T
|
15
|
+
|
16
|
+
function distance(position1: Position, position2: Position): number
|
17
|
+
|
18
|
+
function positiontostr(position: Position): string
|
19
|
+
|
20
|
+
function formattime(ticks: number): string
|
21
|
+
|
22
|
+
/** Supports 'rrggbb', 'rgb', 'rrggbbaa', 'rgba', 'ww', 'w' */
|
23
|
+
function color(hex: string): ColorTable
|
24
|
+
|
25
|
+
function premul_color(color: Color): ColorTable
|
26
|
+
|
27
|
+
function mix_color(c1: Color, c2: Color): ColorArray
|
28
|
+
|
29
|
+
function multiply_color(c1: Color, n: number): ColorArray
|
30
|
+
|
31
|
+
function moveposition(
|
32
|
+
position: Position,
|
33
|
+
direction: defines.direction.north | defines.direction.east | defines.direction.south | defines.direction.west,
|
34
|
+
distance: number
|
35
|
+
): Position
|
36
|
+
function moveposition(position: Position, direction: defines.direction, distance: number): Position | undefined
|
37
|
+
|
38
|
+
function oppositedirection(direction: defines.direction): defines.direction
|
39
|
+
|
40
|
+
/** Creates a new array where each element in `stripes` is duplicated `count` times */
|
41
|
+
function multiplystripes<T>(count: number, stripes: T[]): T[]
|
42
|
+
|
43
|
+
/** Gets tile position by pixel */
|
44
|
+
function by_pixel(x: number, y: number): Position
|
45
|
+
|
46
|
+
/** Gets tile position by pixel, hr */
|
47
|
+
function by_pixel_hr(x: number, y: number): Position
|
48
|
+
|
49
|
+
// omitted: foreach_sprite_definition
|
50
|
+
|
51
|
+
function add_shift(a: PositionArray | undefined, b: PositionArray): PositionArray
|
52
|
+
function add_shift(a: PositionArray, b: PositionArray | undefined): PositionArray
|
53
|
+
function add_shift(a: PositionArray | undefined, b: PositionArray | undefined): PositionArray | undefined
|
54
|
+
|
55
|
+
// omitted: add_shift_offset
|
56
|
+
|
57
|
+
function mul_shift(shift: PositionArray, scale: number | undefined): PositionArray
|
58
|
+
function mul_shift(shift: PositionArray | undefined, scale: number | undefined): PositionArray | undefined
|
59
|
+
|
60
|
+
function format_number(amount: number, append_suffix?: boolean): string
|
61
|
+
|
62
|
+
function increment(t: number[], index: number, v?: number): void
|
63
|
+
|
64
|
+
// omitted: conditional_return
|
65
|
+
|
66
|
+
/**
|
67
|
+
* Recursively merges and/or deep-copies tables. Entries in later tables override entries in earlier ones, unless both
|
68
|
+
* entries are themselves tables, in which case they are recursively merged. Non-merged tables are deep-copied, so
|
69
|
+
* that the result is brand new.
|
70
|
+
*/
|
71
|
+
function merge<T extends object>(tables: T[]): T
|
72
|
+
|
73
|
+
function insert_safe(entity: LuaEntity | undefined, item_dict: Record<string, number> | undefined): void
|
74
|
+
|
75
|
+
function remove_safe(entity: LuaEntity | undefined, item_dict: Record<string, number> | undefined): void
|
76
|
+
|
77
|
+
function split_whitespace(string: string): string[]
|
78
|
+
|
79
|
+
// omitted: split, string_starts_with. already TS functions for that
|
80
|
+
|
81
|
+
// omitted: online_players. use game.connected_players
|
82
|
+
|
83
|
+
function clamp(x: number, lower: number, upper: number): number
|
84
|
+
|
85
|
+
// omitted: get_walkable_tile
|
86
|
+
|
87
|
+
// omitted: combine_icons
|
88
|
+
// omitted: technology_icons. Create an issue if you really want to see these
|
89
|
+
|
90
|
+
function parse_energy(energy: string): number
|
91
|
+
|
92
|
+
function product_amount(
|
93
|
+
product: {
|
94
|
+
probability: number
|
95
|
+
} & (
|
96
|
+
| {
|
97
|
+
amount: number
|
98
|
+
}
|
99
|
+
| {
|
100
|
+
amount_min: number
|
101
|
+
amount_max: number
|
102
|
+
}
|
103
|
+
)
|
104
|
+
): number
|
105
|
+
|
106
|
+
function empty_sprite(): object
|
107
|
+
|
108
|
+
// omitted: draw_as_glow
|
109
|
+
// omitted: remove_tile_references
|
110
|
+
|
111
|
+
function remove_from_list<T>(list: T[], value: T): boolean
|
112
|
+
|
113
|
+
function list_to_map<T extends keyof any>(list: T[]): Record<T, true>
|
114
|
+
function list_to_map<T>(list: T[]): LuaTable<T, true>
|
115
|
+
function list_to_map<T>(list: T): LuaTable<T[keyof T], true>
|
116
|
+
}
|