typed-factorio 0.19.0 → 0.19.1
Sign up to get free protection for your applications and to get access to all the features.
- package/generated/classes.d.ts +177 -161
- package/generated/concepts.d.ts +6 -3
- package/package.json +1 -1
package/generated/classes.d.ts
CHANGED
@@ -725,7 +725,8 @@ interface LuaBurnerPrototype {
|
|
725
725
|
* {@link https://lua-api.factorio.com/latest/LuaChunkIterator.html View documentation}
|
726
726
|
* @noSelf
|
727
727
|
* @example
|
728
|
-
|
728
|
+
*
|
729
|
+
* ```
|
729
730
|
* for chunk in some_surface.get_chunks() do
|
730
731
|
* game.player.print("x: " .. chunk.x .. ", y: " .. chunk.y)
|
731
732
|
* game.player.print("area: " .. serpent.line(chunk.area))
|
@@ -1529,14 +1530,15 @@ interface LuaControl {
|
|
1529
1530
|
readonly position: MapPosition
|
1530
1531
|
})
|
1531
1532
|
/**
|
1532
|
-
|
1533
|
-
|
1534
|
-
|
1535
|
-
|
1536
|
-
|
1537
|
-
|
1538
|
-
|
1539
|
-
|
1533
|
+
* The player's cursor stack, or `nil` if the player controller is a spectator. Even though this property is marked as read-only, it returns a {@link LuaItemStack}, meaning it can be manipulated like so:
|
1534
|
+
*
|
1535
|
+
* {@link https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.cursor_stack View documentation}
|
1536
|
+
* @example
|
1537
|
+
*
|
1538
|
+
* ```
|
1539
|
+
* player.cursor_stack.clear()
|
1540
|
+
* ```
|
1541
|
+
*/
|
1540
1542
|
readonly cursor_stack: LuaItemStack | undefined
|
1541
1543
|
/**
|
1542
1544
|
* The ghost prototype in the player's cursor.
|
@@ -3487,15 +3489,16 @@ interface LuaEntity extends LuaControl {
|
|
3487
3489
|
*/
|
3488
3490
|
selected_gun_index: uint | undefined
|
3489
3491
|
/**
|
3490
|
-
|
3491
|
-
|
3492
|
-
|
3493
|
-
|
3494
|
-
|
3495
|
-
|
3496
|
-
|
3497
|
-
|
3498
|
-
|
3492
|
+
* Energy stored in the entity (heat in furnace, energy stored in electrical devices etc.). always 0 for entities that don't have the concept of energy stored inside.
|
3493
|
+
*
|
3494
|
+
* {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.energy View documentation}
|
3495
|
+
* @example
|
3496
|
+
*
|
3497
|
+
* ```
|
3498
|
+
* game.player.print("Machine energy: " .. game.player.selected.energy .. "J")
|
3499
|
+
* game.player.selected.energy = 3000
|
3500
|
+
* ```
|
3501
|
+
*/
|
3499
3502
|
energy: double
|
3500
3503
|
/**
|
3501
3504
|
* The temperature of this entities heat energy source if this entity uses a heat energy source or `nil`.
|
@@ -5200,15 +5203,16 @@ interface BaseEntity extends LuaControl {
|
|
5200
5203
|
*/
|
5201
5204
|
drop_target: LuaEntity | undefined
|
5202
5205
|
/**
|
5203
|
-
|
5204
|
-
|
5205
|
-
|
5206
|
-
|
5207
|
-
|
5208
|
-
|
5209
|
-
|
5210
|
-
|
5211
|
-
|
5206
|
+
* Energy stored in the entity (heat in furnace, energy stored in electrical devices etc.). always 0 for entities that don't have the concept of energy stored inside.
|
5207
|
+
*
|
5208
|
+
* {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.energy View documentation}
|
5209
|
+
* @example
|
5210
|
+
*
|
5211
|
+
* ```
|
5212
|
+
* game.player.print("Machine energy: " .. game.player.selected.energy .. "J")
|
5213
|
+
* game.player.selected.energy = 3000
|
5214
|
+
* ```
|
5215
|
+
*/
|
5212
5216
|
energy: double
|
5213
5217
|
/**
|
5214
5218
|
* The temperature of this entities heat energy source if this entity uses a heat energy source or `nil`.
|
@@ -13246,25 +13250,27 @@ interface BaseGuiElement {
|
|
13246
13250
|
}
|
13247
13251
|
>
|
13248
13252
|
/**
|
13249
|
-
|
13250
|
-
|
13251
|
-
|
13252
|
-
|
13253
|
-
|
13254
|
-
|
13255
|
-
|
13256
|
-
|
13253
|
+
* Remove children of this element. Any {@link LuaGuiElement} objects referring to the destroyed elements become invalid after this operation.
|
13254
|
+
*
|
13255
|
+
* {@link https://lua-api.factorio.com/latest/LuaGuiElement.html#LuaGuiElement.clear View documentation}
|
13256
|
+
* @example
|
13257
|
+
*
|
13258
|
+
* ```
|
13259
|
+
* game.player.gui.top.clear()
|
13260
|
+
* ```
|
13261
|
+
*/
|
13257
13262
|
clear(): void
|
13258
13263
|
/**
|
13259
|
-
|
13260
|
-
|
13261
|
-
|
13262
|
-
|
13263
|
-
|
13264
|
-
|
13265
|
-
|
13266
|
-
|
13267
|
-
|
13264
|
+
* Remove this element, along with its children. Any {@link LuaGuiElement} objects referring to the destroyed elements become invalid after this operation.
|
13265
|
+
*
|
13266
|
+
* {@link https://lua-api.factorio.com/latest/LuaGuiElement.html#LuaGuiElement.destroy View documentation}
|
13267
|
+
* @remarks The top-level GUI elements - {@link LuaGui#top LuaGui::top}, {@link LuaGui#left LuaGui::left}, {@link LuaGui#center LuaGui::center} and {@link LuaGui#screen LuaGui::screen} - can't be destroyed.
|
13268
|
+
* @example
|
13269
|
+
*
|
13270
|
+
* ```
|
13271
|
+
* game.player.gui.top.greeting.destroy()
|
13272
|
+
* ```
|
13273
|
+
*/
|
13268
13274
|
destroy(): void
|
13269
13275
|
/**
|
13270
13276
|
* The mod that owns this Gui element or `nil` if it's owned by the scenario script.
|
@@ -13320,14 +13326,15 @@ interface BaseGuiElement {
|
|
13320
13326
|
*/
|
13321
13327
|
readonly parent: LuaGuiElement | undefined
|
13322
13328
|
/**
|
13323
|
-
|
13324
|
-
|
13325
|
-
|
13326
|
-
|
13327
|
-
|
13328
|
-
|
13329
|
-
|
13330
|
-
|
13329
|
+
* The name of this element.
|
13330
|
+
*
|
13331
|
+
* {@link https://lua-api.factorio.com/latest/LuaGuiElement.html#LuaGuiElement.name View documentation}
|
13332
|
+
* @example
|
13333
|
+
*
|
13334
|
+
* ```
|
13335
|
+
* game.player.gui.top.greeting.name == "greeting"
|
13336
|
+
* ```
|
13337
|
+
*/
|
13331
13338
|
name: string
|
13332
13339
|
/**
|
13333
13340
|
* The text displayed on this element. For frames, this is the "heading". For other elements, like buttons or labels, this is the content.
|
@@ -15017,7 +15024,8 @@ interface LuaInventory extends ReadonlyArray<LuaItemStack> {
|
|
15017
15024
|
* {@link https://lua-api.factorio.com/latest/LuaItemPrototype.html View documentation}
|
15018
15025
|
* @noSelf
|
15019
15026
|
* @example
|
15020
|
-
|
15027
|
+
*
|
15028
|
+
* ```
|
15021
15029
|
* game.item_prototypes["iron-plate"]
|
15022
15030
|
* ```
|
15023
15031
|
*/
|
@@ -21896,14 +21904,15 @@ interface LuaStyle {
|
|
21896
21904
|
get color(): ColorTable
|
21897
21905
|
set color(value: Color)
|
21898
21906
|
/**
|
21899
|
-
|
21900
|
-
|
21901
|
-
|
21902
|
-
|
21903
|
-
|
21904
|
-
|
21905
|
-
|
21906
|
-
|
21907
|
+
* Array containing the alignment for every column of this table element. Even though this property is marked as read-only, the alignment can be changed by indexing the LuaCustomTable, like so:
|
21908
|
+
*
|
21909
|
+
* {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.column_alignments View documentation}
|
21910
|
+
* @example
|
21911
|
+
*
|
21912
|
+
* ```
|
21913
|
+
* table_element.style.column_alignments[1] = "center"
|
21914
|
+
* ```
|
21915
|
+
*/
|
21907
21916
|
readonly column_alignments: LuaCustomTable<uint, Alignment>
|
21908
21917
|
/**
|
21909
21918
|
* _Can only be used if this is LabelStyle_
|
@@ -22162,14 +22171,15 @@ interface BaseStyle {
|
|
22162
22171
|
*/
|
22163
22172
|
vertically_squashable: boolean
|
22164
22173
|
/**
|
22165
|
-
|
22166
|
-
|
22167
|
-
|
22168
|
-
|
22169
|
-
|
22170
|
-
|
22171
|
-
|
22172
|
-
|
22174
|
+
* Array containing the alignment for every column of this table element. Even though this property is marked as read-only, the alignment can be changed by indexing the LuaCustomTable, like so:
|
22175
|
+
*
|
22176
|
+
* {@link https://lua-api.factorio.com/latest/LuaStyle.html#LuaStyle.column_alignments View documentation}
|
22177
|
+
* @example
|
22178
|
+
*
|
22179
|
+
* ```
|
22180
|
+
* table_element.style.column_alignments[1] = "center"
|
22181
|
+
* ```
|
22182
|
+
*/
|
22173
22183
|
readonly column_alignments: LuaCustomTable<uint, Alignment>
|
22174
22184
|
/**
|
22175
22185
|
* Sets both minimal and maximal width to the given value.
|
@@ -22867,15 +22877,16 @@ type SurfaceCreateEntity =
|
|
22867
22877
|
*/
|
22868
22878
|
interface LuaSurface {
|
22869
22879
|
/**
|
22870
|
-
|
22871
|
-
|
22872
|
-
|
22873
|
-
|
22874
|
-
|
22875
|
-
|
22876
|
-
|
22877
|
-
|
22878
|
-
|
22880
|
+
* Get the pollution for a given position.
|
22881
|
+
*
|
22882
|
+
* {@link https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.get_pollution View documentation}
|
22883
|
+
* @remarks Pollution is stored per chunk, so this will return the same value for all positions in one chunk.
|
22884
|
+
* @example
|
22885
|
+
*
|
22886
|
+
* ```
|
22887
|
+
* game.surfaces[1].get_pollution({1,2})
|
22888
|
+
* ```
|
22889
|
+
*/
|
22879
22890
|
get_pollution(position: MapPosition): double
|
22880
22891
|
/**
|
22881
22892
|
* Check for collisions with terrain or other entities.
|
@@ -22936,17 +22947,18 @@ interface LuaSurface {
|
|
22936
22947
|
readonly force?: ForceIdentification
|
22937
22948
|
}): boolean
|
22938
22949
|
/**
|
22939
|
-
|
22940
|
-
|
22941
|
-
|
22942
|
-
|
22943
|
-
|
22944
|
-
|
22945
|
-
|
22946
|
-
|
22947
|
-
|
22948
|
-
|
22949
|
-
|
22950
|
+
* Find a specific entity at a specific position.
|
22951
|
+
*
|
22952
|
+
* {@link https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_entity View documentation}
|
22953
|
+
* @param entity Entity to look for.
|
22954
|
+
* @param position Coordinates to look at.
|
22955
|
+
* @returns `nil` if no such entity is found.
|
22956
|
+
* @example
|
22957
|
+
*
|
22958
|
+
* ```
|
22959
|
+
* game.player.selected.surface.find_entity('filter-inserter', {0,0})
|
22960
|
+
* ```
|
22961
|
+
*/
|
22950
22962
|
find_entity(entity: string, position: MapPosition): LuaEntity | undefined
|
22951
22963
|
/**
|
22952
22964
|
* Find entities in a given area.
|
@@ -22962,23 +22974,24 @@ interface LuaSurface {
|
|
22962
22974
|
*/
|
22963
22975
|
find_entities(area?: BoundingBox): LuaEntity[]
|
22964
22976
|
/**
|
22965
|
-
|
22966
|
-
|
22967
|
-
|
22968
|
-
|
22969
|
-
|
22970
|
-
|
22971
|
-
|
22972
|
-
|
22973
|
-
|
22974
|
-
|
22975
|
-
|
22976
|
-
|
22977
|
-
|
22978
|
-
|
22979
|
-
|
22980
|
-
|
22981
|
-
|
22977
|
+
* Find all entities of the given type or name in the given area.
|
22978
|
+
*
|
22979
|
+
* If no filters (`name`, `type`, `force`, etc.) are given, this returns all entities in the search area. If multiple filters are specified, only entities matching all given filters are returned.
|
22980
|
+
*
|
22981
|
+
* If no `area` or `position` are given, the entire surface is searched. If `position` is given, this returns the entities colliding with that position (i.e the given position is within the entity's collision box). If `position` and `radius` are given, this returns the entities within the radius of the position. If `area` is specified, this returns the entities colliding with that area.
|
22982
|
+
*
|
22983
|
+
* {@link https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_entities_filtered View documentation}
|
22984
|
+
* @example
|
22985
|
+
*
|
22986
|
+
* ```
|
22987
|
+
* game.surfaces[1].find_entities_filtered{area = {{-10, -10}, {10, 10}}, type = "resource"} -- gets all resources in the rectangle
|
22988
|
+
* game.surfaces[1].find_entities_filtered{area = {{-10, -10}, {10, 10}}, name = "iron-ore"} -- gets all iron ores in the rectangle
|
22989
|
+
* game.surfaces[1].find_entities_filtered{area = {{-10, -10}, {10, 10}}, name = {"iron-ore", "copper-ore"}} -- gets all iron ore and copper ore in the rectangle
|
22990
|
+
* game.surfaces[1].find_entities_filtered{area = {{-10, -10}, {10, 10}}, force = "player"} -- gets player owned entities in the rectangle
|
22991
|
+
* game.surfaces[1].find_entities_filtered{area = {{-10, -10}, {10, 10}}, limit = 5} -- gets the first 5 entities in the rectangle
|
22992
|
+
* game.surfaces[1].find_entities_filtered{position = {0, 0}, radius = 10} -- gets all entities within 10 tiles of the position [0,0].
|
22993
|
+
* ```
|
22994
|
+
*/
|
22982
22995
|
find_entities_filtered(params: {
|
22983
22996
|
readonly area?: BoundingBox
|
22984
22997
|
/**
|
@@ -23241,50 +23254,52 @@ interface LuaSurface {
|
|
23241
23254
|
readonly unit_search_distance?: uint
|
23242
23255
|
}): uint
|
23243
23256
|
/**
|
23244
|
-
|
23245
|
-
|
23246
|
-
|
23247
|
-
|
23248
|
-
|
23249
|
-
|
23250
|
-
|
23251
|
-
|
23252
|
-
|
23253
|
-
|
23254
|
-
|
23255
|
-
|
23256
|
-
|
23257
|
-
|
23258
|
-
|
23259
|
-
|
23260
|
-
|
23261
|
-
|
23262
|
-
|
23263
|
-
|
23264
|
-
|
23265
|
-
|
23266
|
-
|
23267
|
-
|
23268
|
-
|
23269
|
-
|
23270
|
-
|
23271
|
-
|
23272
|
-
|
23273
|
-
|
23274
|
-
|
23275
|
-
|
23276
|
-
|
23277
|
-
|
23278
|
-
|
23279
|
-
|
23280
|
-
|
23281
|
-
|
23282
|
-
|
23283
|
-
|
23284
|
-
|
23285
|
-
|
23286
|
-
|
23287
|
-
|
23257
|
+
* Create an entity on this surface.
|
23258
|
+
*
|
23259
|
+
* Other attributes may be specified depending on the type of entity:
|
23260
|
+
*
|
23261
|
+
* **Raised events:**
|
23262
|
+
* - {@link ScriptRaisedBuiltEvent script_raised_built}? _instantly_ Raised if the `raise_built` flag was set and the entity was successfully created.
|
23263
|
+
*
|
23264
|
+
*
|
23265
|
+
* {@link https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity View documentation}
|
23266
|
+
* @returns The created entity or `nil` if the creation failed.
|
23267
|
+
* @example
|
23268
|
+
*
|
23269
|
+
* ```
|
23270
|
+
* asm = game.surfaces[1].create_entity{name = "assembling-machine-1", position = {15, 3}, force = game.forces.player, recipe = "iron-stick"}
|
23271
|
+
* ```
|
23272
|
+
* @example Creates a filter inserter with circuit conditions and a filter
|
23273
|
+
*
|
23274
|
+
* ```
|
23275
|
+
* game.surfaces[1].create_entity{
|
23276
|
+
* name = "filter-inserter", position = {20, 15}, force = game.player.force,
|
23277
|
+
* conditions = {red = {name = "wood", count = 3, operator = ">"},
|
23278
|
+
* green = {name = "iron-ore", count = 1, operator = "<"},
|
23279
|
+
* logistics = {name = "wood", count = 3, operator = "="}},
|
23280
|
+
* filters = {{index = 1, name = "iron-ore"}}
|
23281
|
+
* }
|
23282
|
+
* ```
|
23283
|
+
* @example Creates a requester chest already set to request 128 iron plates.
|
23284
|
+
*
|
23285
|
+
* ```
|
23286
|
+
* game.surfaces[1].create_entity{
|
23287
|
+
* name = "logistic-chest-requester", position = {game.player.position.x+3, game.player.position.y},
|
23288
|
+
* force = game.player.force, request_filters = {{index = 1, name = "iron-plate", count = 128}}
|
23289
|
+
* }
|
23290
|
+
* ```
|
23291
|
+
* @example
|
23292
|
+
*
|
23293
|
+
* ```
|
23294
|
+
* game.surfaces[1].create_entity{name = "big-biter", position = {15, 3}, force = game.forces.player} -- Friendly biter
|
23295
|
+
* game.surfaces[1].create_entity{name = "medium-biter", position = {15, 3}, force = game.forces.enemy} -- Enemy biter
|
23296
|
+
* ```
|
23297
|
+
* @example Creates a basic inserter at the player's location facing north
|
23298
|
+
*
|
23299
|
+
* ```
|
23300
|
+
* game.surfaces[1].create_entity{name = "inserter", position = game.player.position, direction = defines.direction.north}
|
23301
|
+
* ```
|
23302
|
+
*/
|
23288
23303
|
create_entity(params: SurfaceCreateEntity): LuaEntity | undefined
|
23289
23304
|
create_trivial_smoke(params: {
|
23290
23305
|
/**
|
@@ -23646,17 +23661,18 @@ interface LuaSurface {
|
|
23646
23661
|
readonly decoratives: readonly Decorative[]
|
23647
23662
|
}): void
|
23648
23663
|
/**
|
23649
|
-
|
23650
|
-
|
23651
|
-
|
23652
|
-
|
23653
|
-
|
23654
|
-
|
23655
|
-
|
23656
|
-
|
23657
|
-
|
23658
|
-
|
23659
|
-
|
23664
|
+
* Find decoratives of a given name in a given area.
|
23665
|
+
*
|
23666
|
+
* If no filters are given, returns all decoratives in the search area. If multiple filters are specified, returns only decoratives matching every given filter. If no area and no position are given, the entire surface is searched.
|
23667
|
+
*
|
23668
|
+
* {@link https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_decoratives_filtered View documentation}
|
23669
|
+
* @example
|
23670
|
+
*
|
23671
|
+
* ```
|
23672
|
+
* game.surfaces[1].find_decoratives_filtered{area = {{-10, -10}, {10, 10}}, name = "sand-decal"} -- gets all sand-decals in the rectangle
|
23673
|
+
* game.surfaces[1].find_decoratives_filtered{area = {{-10, -10}, {10, 10}}, limit = 5} -- gets the first 5 decoratives in the rectangle
|
23674
|
+
* ```
|
23675
|
+
*/
|
23660
23676
|
find_decoratives_filtered(params: {
|
23661
23677
|
readonly area?: BoundingBox
|
23662
23678
|
readonly position?: TilePosition
|
package/generated/concepts.d.ts
CHANGED
@@ -218,7 +218,8 @@ interface OldTileAndPosition {
|
|
218
218
|
*
|
219
219
|
* {@link https://lua-api.factorio.com/latest/Concepts.html#Tags View documentation}
|
220
220
|
* @example
|
221
|
-
|
221
|
+
*
|
222
|
+
* ```
|
222
223
|
* {a = 1, b = true, c = "three", d = {e = "f"}}
|
223
224
|
* ```
|
224
225
|
*/
|
@@ -257,7 +258,8 @@ interface SmokeSource {
|
|
257
258
|
*
|
258
259
|
* {@link https://lua-api.factorio.com/latest/Concepts.html#Vector View documentation}
|
259
260
|
* @example
|
260
|
-
|
261
|
+
*
|
262
|
+
* ```
|
261
263
|
* right = {1.0, 0.0}
|
262
264
|
* ```
|
263
265
|
*/
|
@@ -344,7 +346,8 @@ type ColorArray = readonly [r?: float, g?: float, b?: float, a?: float]
|
|
344
346
|
*
|
345
347
|
* {@link https://lua-api.factorio.com/latest/Concepts.html#Color View documentation}
|
346
348
|
* @example
|
347
|
-
|
349
|
+
*
|
350
|
+
* ```
|
348
351
|
* red1 = {r = 0.5, g = 0, b = 0, a = 0.5} -- Half-opacity red
|
349
352
|
* red2 = {r = 0.5, a = 0.5} -- Same color as red1
|
350
353
|
* black = {} -- All channels omitted: black
|