typed-factorio 0.18.1 → 0.20.0-beta.1
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 +24 -8
- package/README.md +26 -15
- package/custom-index-template.d.ts +24 -0
- package/generated/builtin-types.d.ts +1 -3
- package/generated/classes.d.ts +5297 -6144
- package/generated/concepts.d.ts +1926 -1208
- package/generated/defines.d.ts +464 -163
- package/generated/events.d.ts +2196 -913
- package/generated/global-objects.d.ts +1 -2
- package/generated/index-types-strict.d.ts +52 -0
- package/generated/index-types.d.ts +38 -0
- package/package.json +2 -6
- package/runtime/index.d.ts +9 -1
- package/runtime/pairs.d.ts +1 -0
- package/runtime/strict-index-types.d.ts +18 -0
- package/runtime/util.d.ts +12 -12
- package/generated/index.d.ts +0 -9
@@ -3,8 +3,7 @@
|
|
3
3
|
/** @noSelfInFile */
|
4
4
|
|
5
5
|
/**
|
6
|
-
* This is the main object, through which most of the API is accessed. It is, however, not available inside handlers
|
7
|
-
* registered with {@link LuaBootstrap.on_load LuaBootstrap::on_load}.
|
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}.
|
8
7
|
*
|
9
8
|
* {@link https://lua-api.factorio.com/latest/ View documentation}
|
10
9
|
*/
|
@@ -0,0 +1,52 @@
|
|
1
|
+
// This is an auto-generated file. Do not edit directly!
|
2
|
+
|
3
|
+
/** @noSelfInFile */
|
4
|
+
|
5
|
+
/**
|
6
|
+
* See {@link LuaPlayer#index LuaPlayer.index}.
|
7
|
+
*
|
8
|
+
* If you need to use a number/numeric literal for this type, you can use a cast, e.g. `2 as PlayerIndex`.
|
9
|
+
*/
|
10
|
+
type PlayerIndex =
|
11
|
+
| (uint & {
|
12
|
+
_playerIndexBrand: void
|
13
|
+
})
|
14
|
+
| 1
|
15
|
+
|
16
|
+
/**
|
17
|
+
* See {@link LuaSurface#index LuaSurface.index}.
|
18
|
+
*
|
19
|
+
* If you need to use a number/numeric literal for this type, you can use a cast, e.g. `2 as SurfaceIndex`.
|
20
|
+
*/
|
21
|
+
type SurfaceIndex =
|
22
|
+
| (uint & {
|
23
|
+
_surfaceIndexBrand: void
|
24
|
+
})
|
25
|
+
| 1
|
26
|
+
|
27
|
+
/**
|
28
|
+
* See {@link LuaEntity#unit_number LuaEntity.unit_number}.
|
29
|
+
*
|
30
|
+
* If you need to use a number/numeric literal for this type, you can use a cast, e.g. `2 as UnitNumber`.
|
31
|
+
*/
|
32
|
+
type UnitNumber = uint & {
|
33
|
+
_unitNumberBrand: void
|
34
|
+
}
|
35
|
+
|
36
|
+
/**
|
37
|
+
* See {@link LuaGuiElement#index LuaGuiElement.index}.
|
38
|
+
*
|
39
|
+
* If you need to use a number/numeric literal for this type, you can use a cast, e.g. `2 as GuiElementIndex`.
|
40
|
+
*/
|
41
|
+
type GuiElementIndex = uint & {
|
42
|
+
_guiElementIndexBrand: void
|
43
|
+
}
|
44
|
+
|
45
|
+
/**
|
46
|
+
* See {@link LuaBootstrap#register_on_entity_destroyed LuaBootstrap.register_on_entity_destroyed}.
|
47
|
+
*
|
48
|
+
* If you need to use a number/numeric literal for this type, you can use a cast, e.g. `2 as RegistrationNumber`.
|
49
|
+
*/
|
50
|
+
type RegistrationNumber = uint64 & {
|
51
|
+
_registrationNumberBrand: void
|
52
|
+
}
|
@@ -0,0 +1,38 @@
|
|
1
|
+
// This is an auto-generated file. Do not edit directly!
|
2
|
+
|
3
|
+
/** @noSelfInFile */
|
4
|
+
|
5
|
+
/**
|
6
|
+
* See {@link LuaPlayer#index LuaPlayer.index}..
|
7
|
+
*
|
8
|
+
* This can be a "branded" type for stricter types; see docs on how to opt-in to this.
|
9
|
+
*/
|
10
|
+
type PlayerIndex = uint
|
11
|
+
|
12
|
+
/**
|
13
|
+
* See {@link LuaSurface#index LuaSurface.index}..
|
14
|
+
*
|
15
|
+
* This can be a "branded" type for stricter types; see docs on how to opt-in to this.
|
16
|
+
*/
|
17
|
+
type SurfaceIndex = uint
|
18
|
+
|
19
|
+
/**
|
20
|
+
* See {@link LuaEntity#unit_number LuaEntity.unit_number}..
|
21
|
+
*
|
22
|
+
* This can be a "branded" type for stricter types; see docs on how to opt-in to this.
|
23
|
+
*/
|
24
|
+
type UnitNumber = uint
|
25
|
+
|
26
|
+
/**
|
27
|
+
* See {@link LuaGuiElement#index LuaGuiElement.index}..
|
28
|
+
*
|
29
|
+
* This can be a "branded" type for stricter types; see docs on how to opt-in to this.
|
30
|
+
*/
|
31
|
+
type GuiElementIndex = uint
|
32
|
+
|
33
|
+
/**
|
34
|
+
* See {@link LuaBootstrap#register_on_entity_destroyed LuaBootstrap.register_on_entity_destroyed}..
|
35
|
+
*
|
36
|
+
* This can be a "branded" type for stricter types; see docs on how to opt-in to this.
|
37
|
+
*/
|
38
|
+
type RegistrationNumber = uint64
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "typed-factorio",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.20.0-beta.1",
|
4
4
|
"description": "Featureful typescript definitions for the the Factorio modding lua api.",
|
5
5
|
"keywords": [
|
6
6
|
"factorio",
|
@@ -15,9 +15,7 @@
|
|
15
15
|
],
|
16
16
|
"homepage": "https://github.com/GlassBricks/typed-factorio#readme",
|
17
17
|
"scripts": {
|
18
|
-
"
|
19
|
-
"generate": "yarn run gen --in ./generatorSrc --out ./generated --warn-as-error",
|
20
|
-
"generate:dev": "yarn run gen --in ./generatorSrc --out ./generated --no-format",
|
18
|
+
"generate": "ts-node -P generator/tsconfig.json generator/main.ts",
|
21
19
|
"clean": "rimraf generated",
|
22
20
|
"pretest": "yarn run generate",
|
23
21
|
"test": "jest",
|
@@ -37,7 +35,6 @@
|
|
37
35
|
"@typescript-eslint/eslint-plugin": "^5.6.0",
|
38
36
|
"@typescript-eslint/parser": "^5.6.0",
|
39
37
|
"chalk": "^3.0.0",
|
40
|
-
"commander": "^8.3.0",
|
41
38
|
"eslint": "^8.4.1",
|
42
39
|
"eslint-config-prettier": "^8.3.0",
|
43
40
|
"eslint-config-standard": "^16.0.3",
|
@@ -49,7 +46,6 @@
|
|
49
46
|
"jest": "^27.4.3",
|
50
47
|
"lua-types": "^2.11.0",
|
51
48
|
"prettier": "^2.5.1",
|
52
|
-
"prettier-plugin-jsdoc": "^0.3.30",
|
53
49
|
"ts-jest": "^27.1.0",
|
54
50
|
"ts-node": "^10.4.0",
|
55
51
|
"typescript": "4.5.2",
|
package/runtime/index.d.ts
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
/// <reference types="lua-types/5.2" />
|
2
2
|
|
3
|
-
|
3
|
+
// generated
|
4
|
+
/// <reference path="../generated/builtin-types.d.ts" />
|
5
|
+
/// <reference path="../generated/global-objects.d.ts" />
|
6
|
+
/// <reference path="../generated/defines.d.ts" />
|
7
|
+
/// <reference path="../generated/events.d.ts" />
|
8
|
+
/// <reference path="../generated/classes.d.ts" />
|
9
|
+
/// <reference path="../generated/concepts.d.ts" />
|
10
|
+
/// <reference path="../generated/index-types.d.ts" />
|
4
11
|
|
12
|
+
// other runtime
|
5
13
|
/// <reference path="librariesAndFunctions.d.ts" />
|
6
14
|
/// <reference path="pairs.d.ts" />
|
7
15
|
|
package/runtime/pairs.d.ts
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
/// <reference types="lua-types/5.2" />
|
2
|
+
|
3
|
+
// generated
|
4
|
+
/// <reference path="../generated/builtin-types.d.ts" />
|
5
|
+
/// <reference path="../generated/global-objects.d.ts" />
|
6
|
+
/// <reference path="../generated/defines.d.ts" />
|
7
|
+
/// <reference path="../generated/events.d.ts" />
|
8
|
+
/// <reference path="../generated/classes.d.ts" />
|
9
|
+
/// <reference path="../generated/concepts.d.ts" />
|
10
|
+
/// <reference path="../generated/index-types-strict.d.ts" />
|
11
|
+
|
12
|
+
// other runtime
|
13
|
+
/// <reference path="librariesAndFunctions.d.ts" />
|
14
|
+
/// <reference path="pairs.d.ts" />
|
15
|
+
|
16
|
+
// lualib
|
17
|
+
/// <reference path="util.d.ts" />
|
18
|
+
/// <reference path="mod-gui.d.ts" />
|
package/runtime/util.d.ts
CHANGED
@@ -13,9 +13,9 @@ declare module "util" {
|
|
13
13
|
|
14
14
|
function copy<T>(table: T): T
|
15
15
|
|
16
|
-
function distance(position1:
|
16
|
+
function distance(position1: MapPosition, position2: MapPosition): number
|
17
17
|
|
18
|
-
function positiontostr(position:
|
18
|
+
function positiontostr(position: MapPosition): string
|
19
19
|
|
20
20
|
function formattime(ticks: number): string
|
21
21
|
|
@@ -29,11 +29,11 @@ declare module "util" {
|
|
29
29
|
function multiply_color(c1: Color, n: number): ColorArray
|
30
30
|
|
31
31
|
function moveposition(
|
32
|
-
position:
|
32
|
+
position: MapPosition,
|
33
33
|
direction: defines.direction.north | defines.direction.east | defines.direction.south | defines.direction.west,
|
34
34
|
distance: number
|
35
|
-
):
|
36
|
-
function moveposition(position:
|
35
|
+
): MapPosition
|
36
|
+
function moveposition(position: MapPosition, direction: defines.direction, distance: number): MapPosition | undefined
|
37
37
|
|
38
38
|
function oppositedirection(direction: defines.direction): defines.direction
|
39
39
|
|
@@ -41,21 +41,21 @@ declare module "util" {
|
|
41
41
|
function multiplystripes<T>(count: number, stripes: T[]): T[]
|
42
42
|
|
43
43
|
/** Gets tile position by pixel */
|
44
|
-
function by_pixel(x: number, y: number):
|
44
|
+
function by_pixel(x: number, y: number): MapPosition
|
45
45
|
|
46
46
|
/** Gets tile position by pixel, hr */
|
47
|
-
function by_pixel_hr(x: number, y: number):
|
47
|
+
function by_pixel_hr(x: number, y: number): MapPosition
|
48
48
|
|
49
49
|
// omitted: foreach_sprite_definition
|
50
50
|
|
51
|
-
function add_shift(a:
|
52
|
-
function add_shift(a:
|
53
|
-
function add_shift(a:
|
51
|
+
function add_shift(a: MapPositionArray | undefined, b: MapPositionArray): MapPositionArray
|
52
|
+
function add_shift(a: MapPositionArray, b: MapPositionArray | undefined): MapPositionArray
|
53
|
+
function add_shift(a: MapPositionArray | undefined, b: MapPositionArray | undefined): MapPositionArray | undefined
|
54
54
|
|
55
55
|
// omitted: add_shift_offset
|
56
56
|
|
57
|
-
function mul_shift(shift:
|
58
|
-
function mul_shift(shift:
|
57
|
+
function mul_shift(shift: MapPositionArray, scale: number | undefined): MapPositionArray
|
58
|
+
function mul_shift(shift: MapPositionArray | undefined, scale: number | undefined): MapPositionArray | undefined
|
59
59
|
|
60
60
|
function format_number(amount: number, append_suffix?: boolean): string
|
61
61
|
|
package/generated/index.d.ts
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
// This is an auto-generated file. Do not edit directly!
|
2
|
-
|
3
|
-
///<reference types="lua-types/5.2" />
|
4
|
-
///<reference path="builtin-types.d.ts" />
|
5
|
-
///<reference path="global-objects.d.ts" />
|
6
|
-
///<reference path="defines.d.ts" />
|
7
|
-
///<reference path="events.d.ts" />
|
8
|
-
///<reference path="classes.d.ts" />
|
9
|
-
///<reference path="concepts.d.ts" />
|