typed-factorio 0.20.0-beta.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/Changelog.md +15 -10
- package/README.md +6 -12
- package/custom-index-template.d.ts +0 -2
- package/generated/classes.d.ts +308 -18
- package/generated/events.d.ts +1 -1
- package/generated/index-types.d.ts +26 -15
- package/package.json +1 -1
- package/runtime/pairs.d.ts +3 -8
- package/strict-index-types.d.ts +3 -0
- package/generated/index-types-strict.d.ts +0 -52
- package/runtime/strict-index-types.d.ts +0 -18
package/Changelog.md
CHANGED
@@ -1,8 +1,13 @@
|
|
1
|
+
# v1.0.0
|
2
|
+
|
3
|
+
- This project now has all the features that was originally planned, and can now guarantee reasonable backwards compatibility for future releases. As such, it now deserves the v1.0.0. Goodbye to [Zer0Ver](http://0ver.org)!
|
4
|
+
- Updated to factorio version 1.1.57
|
5
|
+
|
1
6
|
# v0.20.0
|
2
7
|
|
3
8
|
- Updated to factorio version 1.1.56
|
4
|
-
-
|
5
|
-
-
|
9
|
+
- This is an **opt-in** feature: Some numeric types which represent indices/number,e.g. player_index, entity_number, are now branded numbers with their own type, e.g. `PlayerIndex` and `EntityNumber`. See the README for more info.
|
10
|
+
- Added custom-index-template.d.ts to assist trying out custom changes to types in a project.
|
6
11
|
|
7
12
|
# v0.19.0
|
8
13
|
|
@@ -39,8 +44,8 @@
|
|
39
44
|
# v0.15.0
|
40
45
|
|
41
46
|
- Table or array concepts are now declared in table form wherever it is an "read" position.
|
42
|
-
|
43
|
-
|
47
|
+
- This works with setter overloading for applicable properties: `player.color.x; player.color = [1, 1, 1]` is now valid!
|
48
|
+
- This also applies to concepts/complex types which contain table_or_array properties.
|
44
49
|
- Some concepts now also have a special form where it is known to be in a "read" position, where all table_or_array concepts are declared in table form. These concepts are suffixed with "Read", e.g. `ScriptAreaRead`.
|
45
50
|
- Arrays which are known to be in a "write" only form (e.g. method parameters) now are marked readonly. This means you can now pass readonly arrays to these methods.
|
46
51
|
- `MapPosition` is now a table or array concept.
|
@@ -56,17 +61,17 @@
|
|
56
61
|
- LuaStyle size, margin/padding setters now have more specific array types. These array types are `SizeArray` and `StyleValuesArray` for size and margin/padding, respectively.
|
57
62
|
- `@noSelf` annotation is now only present when necessary.
|
58
63
|
- For classes with subclasses:
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
64
|
+
- The original class name (e.g. `LuaItemStack`) still contains attributes of all subclasses (same as before).
|
65
|
+
- There is now a `Base` type (e.g. `BaseItemStack`) which only includes attributes common to all subclasses.
|
66
|
+
- There is a separate type definition for each subclass, e.g. `BlueprintItem`. Note that one instance may still belong to multiple subclasses (the subclasses are not mutually exclusive).
|
67
|
+
- The above two can be optionally used for stricter types.
|
63
68
|
|
64
69
|
# v0.13.2
|
65
70
|
|
66
71
|
- Fix: resize_to_sprite property should not be on subclass sprite-button
|
67
72
|
- Fix: ChooseElemButtonSpec filters should be named elem_filters
|
68
73
|
- Switch back to `/latest` api docs link
|
69
|
-
|
74
|
+
- New version of web api docs is now active
|
70
75
|
|
71
76
|
# v0.13.0
|
72
77
|
|
@@ -102,7 +107,7 @@
|
|
102
107
|
# v0.7.3
|
103
108
|
|
104
109
|
- Update to factorio version 1.1.42
|
105
|
-
|
110
|
+
- No api changes, but improvements to descriptions
|
106
111
|
|
107
112
|
# v0.7.2
|
108
113
|
|
package/README.md
CHANGED
@@ -30,10 +30,7 @@ yarn add typed-factorio
|
|
30
30
|
|
31
31
|
This will add the types for the runtime stage to your entire project.
|
32
32
|
|
33
|
-
|
34
|
-
> When types are updated, or released for a new factorio version, you will need update your package version to get the types.
|
35
|
-
>
|
36
|
-
> There is an opt-in feature for stricter index types, see [Strict index types](#Strict index types) for more details.
|
33
|
+
Note: When types are updated, or released for a new factorio version, you will need update your package version to get the types.
|
37
34
|
|
38
35
|
### Settings and data stage
|
39
36
|
|
@@ -114,7 +111,6 @@ Table-or-array types will appear in the Table form when known to be in a read po
|
|
114
111
|
|
115
112
|
For some concepts, there is also a special form for when the concept is used in a "read" position, where all table-or-array types are in Table form. These types are suffixed with `Read`, e.g. `ScriptPositionRead`.
|
116
113
|
|
117
|
-
|
118
114
|
### Types with subclasses
|
119
115
|
|
120
116
|
Some classes have attributes that are documented to only work on particular subclasses. For these classes, e.g. `LuaEntity`, there are specific types that you can _optionally_ use:
|
@@ -134,11 +130,9 @@ This is done both to provide more accurate types, and for possible integration w
|
|
134
130
|
|
135
131
|
### Strict index types
|
136
132
|
|
137
|
-
This
|
138
|
-
|
139
|
-
Some `uint` types which represent indices, e.g. player_index, entity_number, are now "branded" numbers with their own type, e.g. `PlayerIndex` and `EntityNumber`. These are assignable to `number`, but `number` is not assignable to them.
|
140
|
-
These are indices that do not index into an array-like structure, and otherwise should usually not have arithmetic done to them. So, using a separate type helps ensure correctness.
|
141
|
-
You can still use these types as keys in an index signature, e.g. `{ [index: PlayerIndex]: "foo" }`.
|
142
|
-
You can cast "plain" numbers to these types, e.g. `2 as PlayerIndex`, only do this with some care.
|
133
|
+
This is a recommended **opt-in** feature. To opt in, add `"typed-factorio/strict-index-types"` to `compilerOptions > types` in your tsconfig.json (in addition to `"typed-factorio/runtime"`).
|
143
134
|
|
144
|
-
|
135
|
+
Some `uint` types which represent indices, e.g. player_index, entity_number, can be "branded" numbers with their own type, e.g. `PlayerIndex` and `EntityNumber`. These are assignable to `number`, but a plain `number` is not directly assignable to them. This helps ensure correctness.
|
136
|
+
These are indices that do not index into an array-like structure, and otherwise should usually not have arithmetic done to them.
|
137
|
+
You can use these types as keys in an index signature, e.g. `{ [index: PlayerIndex]: "foo" }`.
|
138
|
+
You can cast "plain" numbers to these types, e.g. `1 as PlayerIndex`, do this with caution.
|
@@ -2,8 +2,6 @@
|
|
2
2
|
// For example, if you want to modify a file, copy the file you want to modify to your project and make the changes. Then, copy this template file into your project and remove the line corresponding to modified file.
|
3
3
|
// If you think your modification will be useful to others, please consider making a change suggestion by creating an issue on GitHub.
|
4
4
|
|
5
|
-
// Replace "index-types.d.ts" with "index-types-strict.d.ts" below if you want strict index types.
|
6
|
-
|
7
5
|
/// <reference types="lua-types/5.2" />
|
8
6
|
|
9
7
|
// generated
|
package/generated/classes.d.ts
CHANGED
@@ -1895,25 +1895,25 @@ interface LuaCustomInputPrototype {
|
|
1895
1895
|
*/
|
1896
1896
|
readonly action: string
|
1897
1897
|
/**
|
1898
|
-
*
|
1898
|
+
* Whether this custom input is enabled. Disabled custom inputs exist but are not used by the game.
|
1899
1899
|
*
|
1900
1900
|
* {@link https://lua-api.factorio.com/latest/LuaCustomInputPrototype.html#LuaCustomInputPrototype.enabled View documentation}
|
1901
1901
|
*/
|
1902
1902
|
readonly enabled: boolean
|
1903
1903
|
/**
|
1904
|
-
*
|
1904
|
+
* Whether this custom input is enabled while using the spectator controller.
|
1905
1905
|
*
|
1906
1906
|
* {@link https://lua-api.factorio.com/latest/LuaCustomInputPrototype.html#LuaCustomInputPrototype.enabled_while_spectating View documentation}
|
1907
1907
|
*/
|
1908
1908
|
readonly enabled_while_spectating: boolean
|
1909
1909
|
/**
|
1910
|
-
*
|
1910
|
+
* Whether this custom input is enabled while using the cutscene controller.
|
1911
1911
|
*
|
1912
1912
|
* {@link https://lua-api.factorio.com/latest/LuaCustomInputPrototype.html#LuaCustomInputPrototype.enabled_while_in_cutscene View documentation}
|
1913
1913
|
*/
|
1914
1914
|
readonly enabled_while_in_cutscene: boolean
|
1915
1915
|
/**
|
1916
|
-
*
|
1916
|
+
* Whether this custom input will include the selected prototype (if any) when triggered.
|
1917
1917
|
*
|
1918
1918
|
* {@link https://lua-api.factorio.com/latest/LuaCustomInputPrototype.html#LuaCustomInputPrototype.include_selected_prototype View documentation}
|
1919
1919
|
*/
|
@@ -2000,7 +2000,12 @@ interface LuaCustomTableMembers {
|
|
2000
2000
|
*/
|
2001
2001
|
type LuaCustomTable<K extends string | number, V> = LuaCustomTableMembers &
|
2002
2002
|
CustomTableIndexer<K, V> &
|
2003
|
-
LuaPairsIterable<
|
2003
|
+
LuaPairsIterable<
|
2004
|
+
// this convoluted expression gives a number type if K includes a number, even if it includes a string, and K otherwise.
|
2005
|
+
// it also preserves number branding
|
2006
|
+
[number] extends [K extends number & IndexBrand<infer A> ? number : K] ? (K extends string ? never : K) : K,
|
2007
|
+
V
|
2008
|
+
>
|
2004
2009
|
|
2005
2010
|
/**
|
2006
2011
|
* Prototype of a damage.
|
@@ -4454,6 +4459,14 @@ interface LuaEntity extends LuaControl {
|
|
4454
4459
|
* @remarks Can also be used on entity ghost if it contains linked-belt<br>May return entity ghost which contains linked belt to which connection is made
|
4455
4460
|
*/
|
4456
4461
|
readonly linked_belt_neighbour: LuaEntity | undefined
|
4462
|
+
/**
|
4463
|
+
* The current radar scan progress, as a number in range [0, 1].
|
4464
|
+
*
|
4465
|
+
* _Can only be used if this is Radar_
|
4466
|
+
*
|
4467
|
+
* {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.radar_scan_progress View documentation}
|
4468
|
+
*/
|
4469
|
+
readonly radar_scan_progress: float
|
4457
4470
|
/**
|
4458
4471
|
* Is this object valid? This Lua object holds a reference to an object within the game engine. It is possible that the game-engine object is removed whilst a mod still holds the corresponding Lua object. If that happens, the object becomes invalid, i.e. this attribute will be `false`. Mods are advised to check for object validity if any change to the game state might have occurred between the creation of the Lua object and its access.
|
4459
4472
|
*/
|
@@ -6999,6 +7012,17 @@ interface SmokeWithTriggerEntity extends BaseEntity {
|
|
6999
7012
|
time_to_next_effect: uint
|
7000
7013
|
}
|
7001
7014
|
|
7015
|
+
interface RadarEntity extends BaseEntity {
|
7016
|
+
/**
|
7017
|
+
* The current radar scan progress, as a number in range [0, 1].
|
7018
|
+
*
|
7019
|
+
* _Can only be used if this is Radar_
|
7020
|
+
*
|
7021
|
+
* {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.radar_scan_progress View documentation}
|
7022
|
+
*/
|
7023
|
+
readonly radar_scan_progress: float
|
7024
|
+
}
|
7025
|
+
|
7002
7026
|
/**
|
7003
7027
|
* Prototype of an entity.
|
7004
7028
|
*
|
@@ -7631,6 +7655,12 @@ interface LuaEntityPrototype {
|
|
7631
7655
|
* {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.void_energy_source_prototype View documentation}
|
7632
7656
|
*/
|
7633
7657
|
readonly void_energy_source_prototype: LuaVoidEnergySourcePrototype | undefined
|
7658
|
+
/**
|
7659
|
+
* The heat buffer prototype this entity uses or `nil`.
|
7660
|
+
*
|
7661
|
+
* {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.heat_buffer_prototype View documentation}
|
7662
|
+
*/
|
7663
|
+
readonly heat_buffer_prototype: LuaHeatBufferPrototype | undefined
|
7634
7664
|
/**
|
7635
7665
|
* The log2 of grid size of the building
|
7636
7666
|
*
|
@@ -7649,6 +7679,30 @@ interface LuaEntityPrototype {
|
|
7649
7679
|
* {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.maximum_temperature View documentation}
|
7650
7680
|
*/
|
7651
7681
|
readonly maximum_temperature: double | undefined
|
7682
|
+
/**
|
7683
|
+
* If this generator prototype burns fluid.
|
7684
|
+
*
|
7685
|
+
* {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.burns_fluid View documentation}
|
7686
|
+
*/
|
7687
|
+
readonly burns_fluid: boolean
|
7688
|
+
/**
|
7689
|
+
* If this generator prototype scales fluid usage.
|
7690
|
+
*
|
7691
|
+
* {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.scale_fluid_usage View documentation}
|
7692
|
+
*/
|
7693
|
+
readonly scale_fluid_usage: boolean
|
7694
|
+
/**
|
7695
|
+
* If this generator prototype destroys non fuel fluids.
|
7696
|
+
*
|
7697
|
+
* {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.destroy_non_fuel_fluid View documentation}
|
7698
|
+
*/
|
7699
|
+
readonly destroy_non_fuel_fluid: boolean
|
7700
|
+
/**
|
7701
|
+
* The default maximum power output of this generator prototype or `nil`.
|
7702
|
+
*
|
7703
|
+
* {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.max_power_output View documentation}
|
7704
|
+
*/
|
7705
|
+
readonly max_power_output: double | undefined
|
7652
7706
|
/**
|
7653
7707
|
* The target temperature of this boiler prototype or `nil`.
|
7654
7708
|
*
|
@@ -8230,6 +8284,31 @@ interface LuaEntityPrototype {
|
|
8230
8284
|
* {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.allow_run_time_change_of_is_military_target View documentation}
|
8231
8285
|
*/
|
8232
8286
|
readonly allow_run_time_change_of_is_military_target: boolean
|
8287
|
+
/**
|
8288
|
+
* The logistic parameters for this roboport. or `nil`.
|
8289
|
+
*
|
8290
|
+
* {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.logistic_parameters View documentation}
|
8291
|
+
* @remarks Both the `charging_station_shift` and `stationing_offset` vectors are tables with `x` and `y` keys instead of an array.
|
8292
|
+
*/
|
8293
|
+
readonly logistic_parameters:
|
8294
|
+
| {
|
8295
|
+
readonly spawn_and_station_height: float
|
8296
|
+
readonly spawn_and_station_shadow_height_offset: float
|
8297
|
+
readonly charge_approach_distance: float
|
8298
|
+
readonly logistic_radius: float
|
8299
|
+
readonly construction_radius: float
|
8300
|
+
readonly charging_station_count: uint
|
8301
|
+
readonly charging_distance: float
|
8302
|
+
readonly charging_station_shift: Vector
|
8303
|
+
readonly charging_energy: double
|
8304
|
+
readonly charging_threshold_distance: float
|
8305
|
+
readonly robot_vertical_acceleration: float
|
8306
|
+
readonly stationing_offset: Vector
|
8307
|
+
readonly robot_limit: uint
|
8308
|
+
readonly logistics_connection_distance: float
|
8309
|
+
readonly robots_shrink_when_entering_and_exiting: boolean
|
8310
|
+
}
|
8311
|
+
| undefined
|
8233
8312
|
/**
|
8234
8313
|
* Gets the current movement speed of this character, including effects from exoskeletons, tiles, stickers and shooting.
|
8235
8314
|
*
|
@@ -8965,6 +9044,12 @@ interface BaseEntityPrototype {
|
|
8965
9044
|
* {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.void_energy_source_prototype View documentation}
|
8966
9045
|
*/
|
8967
9046
|
readonly void_energy_source_prototype: LuaVoidEnergySourcePrototype | undefined
|
9047
|
+
/**
|
9048
|
+
* The heat buffer prototype this entity uses or `nil`.
|
9049
|
+
*
|
9050
|
+
* {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.heat_buffer_prototype View documentation}
|
9051
|
+
*/
|
9052
|
+
readonly heat_buffer_prototype: LuaHeatBufferPrototype | undefined
|
8968
9053
|
/**
|
8969
9054
|
* The log2 of grid size of the building
|
8970
9055
|
*
|
@@ -8983,6 +9068,30 @@ interface BaseEntityPrototype {
|
|
8983
9068
|
* {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.maximum_temperature View documentation}
|
8984
9069
|
*/
|
8985
9070
|
readonly maximum_temperature: double | undefined
|
9071
|
+
/**
|
9072
|
+
* If this generator prototype burns fluid.
|
9073
|
+
*
|
9074
|
+
* {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.burns_fluid View documentation}
|
9075
|
+
*/
|
9076
|
+
readonly burns_fluid: boolean
|
9077
|
+
/**
|
9078
|
+
* If this generator prototype scales fluid usage.
|
9079
|
+
*
|
9080
|
+
* {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.scale_fluid_usage View documentation}
|
9081
|
+
*/
|
9082
|
+
readonly scale_fluid_usage: boolean
|
9083
|
+
/**
|
9084
|
+
* If this generator prototype destroys non fuel fluids.
|
9085
|
+
*
|
9086
|
+
* {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.destroy_non_fuel_fluid View documentation}
|
9087
|
+
*/
|
9088
|
+
readonly destroy_non_fuel_fluid: boolean
|
9089
|
+
/**
|
9090
|
+
* The default maximum power output of this generator prototype or `nil`.
|
9091
|
+
*
|
9092
|
+
* {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.max_power_output View documentation}
|
9093
|
+
*/
|
9094
|
+
readonly max_power_output: double | undefined
|
8986
9095
|
/**
|
8987
9096
|
* The target temperature of this boiler prototype or `nil`.
|
8988
9097
|
*
|
@@ -9486,6 +9595,31 @@ interface BaseEntityPrototype {
|
|
9486
9595
|
* {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.is_entity_with_owner View documentation}
|
9487
9596
|
*/
|
9488
9597
|
readonly is_entity_with_owner: boolean
|
9598
|
+
/**
|
9599
|
+
* The logistic parameters for this roboport. or `nil`.
|
9600
|
+
*
|
9601
|
+
* {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.logistic_parameters View documentation}
|
9602
|
+
* @remarks Both the `charging_station_shift` and `stationing_offset` vectors are tables with `x` and `y` keys instead of an array.
|
9603
|
+
*/
|
9604
|
+
readonly logistic_parameters:
|
9605
|
+
| {
|
9606
|
+
readonly spawn_and_station_height: float
|
9607
|
+
readonly spawn_and_station_shadow_height_offset: float
|
9608
|
+
readonly charge_approach_distance: float
|
9609
|
+
readonly logistic_radius: float
|
9610
|
+
readonly construction_radius: float
|
9611
|
+
readonly charging_station_count: uint
|
9612
|
+
readonly charging_distance: float
|
9613
|
+
readonly charging_station_shift: Vector
|
9614
|
+
readonly charging_energy: double
|
9615
|
+
readonly charging_threshold_distance: float
|
9616
|
+
readonly robot_vertical_acceleration: float
|
9617
|
+
readonly stationing_offset: Vector
|
9618
|
+
readonly robot_limit: uint
|
9619
|
+
readonly logistics_connection_distance: float
|
9620
|
+
readonly robots_shrink_when_entering_and_exiting: boolean
|
9621
|
+
}
|
9622
|
+
| undefined
|
9489
9623
|
/**
|
9490
9624
|
* Is this object valid? This Lua object holds a reference to an object within the game engine. It is possible that the game-engine object is removed whilst a mod still holds the corresponding Lua object. If that happens, the object becomes invalid, i.e. this attribute will be `false`. Mods are advised to check for object validity if any change to the game state might have occurred between the creation of the Lua object and its access.
|
9491
9625
|
*/
|
@@ -11530,7 +11664,7 @@ interface LuaGameScript {
|
|
11530
11664
|
*/
|
11531
11665
|
regenerate_entity(entities: string | readonly string[]): void
|
11532
11666
|
/**
|
11533
|
-
* Take a screenshot and save it to
|
11667
|
+
* Take a screenshot of the game and save it to the `script-output` folder, located in the game's {@link https://wiki.factorio.com/User_data_directory user data directory}. The name of the image file can be specified via the `path` parameter.
|
11534
11668
|
*
|
11535
11669
|
* {@link https://lua-api.factorio.com/latest/LuaGameScript.html#LuaGameScript.take_screenshot View documentation}
|
11536
11670
|
* @remarks If Factorio is running headless, this function will do nothing.
|
@@ -11561,7 +11695,7 @@ interface LuaGameScript {
|
|
11561
11695
|
*/
|
11562
11696
|
readonly zoom?: double
|
11563
11697
|
/**
|
11564
|
-
* The
|
11698
|
+
* The name of the image file. It should include a file extension indicating the desired format. Supports `.png`, `.jpg` /`.jpeg`, `.tga` and `.bmp`. Providing a directory path (ex. `"save/here/screenshot.png"`) will create the necessary folder structure in `script-output`. Defaults to `"screenshot.png"`.
|
11565
11699
|
*/
|
11566
11700
|
readonly path?: string
|
11567
11701
|
/**
|
@@ -11608,7 +11742,7 @@ interface LuaGameScript {
|
|
11608
11742
|
*/
|
11609
11743
|
set_wait_for_screenshots_to_finish(): void
|
11610
11744
|
/**
|
11611
|
-
* Take a screenshot of the technology screen and save it to
|
11745
|
+
* Take a screenshot of the technology screen and save it to the `script-output` folder, located in the game's {@link https://wiki.factorio.com/User_data_directory user data directory}. The name of the image file can be specified via the `path` parameter.
|
11612
11746
|
*
|
11613
11747
|
* {@link https://lua-api.factorio.com/latest/LuaGameScript.html#LuaGameScript.take_technology_screenshot View documentation}
|
11614
11748
|
*/
|
@@ -11618,7 +11752,7 @@ interface LuaGameScript {
|
|
11618
11752
|
*/
|
11619
11753
|
readonly force?: ForceIdentification
|
11620
11754
|
/**
|
11621
|
-
* The
|
11755
|
+
* The name of the image file. It should include a file extension indicating the desired format. Supports `.png`, `.jpg` /`.jpeg`, `.tga` and `.bmp`. Providing a directory path (ex. `"save/here/screenshot.png"`) will create the necessary folder structure in `script-output`. Defaults to `"technology-screenshot.png"`.
|
11622
11756
|
*/
|
11623
11757
|
readonly path?: string
|
11624
11758
|
/**
|
@@ -11653,20 +11787,20 @@ interface LuaGameScript {
|
|
11653
11787
|
*/
|
11654
11788
|
json_to_table(json: string): AnyBasic | undefined
|
11655
11789
|
/**
|
11656
|
-
* Write a
|
11790
|
+
* Write a file to the `script-output` folder, located in the game's {@link https://wiki.factorio.com/User_data_directory user data directory}. The name and file extension of the file can be specified via the `filename` parameter.
|
11657
11791
|
*
|
11658
11792
|
* {@link https://lua-api.factorio.com/latest/LuaGameScript.html#LuaGameScript.write_file View documentation}
|
11659
|
-
* @param filename
|
11660
|
-
* @param data
|
11661
|
-
* @param append
|
11662
|
-
* @param for_player If given, the file will only be written for this player_index
|
11793
|
+
* @param filename The name of the file. Providing a directory path (ex. `"save/here/example.txt"`) will create the necessary folder structure in `script-output`.
|
11794
|
+
* @param data The content to write to the file.
|
11795
|
+
* @param append If `true`, `data` will be appended to the end of the file. Defaults to `false`, which will overwrite any pre-existing file with the new `data`.
|
11796
|
+
* @param for_player If given, the file will only be written for this `player_index`. Providing `0` will only write to the server's output if present.
|
11663
11797
|
*/
|
11664
11798
|
write_file(filename: string, data: LocalisedString, append?: boolean, for_player?: uint): void
|
11665
11799
|
/**
|
11666
|
-
* Remove file or directory
|
11800
|
+
* Remove a file or directory in the `script-output` folder, located in the game's {@link https://wiki.factorio.com/User_data_directory user data directory}. Can be used to remove files created by {@link LuaGameScript#write_file LuaGameScript::write_file}.
|
11667
11801
|
*
|
11668
11802
|
* {@link https://lua-api.factorio.com/latest/LuaGameScript.html#LuaGameScript.remove_path View documentation}
|
11669
|
-
* @param path
|
11803
|
+
* @param path The path to the file or directory to remove, relative to `script-output`.
|
11670
11804
|
*/
|
11671
11805
|
remove_path(path: string): void
|
11672
11806
|
/**
|
@@ -14001,7 +14135,7 @@ interface CameraGuiElementMembers extends BaseGuiElement {
|
|
14001
14135
|
*/
|
14002
14136
|
surface_index: SurfaceIndex
|
14003
14137
|
/**
|
14004
|
-
* The zoom this camera or minimap is using.
|
14138
|
+
* The zoom this camera or minimap is using. This value must be positive.
|
14005
14139
|
*
|
14006
14140
|
* {@link https://lua-api.factorio.com/latest/LuaGuiElement.html#LuaGuiElement.zoom View documentation}
|
14007
14141
|
*/
|
@@ -14197,7 +14331,7 @@ interface MinimapGuiElementMembers extends BaseGuiElement {
|
|
14197
14331
|
*/
|
14198
14332
|
surface_index: SurfaceIndex
|
14199
14333
|
/**
|
14200
|
-
* The zoom this camera or minimap is using.
|
14334
|
+
* The zoom this camera or minimap is using. This value must be positive.
|
14201
14335
|
*
|
14202
14336
|
* {@link https://lua-api.factorio.com/latest/LuaGuiElement.html#LuaGuiElement.zoom View documentation}
|
14203
14337
|
*/
|
@@ -14693,6 +14827,35 @@ type GuiElementMembers =
|
|
14693
14827
|
*/
|
14694
14828
|
type LuaGuiElement = GuiElementMembers & GuiElementIndexer
|
14695
14829
|
|
14830
|
+
/**
|
14831
|
+
* Prototype of a heat buffer.
|
14832
|
+
*
|
14833
|
+
* {@link https://lua-api.factorio.com/latest/LuaHeatBufferPrototype.html View documentation}
|
14834
|
+
* @noSelf
|
14835
|
+
*/
|
14836
|
+
interface LuaHeatBufferPrototype {
|
14837
|
+
readonly max_temperature: double
|
14838
|
+
readonly default_temperature: double
|
14839
|
+
readonly specific_heat: double
|
14840
|
+
readonly max_transfer: double
|
14841
|
+
readonly min_temperature_gradient: double
|
14842
|
+
readonly min_working_temperature: double
|
14843
|
+
readonly minimum_glow_temperature: double
|
14844
|
+
readonly connections: HeatConnection[]
|
14845
|
+
/**
|
14846
|
+
* Is this object valid? This Lua object holds a reference to an object within the game engine. It is possible that the game-engine object is removed whilst a mod still holds the corresponding Lua object. If that happens, the object becomes invalid, i.e. this attribute will be `false`. Mods are advised to check for object validity if any change to the game state might have occurred between the creation of the Lua object and its access.
|
14847
|
+
*/
|
14848
|
+
readonly valid: boolean
|
14849
|
+
/**
|
14850
|
+
* The class name of this object. Available even when `valid` is false. For LuaStruct objects it may also be suffixed with a dotted path to a member of the struct.
|
14851
|
+
*/
|
14852
|
+
readonly object_name: "LuaHeatBufferPrototype"
|
14853
|
+
/**
|
14854
|
+
* All methods and properties that this object supports.
|
14855
|
+
*/
|
14856
|
+
help(): string
|
14857
|
+
}
|
14858
|
+
|
14696
14859
|
/**
|
14697
14860
|
* Prototype of a heat energy source.
|
14698
14861
|
*
|
@@ -14711,6 +14874,7 @@ interface LuaHeatEnergySourcePrototype {
|
|
14711
14874
|
readonly min_working_temperature: double
|
14712
14875
|
readonly minimum_glow_temperature: double
|
14713
14876
|
readonly connections: HeatConnection[]
|
14877
|
+
readonly heat_buffer_prototype: LuaHeatBufferPrototype
|
14714
14878
|
/**
|
14715
14879
|
* Is this object valid? This Lua object holds a reference to an object within the game engine. It is possible that the game-engine object is removed whilst a mod still holds the corresponding Lua object. If that happens, the object becomes invalid, i.e. this attribute will be `false`. Mods are advised to check for object validity if any change to the game state might have occurred between the creation of the Lua object and its access.
|
14716
14880
|
*/
|
@@ -15376,6 +15540,14 @@ interface LuaItemPrototype {
|
|
15376
15540
|
* {@link https://lua-api.factorio.com/latest/LuaItemPrototype.html#LuaItemPrototype.alt_selection_border_color View documentation}
|
15377
15541
|
*/
|
15378
15542
|
readonly alt_selection_border_color: ColorTable
|
15543
|
+
/**
|
15544
|
+
* The color used when doing reverse selection with this selection tool prototype.
|
15545
|
+
*
|
15546
|
+
* _Can only be used if this is SelectionTool_
|
15547
|
+
*
|
15548
|
+
* {@link https://lua-api.factorio.com/latest/LuaItemPrototype.html#LuaItemPrototype.reverse_selection_border_color View documentation}
|
15549
|
+
*/
|
15550
|
+
readonly reverse_selection_border_color: ColorTable
|
15379
15551
|
/**
|
15380
15552
|
* Flags that affect which entities will be selected.
|
15381
15553
|
*
|
@@ -15392,6 +15564,14 @@ interface LuaItemPrototype {
|
|
15392
15564
|
* {@link https://lua-api.factorio.com/latest/LuaItemPrototype.html#LuaItemPrototype.alt_selection_mode_flags View documentation}
|
15393
15565
|
*/
|
15394
15566
|
readonly alt_selection_mode_flags: SelectionModeFlags
|
15567
|
+
/**
|
15568
|
+
* Flags that affect which entities will be selected during reverse selection.
|
15569
|
+
*
|
15570
|
+
* _Can only be used if this is SelectionTool_
|
15571
|
+
*
|
15572
|
+
* {@link https://lua-api.factorio.com/latest/LuaItemPrototype.html#LuaItemPrototype.reverse_selection_mode_flags View documentation}
|
15573
|
+
*/
|
15574
|
+
readonly reverse_selection_mode_flags: SelectionModeFlags
|
15395
15575
|
/**
|
15396
15576
|
* _Can only be used if this is SelectionTool_
|
15397
15577
|
*
|
@@ -15404,6 +15584,12 @@ interface LuaItemPrototype {
|
|
15404
15584
|
* {@link https://lua-api.factorio.com/latest/LuaItemPrototype.html#LuaItemPrototype.alt_selection_cursor_box_type View documentation}
|
15405
15585
|
*/
|
15406
15586
|
readonly alt_selection_cursor_box_type: string
|
15587
|
+
/**
|
15588
|
+
* _Can only be used if this is SelectionTool_
|
15589
|
+
*
|
15590
|
+
* {@link https://lua-api.factorio.com/latest/LuaItemPrototype.html#LuaItemPrototype.reverse_selection_cursor_box_type View documentation}
|
15591
|
+
*/
|
15592
|
+
readonly reverse_selection_cursor_box_type: string
|
15407
15593
|
/**
|
15408
15594
|
* If tiles area always included when doing selection with this selection tool prototype.
|
15409
15595
|
*
|
@@ -15428,6 +15614,14 @@ interface LuaItemPrototype {
|
|
15428
15614
|
* {@link https://lua-api.factorio.com/latest/LuaItemPrototype.html#LuaItemPrototype.alt_entity_filter_mode View documentation}
|
15429
15615
|
*/
|
15430
15616
|
readonly alt_entity_filter_mode: string
|
15617
|
+
/**
|
15618
|
+
* The reverse entity filter mode used by this selection tool.
|
15619
|
+
*
|
15620
|
+
* _Can only be used if this is SelectionTool_
|
15621
|
+
*
|
15622
|
+
* {@link https://lua-api.factorio.com/latest/LuaItemPrototype.html#LuaItemPrototype.reverse_alt_entity_filter_mode View documentation}
|
15623
|
+
*/
|
15624
|
+
readonly reverse_alt_entity_filter_mode: string
|
15431
15625
|
/**
|
15432
15626
|
* The tile filter mode used by this selection tool.
|
15433
15627
|
*
|
@@ -15444,6 +15638,14 @@ interface LuaItemPrototype {
|
|
15444
15638
|
* {@link https://lua-api.factorio.com/latest/LuaItemPrototype.html#LuaItemPrototype.alt_tile_filter_mode View documentation}
|
15445
15639
|
*/
|
15446
15640
|
readonly alt_tile_filter_mode: string
|
15641
|
+
/**
|
15642
|
+
* The reverse tile filter mode used by this selection tool.
|
15643
|
+
*
|
15644
|
+
* _Can only be used if this is SelectionTool_
|
15645
|
+
*
|
15646
|
+
* {@link https://lua-api.factorio.com/latest/LuaItemPrototype.html#LuaItemPrototype.reverse_tile_filter_mode View documentation}
|
15647
|
+
*/
|
15648
|
+
readonly reverse_tile_filter_mode: string
|
15447
15649
|
/**
|
15448
15650
|
* The entity filters used by this selection tool indexed by entity name.
|
15449
15651
|
*
|
@@ -15460,6 +15662,14 @@ interface LuaItemPrototype {
|
|
15460
15662
|
* {@link https://lua-api.factorio.com/latest/LuaItemPrototype.html#LuaItemPrototype.alt_entity_filters View documentation}
|
15461
15663
|
*/
|
15462
15664
|
readonly alt_entity_filters: Record<string, LuaEntityPrototype>
|
15665
|
+
/**
|
15666
|
+
* The reverse entity filters used by this selection tool indexed by entity name.
|
15667
|
+
*
|
15668
|
+
* _Can only be used if this is SelectionTool_
|
15669
|
+
*
|
15670
|
+
* {@link https://lua-api.factorio.com/latest/LuaItemPrototype.html#LuaItemPrototype.reverse_entity_filters View documentation}
|
15671
|
+
*/
|
15672
|
+
readonly reverse_entity_filters: Record<string, LuaEntityPrototype>
|
15463
15673
|
/**
|
15464
15674
|
* The entity type filters used by this selection tool indexed by entity type.
|
15465
15675
|
*
|
@@ -15478,6 +15688,15 @@ interface LuaItemPrototype {
|
|
15478
15688
|
* @remarks The boolean value is meaningless and is used to allow easy lookup if a type exists in the dictionary.
|
15479
15689
|
*/
|
15480
15690
|
readonly alt_entity_type_filters: Record<string, boolean>
|
15691
|
+
/**
|
15692
|
+
* The reverse entity type filters used by this selection tool indexed by entity type.
|
15693
|
+
*
|
15694
|
+
* _Can only be used if this is SelectionTool_
|
15695
|
+
*
|
15696
|
+
* {@link https://lua-api.factorio.com/latest/LuaItemPrototype.html#LuaItemPrototype.reverse_entity_type_filters View documentation}
|
15697
|
+
* @remarks The boolean value is meaningless and is used to allow easy lookup if a type exists in the dictionary.
|
15698
|
+
*/
|
15699
|
+
readonly reverse_entity_type_filters: Record<string, boolean>
|
15481
15700
|
/**
|
15482
15701
|
* The tile filters used by this selection tool indexed by tile name.
|
15483
15702
|
*
|
@@ -15494,6 +15713,14 @@ interface LuaItemPrototype {
|
|
15494
15713
|
* {@link https://lua-api.factorio.com/latest/LuaItemPrototype.html#LuaItemPrototype.alt_tile_filters View documentation}
|
15495
15714
|
*/
|
15496
15715
|
readonly alt_tile_filters: Record<string, LuaTilePrototype>
|
15716
|
+
/**
|
15717
|
+
* The reverse tile filters used by this selection tool indexed by tile name.
|
15718
|
+
*
|
15719
|
+
* _Can only be used if this is SelectionTool_
|
15720
|
+
*
|
15721
|
+
* {@link https://lua-api.factorio.com/latest/LuaItemPrototype.html#LuaItemPrototype.reverse_tile_filters View documentation}
|
15722
|
+
*/
|
15723
|
+
readonly reverse_tile_filters: Record<string, LuaTilePrototype>
|
15497
15724
|
/**
|
15498
15725
|
* The number of entity filters this deconstruction item has or `nil` if this isn't a deconstruction item prototype.
|
15499
15726
|
*
|
@@ -15939,6 +16166,14 @@ interface SelectionToolItemPrototype extends BaseItemPrototype {
|
|
15939
16166
|
* {@link https://lua-api.factorio.com/latest/LuaItemPrototype.html#LuaItemPrototype.alt_selection_border_color View documentation}
|
15940
16167
|
*/
|
15941
16168
|
readonly alt_selection_border_color: ColorTable
|
16169
|
+
/**
|
16170
|
+
* The color used when doing reverse selection with this selection tool prototype.
|
16171
|
+
*
|
16172
|
+
* _Can only be used if this is SelectionTool_
|
16173
|
+
*
|
16174
|
+
* {@link https://lua-api.factorio.com/latest/LuaItemPrototype.html#LuaItemPrototype.reverse_selection_border_color View documentation}
|
16175
|
+
*/
|
16176
|
+
readonly reverse_selection_border_color: ColorTable
|
15942
16177
|
/**
|
15943
16178
|
* Flags that affect which entities will be selected.
|
15944
16179
|
*
|
@@ -15955,6 +16190,14 @@ interface SelectionToolItemPrototype extends BaseItemPrototype {
|
|
15955
16190
|
* {@link https://lua-api.factorio.com/latest/LuaItemPrototype.html#LuaItemPrototype.alt_selection_mode_flags View documentation}
|
15956
16191
|
*/
|
15957
16192
|
readonly alt_selection_mode_flags: SelectionModeFlags
|
16193
|
+
/**
|
16194
|
+
* Flags that affect which entities will be selected during reverse selection.
|
16195
|
+
*
|
16196
|
+
* _Can only be used if this is SelectionTool_
|
16197
|
+
*
|
16198
|
+
* {@link https://lua-api.factorio.com/latest/LuaItemPrototype.html#LuaItemPrototype.reverse_selection_mode_flags View documentation}
|
16199
|
+
*/
|
16200
|
+
readonly reverse_selection_mode_flags: SelectionModeFlags
|
15958
16201
|
/**
|
15959
16202
|
* _Can only be used if this is SelectionTool_
|
15960
16203
|
*
|
@@ -15967,6 +16210,12 @@ interface SelectionToolItemPrototype extends BaseItemPrototype {
|
|
15967
16210
|
* {@link https://lua-api.factorio.com/latest/LuaItemPrototype.html#LuaItemPrototype.alt_selection_cursor_box_type View documentation}
|
15968
16211
|
*/
|
15969
16212
|
readonly alt_selection_cursor_box_type: string
|
16213
|
+
/**
|
16214
|
+
* _Can only be used if this is SelectionTool_
|
16215
|
+
*
|
16216
|
+
* {@link https://lua-api.factorio.com/latest/LuaItemPrototype.html#LuaItemPrototype.reverse_selection_cursor_box_type View documentation}
|
16217
|
+
*/
|
16218
|
+
readonly reverse_selection_cursor_box_type: string
|
15970
16219
|
/**
|
15971
16220
|
* If tiles area always included when doing selection with this selection tool prototype.
|
15972
16221
|
*
|
@@ -15991,6 +16240,14 @@ interface SelectionToolItemPrototype extends BaseItemPrototype {
|
|
15991
16240
|
* {@link https://lua-api.factorio.com/latest/LuaItemPrototype.html#LuaItemPrototype.alt_entity_filter_mode View documentation}
|
15992
16241
|
*/
|
15993
16242
|
readonly alt_entity_filter_mode: string
|
16243
|
+
/**
|
16244
|
+
* The reverse entity filter mode used by this selection tool.
|
16245
|
+
*
|
16246
|
+
* _Can only be used if this is SelectionTool_
|
16247
|
+
*
|
16248
|
+
* {@link https://lua-api.factorio.com/latest/LuaItemPrototype.html#LuaItemPrototype.reverse_alt_entity_filter_mode View documentation}
|
16249
|
+
*/
|
16250
|
+
readonly reverse_alt_entity_filter_mode: string
|
15994
16251
|
/**
|
15995
16252
|
* The tile filter mode used by this selection tool.
|
15996
16253
|
*
|
@@ -16007,6 +16264,14 @@ interface SelectionToolItemPrototype extends BaseItemPrototype {
|
|
16007
16264
|
* {@link https://lua-api.factorio.com/latest/LuaItemPrototype.html#LuaItemPrototype.alt_tile_filter_mode View documentation}
|
16008
16265
|
*/
|
16009
16266
|
readonly alt_tile_filter_mode: string
|
16267
|
+
/**
|
16268
|
+
* The reverse tile filter mode used by this selection tool.
|
16269
|
+
*
|
16270
|
+
* _Can only be used if this is SelectionTool_
|
16271
|
+
*
|
16272
|
+
* {@link https://lua-api.factorio.com/latest/LuaItemPrototype.html#LuaItemPrototype.reverse_tile_filter_mode View documentation}
|
16273
|
+
*/
|
16274
|
+
readonly reverse_tile_filter_mode: string
|
16010
16275
|
/**
|
16011
16276
|
* The entity filters used by this selection tool indexed by entity name.
|
16012
16277
|
*
|
@@ -16023,6 +16288,14 @@ interface SelectionToolItemPrototype extends BaseItemPrototype {
|
|
16023
16288
|
* {@link https://lua-api.factorio.com/latest/LuaItemPrototype.html#LuaItemPrototype.alt_entity_filters View documentation}
|
16024
16289
|
*/
|
16025
16290
|
readonly alt_entity_filters: Record<string, LuaEntityPrototype>
|
16291
|
+
/**
|
16292
|
+
* The reverse entity filters used by this selection tool indexed by entity name.
|
16293
|
+
*
|
16294
|
+
* _Can only be used if this is SelectionTool_
|
16295
|
+
*
|
16296
|
+
* {@link https://lua-api.factorio.com/latest/LuaItemPrototype.html#LuaItemPrototype.reverse_entity_filters View documentation}
|
16297
|
+
*/
|
16298
|
+
readonly reverse_entity_filters: Record<string, LuaEntityPrototype>
|
16026
16299
|
/**
|
16027
16300
|
* The entity type filters used by this selection tool indexed by entity type.
|
16028
16301
|
*
|
@@ -16041,6 +16314,15 @@ interface SelectionToolItemPrototype extends BaseItemPrototype {
|
|
16041
16314
|
* @remarks The boolean value is meaningless and is used to allow easy lookup if a type exists in the dictionary.
|
16042
16315
|
*/
|
16043
16316
|
readonly alt_entity_type_filters: Record<string, boolean>
|
16317
|
+
/**
|
16318
|
+
* The reverse entity type filters used by this selection tool indexed by entity type.
|
16319
|
+
*
|
16320
|
+
* _Can only be used if this is SelectionTool_
|
16321
|
+
*
|
16322
|
+
* {@link https://lua-api.factorio.com/latest/LuaItemPrototype.html#LuaItemPrototype.reverse_entity_type_filters View documentation}
|
16323
|
+
* @remarks The boolean value is meaningless and is used to allow easy lookup if a type exists in the dictionary.
|
16324
|
+
*/
|
16325
|
+
readonly reverse_entity_type_filters: Record<string, boolean>
|
16044
16326
|
/**
|
16045
16327
|
* The tile filters used by this selection tool indexed by tile name.
|
16046
16328
|
*
|
@@ -16057,6 +16339,14 @@ interface SelectionToolItemPrototype extends BaseItemPrototype {
|
|
16057
16339
|
* {@link https://lua-api.factorio.com/latest/LuaItemPrototype.html#LuaItemPrototype.alt_tile_filters View documentation}
|
16058
16340
|
*/
|
16059
16341
|
readonly alt_tile_filters: Record<string, LuaTilePrototype>
|
16342
|
+
/**
|
16343
|
+
* The reverse tile filters used by this selection tool indexed by tile name.
|
16344
|
+
*
|
16345
|
+
* _Can only be used if this is SelectionTool_
|
16346
|
+
*
|
16347
|
+
* {@link https://lua-api.factorio.com/latest/LuaItemPrototype.html#LuaItemPrototype.reverse_tile_filters View documentation}
|
16348
|
+
*/
|
16349
|
+
readonly reverse_tile_filters: Record<string, LuaTilePrototype>
|
16060
16350
|
}
|
16061
16351
|
|
16062
16352
|
interface DeconstructionItemPrototype extends BaseItemPrototype {
|
package/generated/events.d.ts
CHANGED
@@ -21,7 +21,7 @@ interface CustomInputEvent extends EventData {
|
|
21
21
|
*/
|
22
22
|
readonly cursor_position: MapPositionTable
|
23
23
|
/**
|
24
|
-
* Information about the prototype that is selected when the custom input is used. `nil` if none is selected.
|
24
|
+
* Information about the prototype that is selected when the custom input is used. Needs to be enabled on the custom input's prototype. `nil` if none is selected.
|
25
25
|
*/
|
26
26
|
readonly selected_prototype?: SelectedPrototypeData
|
27
27
|
/**
|
@@ -3,36 +3,47 @@
|
|
3
3
|
/** @noSelfInFile */
|
4
4
|
|
5
5
|
/**
|
6
|
-
* See {@link LuaPlayer#index LuaPlayer.index}
|
6
|
+
* See {@link LuaPlayer#index LuaPlayer.index}.
|
7
7
|
*
|
8
|
-
*
|
8
|
+
* If using strict-index-types, and you need to use a plain number for this type, you can use a cast, e.g. `1 as PlayerIndex`.
|
9
9
|
*/
|
10
|
-
type PlayerIndex = uint
|
10
|
+
type PlayerIndex = uint & IndexBrand<"_playerIndexBrand">
|
11
11
|
|
12
12
|
/**
|
13
|
-
* See {@link LuaSurface#index LuaSurface.index}
|
13
|
+
* See {@link LuaSurface#index LuaSurface.index}.
|
14
14
|
*
|
15
|
-
*
|
15
|
+
* If using strict-index-types, and you need to use a plain number for this type, you can use a cast, e.g. `1 as SurfaceIndex`.
|
16
16
|
*/
|
17
|
-
type SurfaceIndex = uint
|
17
|
+
type SurfaceIndex = uint & IndexBrand<"_surfaceIndexBrand">
|
18
18
|
|
19
19
|
/**
|
20
|
-
* See {@link LuaEntity#unit_number LuaEntity.unit_number}
|
20
|
+
* See {@link LuaEntity#unit_number LuaEntity.unit_number}.
|
21
21
|
*
|
22
|
-
*
|
22
|
+
* If using strict-index-types, and you need to use a plain number for this type, you can use a cast, e.g. `1 as UnitNumber`.
|
23
23
|
*/
|
24
|
-
type UnitNumber = uint
|
24
|
+
type UnitNumber = uint & IndexBrand<"_unitNumberBrand">
|
25
25
|
|
26
26
|
/**
|
27
|
-
* See {@link LuaGuiElement#index LuaGuiElement.index}
|
27
|
+
* See {@link LuaGuiElement#index LuaGuiElement.index}.
|
28
28
|
*
|
29
|
-
*
|
29
|
+
* If using strict-index-types, and you need to use a plain number for this type, you can use a cast, e.g. `1 as GuiElementIndex`.
|
30
30
|
*/
|
31
|
-
type GuiElementIndex = uint
|
31
|
+
type GuiElementIndex = uint & IndexBrand<"_guiElementIndexBrand">
|
32
32
|
|
33
33
|
/**
|
34
|
-
* See {@link LuaBootstrap#register_on_entity_destroyed LuaBootstrap.register_on_entity_destroyed}
|
34
|
+
* See {@link LuaBootstrap#register_on_entity_destroyed LuaBootstrap.register_on_entity_destroyed}.
|
35
35
|
*
|
36
|
-
*
|
36
|
+
* If using strict-index-types, and you need to use a plain number for this type, you can use a cast, e.g. `1 as RegistrationNumber`.
|
37
37
|
*/
|
38
|
-
type RegistrationNumber = uint64
|
38
|
+
type RegistrationNumber = uint64 & IndexBrand<"_registrationNumberBrand">
|
39
|
+
|
40
|
+
interface __OptInFeatures {}
|
41
|
+
|
42
|
+
/**
|
43
|
+
* Equals a branded type when __OptInFeatures contains strictIndexTypes, otherwise equals `unknown`.
|
44
|
+
*/
|
45
|
+
type IndexBrand<B extends string> = "strictIndexTypes" extends keyof __OptInFeatures
|
46
|
+
? {
|
47
|
+
[K in B]: any
|
48
|
+
}
|
49
|
+
: unknown
|
package/package.json
CHANGED
package/runtime/pairs.d.ts
CHANGED
@@ -1,15 +1,10 @@
|
|
1
1
|
/** @noSelfInFile */
|
2
2
|
///<reference types="lua-types/5.2" />
|
3
3
|
|
4
|
-
/**
|
5
|
-
* Iterating with `pairs` will only iterate the array part of a {@link LuaCustomTable}.
|
6
|
-
*
|
7
|
-
* **Note**: you can also iterate on a LuaCustomTable directly without using `pairs`, e.g. `for(const [k, v] of table)`.
|
8
|
-
*/
|
9
|
-
declare function pairs<V>(table: LuaCustomTable<number | string, V>): LuaIterable<LuaMultiReturn<[number, V]>>
|
10
|
-
|
11
4
|
/** **Note**: you can also iterate on a LuaCustomTable directly without using `pairs`, e.g. `for(const [k, v] of table)`. */
|
12
|
-
declare function pairs<
|
5
|
+
declare function pairs<T extends LuaCustomTable<any, any>>(
|
6
|
+
table: T
|
7
|
+
): LuaIterable<LuaMultiReturn<T extends Iterable<infer E> ? E : never>>
|
13
8
|
|
14
9
|
/** @deprecated {@link LuaCustomTable} cannot be iterated with `ipairs`; Use {@link pairs} instead. */
|
15
10
|
declare function ipairs(table: LuaCustomTable<any, any>): never
|
@@ -1,52 +0,0 @@
|
|
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
|
-
}
|
@@ -1,18 +0,0 @@
|
|
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" />
|