typed-factorio 1.13.0 → 1.14.0

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typed-factorio",
3
- "version": "1.13.0",
3
+ "version": "1.14.0",
4
4
  "description": "Featureful typescript definitions for the the Factorio modding lua api.",
5
5
  "keywords": [
6
6
  "factorio",
@@ -33,30 +33,30 @@
33
33
  "typescript-to-lua": "^1.6.1"
34
34
  },
35
35
  "devDependencies": {
36
- "@types/jest": "^29.2.5",
37
- "@types/node": "^18.11.18",
36
+ "@types/jest": "^29.4.0",
37
+ "@types/node": "^18.14.6",
38
38
  "@types/prettier": "^2.7.2",
39
- "@typescript-eslint/eslint-plugin": "^5.48.1",
40
- "@typescript-eslint/parser": "^5.48.1",
39
+ "@typescript-eslint/eslint-plugin": "^5.54.0",
40
+ "@typescript-eslint/parser": "^5.54.0",
41
41
  "array.prototype.flatmap": "^1.3.1",
42
42
  "chalk": "^5.2.0",
43
- "eslint": "~8.31.0",
43
+ "eslint": "~8.35.0",
44
44
  "eslint-config-prettier": "^8.6.0",
45
45
  "eslint-config-standard": "^17.0.0",
46
46
  "eslint-import-resolver-typescript": "^3.5.3",
47
- "eslint-plugin-import": "^2.27.0",
47
+ "eslint-plugin-import": "^2.27.5",
48
48
  "eslint-plugin-n": "^15.6.1",
49
49
  "eslint-plugin-node": "^11.1.0",
50
50
  "eslint-plugin-prettier": "^4.2.1",
51
51
  "eslint-plugin-promise": "^6.1.1",
52
- "jest": "^29.3.1",
52
+ "jest": "^29.4.3",
53
53
  "lua-types": "^2.13.1",
54
- "prettier": "^2.8.2",
54
+ "prettier": "^2.8.4",
55
55
  "rimraf": "^3.0.2",
56
- "ts-jest": "^29.0.4",
56
+ "ts-jest": "^29.0.5",
57
57
  "ts-node": "^10.9.1",
58
- "typescript": "~4.9.4",
59
- "typescript-to-lua": "^1.11.1"
58
+ "typescript": "~4.9.5",
59
+ "typescript-to-lua": "^1.13.2"
60
60
  },
61
61
  "packageManager": "yarn@3.2.3"
62
62
  }
@@ -494,6 +494,25 @@ interface LuaBootstrap {
494
494
  */
495
495
  readonly tags?: Tags
496
496
  }): void
497
+ /**
498
+ * **Raised events:**
499
+ * - {@link ScriptRaisedTeleportedEvent script_raised_teleported} _instantly_ Raised with the provided arguments.
500
+ * @see {@link https://lua-api.factorio.com/latest/LuaBootstrap.html#LuaBootstrap.raise_script_teleported Online documentation}
501
+ */
502
+ raise_script_teleported(params: {
503
+ /**
504
+ * The entity that was teleported.
505
+ */
506
+ readonly entity: LuaEntity
507
+ /**
508
+ * The entity's surface before the teleportation.
509
+ */
510
+ readonly old_surface_index: uint8
511
+ /**
512
+ * The entity's position before the teleportation.
513
+ */
514
+ readonly old_position: MapPosition | MapPositionArray
515
+ }): void
497
516
  /**
498
517
  * **Raised events:**
499
518
  * - {@link ScriptRaisedSetTilesEvent script_raised_set_tiles} _instantly_ Raised with the provided arguments.
@@ -785,7 +804,7 @@ interface LuaCombinatorControlBehavior extends LuaControlBehavior {
785
804
  }
786
805
 
787
806
  /**
788
- * Allows for the registration of custom console commands. Similarly to {@link LuaBootstrap#on_event event subscriptions}, these don't persist through a save-and-load cycle.
807
+ * Allows for the registration of custom console commands through the global object named `commands`. Similarly to {@link LuaBootstrap#on_event event subscriptions}, these don't persist through a save-and-load cycle.
789
808
  * @see {@link https://lua-api.factorio.com/latest/LuaCommandProcessor.html Online documentation}
790
809
  * @noSelf
791
810
  */
@@ -979,6 +998,11 @@ interface LuaControl {
979
998
  * @see {@link https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.get_inventory Online documentation}
980
999
  */
981
1000
  get_inventory(inventory: defines.inventory): LuaInventory | nil
1001
+ /**
1002
+ * The maximum inventory index this entity may use.
1003
+ * @see {@link https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.get_max_inventory_index Online documentation}
1004
+ */
1005
+ get_max_inventory_index(): defines.inventory
982
1006
  /**
983
1007
  * Gets the main inventory for this character or player if this is a character or player.
984
1008
  * @returns The inventory or `nil` if this entity is not a character or player.
@@ -1048,10 +1072,12 @@ interface LuaControl {
1048
1072
  *
1049
1073
  * **Raised events:**
1050
1074
  * - {@link OnPlayerChangedPositionEvent on_player_changed_position}? _instantly_ Raised if the teleported entity is a player character.
1075
+ * - {@link ScriptRaisedTeleportedEvent script_raised_teleported}? _instantly_ Raised if the `raise_teleported` flag was set and the entity was successfully teleported.
1051
1076
  * @param position Where to teleport to.
1052
1077
  * @param surface Surface to teleport to. If not given, will teleport to the entity's current surface. Only players, cars, and spidertrons can be teleported cross-surface.
1078
+ * @param raise_teleported If true, {@link defines.events.script_raised_teleported} will be fired on successful entity teleportation.
1053
1079
  * @returns `true` if the entity was successfully teleported.
1054
- * @remarks Some entities may not be teleported. For instance, transport belts won't allow teleportation and this method will always return `false` when used on any such entity.<br>You can also pass 1 or 2 numbers as the parameters and they will be used as relative teleport coordinates `'teleport(0, 1)'` to move the entity 1 tile positive y. `'teleport(4)'` to move the entity 4 tiles to the positive x.
1080
+ * @remarks Some entities may not be teleported. For instance, transport belts won't allow teleportation and this method will always return `false` when used on any such entity.<br>You can also pass 1 or 2 numbers as the parameters and they will be used as relative teleport coordinates `'teleport(0, 1)'` to move the entity 1 tile positive y. `'teleport(4)'` to move the entity 4 tiles to the positive x.<br>`script_raised_teleported` will not be raised if teleporting a player with no character.
1055
1081
  * @see {@link https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.teleport Online documentation}
1056
1082
  */
1057
1083
  teleport(position: MapPosition | MapPositionArray, surface?: SurfaceIdentification): boolean
@@ -1272,7 +1298,7 @@ interface LuaControl {
1272
1298
  * Unique ID associated with the force of this entity.
1273
1299
  * @see {@link https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.force_index Online documentation}
1274
1300
  */
1275
- readonly force_index: uint
1301
+ readonly force_index: ForceIndex
1276
1302
  /**
1277
1303
  * The currently selected entity. Assigning an entity will select it if is selectable, otherwise the selection is cleared.
1278
1304
  *
@@ -7190,7 +7216,7 @@ interface LuaEntityPrototype {
7190
7216
  readonly fluid?: LuaFluidPrototype
7191
7217
  /**
7192
7218
  * The fluid capacity of this entity or 0 if this entity doesn't support fluids.
7193
- * @remarks Crafting machines will report 0 due to their fluid capacity being what ever a given recipe needs.
7219
+ * @remarks Crafting machines will report 0 due to their fluid capacity being whatever a given recipe needs.
7194
7220
  * @see {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.fluid_capacity Online documentation}
7195
7221
  */
7196
7222
  readonly fluid_capacity: double
@@ -8391,7 +8417,7 @@ interface BaseEntityPrototype {
8391
8417
  readonly building_grid_bit_shift: uint
8392
8418
  /**
8393
8419
  * The fluid capacity of this entity or 0 if this entity doesn't support fluids.
8394
- * @remarks Crafting machines will report 0 due to their fluid capacity being what ever a given recipe needs.
8420
+ * @remarks Crafting machines will report 0 due to their fluid capacity being whatever a given recipe needs.
8395
8421
  * @see {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.fluid_capacity Online documentation}
8396
8422
  */
8397
8423
  readonly fluid_capacity: double
@@ -10692,10 +10718,10 @@ interface LuaFlowStatistics {
10692
10718
  */
10693
10719
  interface LuaFluidBox extends Array<Fluid | nil> {
10694
10720
  /**
10695
- * The prototype of this fluidbox index.
10721
+ * The prototype of this fluidbox index. If this is used on a fluidbox of a crafting machine which due to recipe was created by merging multiple prototypes, a table of prototypes that were merged will be returned instead
10696
10722
  * @see {@link https://lua-api.factorio.com/latest/LuaFluidBox.html#LuaFluidBox.get_prototype Online documentation}
10697
10723
  */
10698
- get_prototype(index: uint): LuaFluidBoxPrototype
10724
+ get_prototype(index: uint): LuaFluidBoxPrototype | LuaFluidBoxPrototype[]
10699
10725
  /**
10700
10726
  * The capacity of the given fluidbox index.
10701
10727
  * @see {@link https://lua-api.factorio.com/latest/LuaFluidBox.html#LuaFluidBox.get_capacity Online documentation}
@@ -11588,7 +11614,7 @@ interface LuaForce {
11588
11614
  * Unique ID associated with this force.
11589
11615
  * @see {@link https://lua-api.factorio.com/latest/LuaForce.html#LuaForce.index Online documentation}
11590
11616
  */
11591
- readonly index: uint
11617
+ readonly index: ForceIndex
11592
11618
  /**
11593
11619
  * The research queue of this force. The first technology in the array is the currently active one. Reading this attribute gives an array of {@link LuaTechnology}.
11594
11620
  *
@@ -16942,6 +16968,21 @@ interface LuaItemStack {
16942
16968
  * @see {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.connected_entity Online documentation}
16943
16969
  */
16944
16970
  connected_entity?: LuaEntity
16971
+ /**
16972
+ * If this is an item with entity data, get the stored entity label.
16973
+ *
16974
+ * _Can only be used if this is ItemWithEntityData_
16975
+ * @see {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.entity_label Online documentation}
16976
+ */
16977
+ entity_label?: string
16978
+ /**
16979
+ * If this is an item with entity data, get the stored entity color.
16980
+ *
16981
+ * _Can only be used if this is ItemWithEntityData_
16982
+ * @see {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.entity_color Online documentation}
16983
+ */
16984
+ get entity_color(): Color | nil
16985
+ set entity_color(value: Color | ColorArray | nil)
16945
16986
  /**
16946
16987
  * If this is a blueprint item.
16947
16988
  * @see {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.is_blueprint Online documentation}
@@ -17720,6 +17761,21 @@ interface ItemWithEntityDataItemStack extends BaseItemStack {
17720
17761
  * @see {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.create_grid Online documentation}
17721
17762
  */
17722
17763
  create_grid(): LuaEquipmentGrid
17764
+ /**
17765
+ * If this is an item with entity data, get the stored entity label.
17766
+ *
17767
+ * _Can only be used if this is ItemWithEntityData_
17768
+ * @see {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.entity_label Online documentation}
17769
+ */
17770
+ entity_label?: string
17771
+ /**
17772
+ * If this is an item with entity data, get the stored entity color.
17773
+ *
17774
+ * _Can only be used if this is ItemWithEntityData_
17775
+ * @see {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.entity_color Online documentation}
17776
+ */
17777
+ get entity_color(): Color | nil
17778
+ set entity_color(value: Color | ColorArray | nil)
17723
17779
  }
17724
17780
 
17725
17781
  interface ItemWithLabelItemStack extends BaseItemStack {
@@ -18906,7 +18962,7 @@ interface LuaPlayer extends LuaControl {
18906
18962
  readonly skip_fog_of_war?: boolean
18907
18963
  }): boolean
18908
18964
  /**
18909
- * Builds what ever is in the cursor on the surface the player is on. The cursor stack will automatically be reduced as if the player built normally.
18965
+ * Builds whatever is in the cursor on the surface the player is on. The cursor stack will automatically be reduced as if the player built normally.
18910
18966
  *
18911
18967
  * **Raised events:**
18912
18968
  * - {@link OnPreBuildEvent on_pre_build}? _instantly_ Raised if the cursor was successfully built.
@@ -19121,22 +19177,22 @@ interface LuaPlayer extends LuaControl {
19121
19177
  */
19122
19178
  toggle_map_editor(): void
19123
19179
  /**
19124
- * Requests a translation for the given localised string. If the request is successful the {@link OnStringTranslatedEvent on_string_translated} event will be fired at a later time with the results.
19180
+ * Requests a translation for the given localised string. If the request is successful, the {@link OnStringTranslatedEvent on_string_translated} event will be fired with the results.
19125
19181
  *
19126
19182
  * **Raised events:**
19127
19183
  * - {@link OnStringTranslatedEvent on_string_translated}? _future_tick_ Raised if the request was successfully sent.
19128
- * @returns The unique id for the requested translation.
19129
- * @remarks Does nothing if this player is not connected. (see {@link LuaPlayer#connected LuaPlayer::connected}).
19184
+ * @returns The unique ID for the requested translation.
19185
+ * @remarks Does nothing if this player is not connected (see {@link LuaPlayer#connected LuaPlayer::connected}).
19130
19186
  * @see {@link https://lua-api.factorio.com/latest/LuaPlayer.html#LuaPlayer.request_translation Online documentation}
19131
19187
  */
19132
19188
  request_translation(localised_string: LocalisedString): uint | nil
19133
19189
  /**
19134
- * Requests a translation for the given localised strings. If the request is successful the {@link OnStringTranslatedEvent on_string_translated} event will be fired at a later time with the results.
19190
+ * Requests translation for the given set of localised strings. If the request is successful, a {@link OnStringTranslatedEvent on_string_translated} event will be fired for each string with the results.
19135
19191
  *
19136
19192
  * **Raised events:**
19137
19193
  * - {@link OnStringTranslatedEvent on_string_translated}? _future_tick_ Raised if the request was successfully sent.
19138
- * @returns The unique id for the requested translation.
19139
- * @remarks Does nothing if this player is not connected. (see {@link LuaPlayer#connected LuaPlayer::connected}).
19194
+ * @returns The unique IDs for the requested translations.
19195
+ * @remarks Does nothing if this player is not connected (see {@link LuaPlayer#connected LuaPlayer::connected}).
19140
19196
  * @see {@link https://lua-api.factorio.com/latest/LuaPlayer.html#LuaPlayer.request_translations Online documentation}
19141
19197
  */
19142
19198
  request_translations(localised_strings: readonly LocalisedString[]): uint[] | nil
@@ -19457,7 +19513,7 @@ interface LuaProgrammableSpeakerControlBehavior extends LuaControlBehavior {
19457
19513
  }
19458
19514
 
19459
19515
  /**
19460
- * An interface to send messages to the calling RCON interface.
19516
+ * An interface to send messages to the calling RCON interface through the global object named `rcon`.
19461
19517
  * @see {@link https://lua-api.factorio.com/latest/LuaRCON.html Online documentation}
19462
19518
  * @noSelf
19463
19519
  */
@@ -19966,7 +20022,7 @@ interface LuaRemote {
19966
20022
  }
19967
20023
 
19968
20024
  /**
19969
- * Allows rendering of geometric shapes, text and sprites in the game world. Each render object is identified by an id that is universally unique for the lifetime of a whole game.
20025
+ * Allows rendering of geometric shapes, text and sprites in the game world through the global object named `rendering`. Each render object is identified by an id that is universally unique for the lifetime of a whole game.
19970
20026
  * @remarks If an entity target of an object is destroyed or changes surface, then the object is also destroyed.
19971
20027
  * @see {@link https://lua-api.factorio.com/latest/LuaRendering.html Online documentation}
19972
20028
  * @noSelf
@@ -20077,7 +20133,7 @@ interface LuaRendering {
20077
20133
  */
20078
20134
  readonly visible?: boolean
20079
20135
  /**
20080
- * If this should be drawn below sprites and entities.
20136
+ * If this should be drawn below sprites and entities. Rich text does not support this option.
20081
20137
  */
20082
20138
  readonly draw_on_ground?: boolean
20083
20139
  /**
@@ -20100,6 +20156,10 @@ interface LuaRendering {
20100
20156
  * If this should only be rendered in alt mode. Defaults to false.
20101
20157
  */
20102
20158
  readonly only_in_alt_mode?: boolean
20159
+ /**
20160
+ * If rich text rendering is enabled. Defaults to false.
20161
+ */
20162
+ readonly use_rich_text?: boolean
20103
20163
  }): uint64
20104
20164
  /**
20105
20165
  * Create a circle.
@@ -20850,6 +20910,21 @@ interface LuaRendering {
20850
20910
  * @see {@link https://lua-api.factorio.com/latest/LuaRendering.html#LuaRendering.set_scale_with_zoom Online documentation}
20851
20911
  */
20852
20912
  set_scale_with_zoom(id: uint64, scale_with_zoom: boolean): void
20913
+ /**
20914
+ * Get if the text with this id parses rich text tags.
20915
+ *
20916
+ * _Can only be used if this is Text_
20917
+ * @returns `nil` if the object is not a text.
20918
+ * @see {@link https://lua-api.factorio.com/latest/LuaRendering.html#LuaRendering.get_use_rich_text Online documentation}
20919
+ */
20920
+ get_use_rich_text(id: uint64): boolean | nil
20921
+ /**
20922
+ * Set if the text with this id parses rich text tags.
20923
+ *
20924
+ * _Can only be used if this is Text_
20925
+ * @see {@link https://lua-api.factorio.com/latest/LuaRendering.html#LuaRendering.set_use_rich_text Online documentation}
20926
+ */
20927
+ set_use_rich_text(id: uint64, use_rich_text: boolean): void
20853
20928
  /**
20854
20929
  * Get if the circle or rectangle with this id is filled.
20855
20930
  *
@@ -22692,6 +22767,7 @@ interface LuaSurface {
22692
22767
  readonly to_be_upgraded?: boolean
22693
22768
  readonly limit?: uint
22694
22769
  readonly is_military_target?: boolean
22770
+ readonly has_item_inside?: LuaItemPrototype
22695
22771
  /**
22696
22772
  * Whether the filters should be inverted.
22697
22773
  */
@@ -3093,14 +3093,15 @@ type SimpleItemStack = string | ItemStackDefinition
3093
3093
  type FluidIdentification = string | LuaFluidPrototype | Fluid
3094
3094
 
3095
3095
  /**
3096
- * A force may be specified in one of two ways.
3096
+ * A force may be specified in one of three ways.
3097
3097
  *
3098
3098
  * **Options:**
3099
+ * - ForceIndex: The force index.
3099
3100
  * - `string`: The force name.
3100
3101
  * - {@link LuaForce}: A reference to {@link LuaForce} may be passed directly.
3101
3102
  * @see {@link https://lua-api.factorio.com/latest/Concepts.html#ForceIdentification Online documentation}
3102
3103
  */
3103
- type ForceIdentification = string | LuaForce
3104
+ type ForceIdentification = ForceIndex | string | LuaForce
3104
3105
 
3105
3106
  /**
3106
3107
  * A technology may be specified in one of three ways.
@@ -4260,7 +4261,7 @@ interface ModSetting {
4260
4261
  /**
4261
4262
  * The value of the mod setting. The type depends on the kind of setting.
4262
4263
  */
4263
- readonly value: int | double | boolean | string
4264
+ readonly value: int | double | boolean | string | Color
4264
4265
  }
4265
4266
 
4266
4267
  /**
@@ -5194,7 +5195,7 @@ type ModSettingPrototypeFilter =
5194
5195
  */
5195
5196
  interface BaseTechnologyPrototypeFilter {
5196
5197
  /**
5197
- * The condition to filter on. One of `"enabled"`, `"hidden"`, `"upgrade"`, `"visible-when-disabled"`, `"has-effects"`, `"has-prerequisites"`, `"research-unit-ingredient"`, `"level"`, `"max-level"`, `"time"`.
5198
+ * The condition to filter on. One of `"enabled"`, `"hidden"`, `"upgrade"`, `"visible-when-disabled"`, `"has-effects"`, `"has-prerequisites"`, `"research-unit-ingredient"`, `"unlocks-recipe"`, `"level"`, `"max-level"`, `"time"`.
5198
5199
  */
5199
5200
  readonly filter:
5200
5201
  | "enabled"
@@ -5204,6 +5205,7 @@ interface BaseTechnologyPrototypeFilter {
5204
5205
  | "has-effects"
5205
5206
  | "has-prerequisites"
5206
5207
  | "research-unit-ingredient"
5208
+ | "unlocks-recipe"
5207
5209
  | "level"
5208
5210
  | "max-level"
5209
5211
  | "time"
@@ -5228,6 +5230,17 @@ interface ResearchUnitIngredientTechnologyPrototypeFilter extends BaseTechnology
5228
5230
  readonly ingredient: string
5229
5231
  }
5230
5232
 
5233
+ /**
5234
+ * `"unlocks-recipe"` variant of {@link TechnologyPrototypeFilter}.
5235
+ */
5236
+ interface UnlocksRecipeTechnologyPrototypeFilter extends BaseTechnologyPrototypeFilter {
5237
+ readonly filter: "unlocks-recipe"
5238
+ /**
5239
+ * The recipe to check.
5240
+ */
5241
+ readonly recipe: string
5242
+ }
5243
+
5231
5244
  /**
5232
5245
  * `"level"` variant of {@link TechnologyPrototypeFilter}.
5233
5246
  */
@@ -5305,6 +5318,7 @@ interface OtherTechnologyPrototypeFilter extends BaseTechnologyPrototypeFilter {
5305
5318
  *
5306
5319
  * Other attributes may be specified depending on `filter`:
5307
5320
  * - `"research-unit-ingredient"`: {@link ResearchUnitIngredientTechnologyPrototypeFilter}
5321
+ * - `"unlocks-recipe"`: {@link UnlocksRecipeTechnologyPrototypeFilter}
5308
5322
  * - `"level"`: {@link LevelTechnologyPrototypeFilter}
5309
5323
  * - `"max-level"`: {@link MaxLevelTechnologyPrototypeFilter}
5310
5324
  * - `"time"`: {@link TimeTechnologyPrototypeFilter}
@@ -5312,6 +5326,7 @@ interface OtherTechnologyPrototypeFilter extends BaseTechnologyPrototypeFilter {
5312
5326
  */
5313
5327
  type TechnologyPrototypeFilter =
5314
5328
  | ResearchUnitIngredientTechnologyPrototypeFilter
5329
+ | UnlocksRecipeTechnologyPrototypeFilter
5315
5330
  | LevelTechnologyPrototypeFilter
5316
5331
  | MaxLevelTechnologyPrototypeFilter
5317
5332
  | TimeTechnologyPrototypeFilter
@@ -5323,6 +5338,7 @@ type TechnologyPrototypeFilter =
5323
5338
  */
5324
5339
  type TechnologyPrototypeFilterWrite =
5325
5340
  | ResearchUnitIngredientTechnologyPrototypeFilter
5341
+ | UnlocksRecipeTechnologyPrototypeFilter
5326
5342
  | LevelTechnologyPrototypeFilterWrite
5327
5343
  | MaxLevelTechnologyPrototypeFilterWrite
5328
5344
  | TimeTechnologyPrototypeFilterWrite
@@ -7314,6 +7330,120 @@ type LuaPlayerRepairedEntityEventFilter =
7314
7330
  | GhostNamePlayerRepairedEntityEventFilter
7315
7331
  | OtherPlayerRepairedEntityEventFilter
7316
7332
 
7333
+ /**
7334
+ * Common attributes to all variants of {@link LuaScriptRaisedTeleportedEventFilter}.
7335
+ */
7336
+ interface BaseScriptRaisedTeleportedEventFilter {
7337
+ /**
7338
+ * The condition to filter on. One of `"ghost"`, `"rail"`, `"rail-signal"`, `"rolling-stock"`, `"robot-with-logistics-interface"`, `"vehicle"`, `"turret"`, `"crafting-machine"`, `"wall-connectable"`, `"transport-belt-connectable"`, `"circuit-network-connectable"`, `"type"`, `"name"`, `"ghost_type"`, `"ghost_name"`.
7339
+ */
7340
+ readonly filter:
7341
+ | "ghost"
7342
+ | "rail"
7343
+ | "rail-signal"
7344
+ | "rolling-stock"
7345
+ | "robot-with-logistics-interface"
7346
+ | "vehicle"
7347
+ | "turret"
7348
+ | "crafting-machine"
7349
+ | "wall-connectable"
7350
+ | "transport-belt-connectable"
7351
+ | "circuit-network-connectable"
7352
+ | "type"
7353
+ | "name"
7354
+ | "ghost_type"
7355
+ | "ghost_name"
7356
+ /**
7357
+ * How to combine this with the previous filter. Must be `"or"` or `"and"`. Defaults to `"or"`. When evaluating the filters, `"and"` has higher precedence than `"or"`.
7358
+ */
7359
+ readonly mode?: "or" | "and"
7360
+ /**
7361
+ * Inverts the condition. Default is `false`.
7362
+ */
7363
+ readonly invert?: boolean
7364
+ }
7365
+
7366
+ /**
7367
+ * `"type"` variant of {@link LuaScriptRaisedTeleportedEventFilter}.
7368
+ */
7369
+ interface TypeScriptRaisedTeleportedEventFilter extends BaseScriptRaisedTeleportedEventFilter {
7370
+ readonly filter: "type"
7371
+ /**
7372
+ * The prototype type
7373
+ */
7374
+ readonly type: string
7375
+ }
7376
+
7377
+ /**
7378
+ * `"name"` variant of {@link LuaScriptRaisedTeleportedEventFilter}.
7379
+ */
7380
+ interface NameScriptRaisedTeleportedEventFilter extends BaseScriptRaisedTeleportedEventFilter {
7381
+ readonly filter: "name"
7382
+ /**
7383
+ * The prototype name
7384
+ */
7385
+ readonly name: string
7386
+ }
7387
+
7388
+ /**
7389
+ * `"ghost_type"` variant of {@link LuaScriptRaisedTeleportedEventFilter}.
7390
+ */
7391
+ interface GhostTypeScriptRaisedTeleportedEventFilter extends BaseScriptRaisedTeleportedEventFilter {
7392
+ readonly filter: "ghost_type"
7393
+ /**
7394
+ * The ghost prototype type
7395
+ */
7396
+ readonly type: string
7397
+ }
7398
+
7399
+ /**
7400
+ * `"ghost_name"` variant of {@link LuaScriptRaisedTeleportedEventFilter}.
7401
+ */
7402
+ interface GhostNameScriptRaisedTeleportedEventFilter extends BaseScriptRaisedTeleportedEventFilter {
7403
+ readonly filter: "ghost_name"
7404
+ /**
7405
+ * The ghost prototype name
7406
+ */
7407
+ readonly name: string
7408
+ }
7409
+
7410
+ /**
7411
+ * Variants of {@link LuaScriptRaisedTeleportedEventFilter} with no additional attributes.
7412
+ */
7413
+ interface OtherScriptRaisedTeleportedEventFilter extends BaseScriptRaisedTeleportedEventFilter {
7414
+ readonly filter:
7415
+ | "ghost"
7416
+ | "rail"
7417
+ | "rail-signal"
7418
+ | "rolling-stock"
7419
+ | "robot-with-logistics-interface"
7420
+ | "vehicle"
7421
+ | "turret"
7422
+ | "crafting-machine"
7423
+ | "wall-connectable"
7424
+ | "transport-belt-connectable"
7425
+ | "circuit-network-connectable"
7426
+ }
7427
+
7428
+ /**
7429
+ * Depending on the value of `filter`, the table may take additional fields. `filter` may be one of the following:
7430
+ *
7431
+ * Base attributes: {@link BaseScriptRaisedTeleportedEventFilter}
7432
+ *
7433
+ * Other attributes may be specified depending on `filter`:
7434
+ * - `"type"`: {@link TypeScriptRaisedTeleportedEventFilter}
7435
+ * - `"name"`: {@link NameScriptRaisedTeleportedEventFilter}
7436
+ * - `"ghost_type"`: {@link GhostTypeScriptRaisedTeleportedEventFilter}
7437
+ * - `"ghost_name"`: {@link GhostNameScriptRaisedTeleportedEventFilter}
7438
+ * @see {@link https://lua-api.factorio.com/latest/Concepts.html#LuaScriptRaisedTeleportedEventFilter Online documentation}
7439
+ */
7440
+ type LuaScriptRaisedTeleportedEventFilter =
7441
+ | TypeScriptRaisedTeleportedEventFilter
7442
+ | NameScriptRaisedTeleportedEventFilter
7443
+ | GhostTypeScriptRaisedTeleportedEventFilter
7444
+ | GhostNameScriptRaisedTeleportedEventFilter
7445
+ | OtherScriptRaisedTeleportedEventFilter
7446
+
7317
7447
  /**
7318
7448
  * Common attributes to all variants of {@link LuaEntityMarkedForUpgradeEventFilter}.
7319
7449
  */
@@ -939,6 +939,12 @@ declare namespace defines {
939
939
  * Event filter: {@link LuaScriptRaisedReviveEventFilter}
940
940
  */
941
941
  const script_raised_revive: EventId<ScriptRaisedReviveEvent, LuaScriptRaisedReviveEventFilter>
942
+ /**
943
+ * Event type: {@link ScriptRaisedTeleportedEvent}
944
+ *
945
+ * Event filter: {@link LuaScriptRaisedTeleportedEventFilter}
946
+ */
947
+ const script_raised_teleported: EventId<ScriptRaisedTeleportedEvent, LuaScriptRaisedTeleportedEventFilter>
942
948
  /**
943
949
  * Event type: {@link ScriptRaisedSetTilesEvent}
944
950
  */
@@ -3802,7 +3802,7 @@ interface OnSpiderCommandCompletedEvent extends EventData {
3802
3802
  }
3803
3803
 
3804
3804
  /**
3805
- * Called when a translation request generated through {@link LuaPlayer#request_translation LuaPlayer::request_translation} is translated.
3805
+ * Called when a translation request generated through {@link LuaPlayer#request_translation LuaPlayer::request_translation} or {@link LuaPlayer#request_translations LuaPlayer::request_translations} has been completed.
3806
3806
  * @see {@link https://lua-api.factorio.com/latest/events.html#on_string_translated Online documentation}
3807
3807
  */
3808
3808
  interface OnStringTranslatedEvent extends EventData {
@@ -4215,6 +4215,33 @@ interface ScriptRaisedSetTilesEvent extends EventData {
4215
4215
  readonly tick: uint
4216
4216
  }
4217
4217
 
4218
+ /**
4219
+ * A static event mods can use to tell other mods they teleported something by script. This event is only raised if a mod does so with {@link LuaBootstrap#raise_event LuaBootstrap::raise_event} or {@link LuaBootstrap#raise_script_teleported LuaBootstrap::raise_script_teleported}, or when `raise_teleported` is passed to {@link LuaControl#teleport LuaControl::teleport}. Can be filtered using {@link LuaScriptRaisedTeleportedEventFilter}.
4220
+ * @see {@link https://lua-api.factorio.com/latest/events.html#script_raised_teleported Online documentation}
4221
+ */
4222
+ interface ScriptRaisedTeleportedEvent extends EventData {
4223
+ /**
4224
+ * The entity that was teleported.
4225
+ */
4226
+ readonly entity: LuaEntity
4227
+ /**
4228
+ * The entity's surface before the teleportation.
4229
+ */
4230
+ readonly old_surface_index: uint8
4231
+ /**
4232
+ * The entity's position before the teleportation.
4233
+ */
4234
+ readonly old_position: MapPosition
4235
+ /**
4236
+ * Identifier of the event
4237
+ */
4238
+ readonly name: typeof defines.events.script_raised_teleported
4239
+ /**
4240
+ * Tick the event was generated.
4241
+ */
4242
+ readonly tick: uint
4243
+ }
4244
+
4218
4245
  /** An event id. */
4219
4246
  type EventId<T extends table, F = unknown> = uint & {
4220
4247
  readonly _eventData: T
@@ -16,6 +16,13 @@ type PlayerIndex = uint & IndexBrand<"_playerIndexBrand">
16
16
  */
17
17
  type SurfaceIndex = uint & IndexBrand<"_surfaceIndexBrand">
18
18
 
19
+ /**
20
+ * See {@link LuaForce#index LuaForce.index}.
21
+ *
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 ForceIndex`.
23
+ */
24
+ type ForceIndex = uint & IndexBrand<"_forceIndexBrand">
25
+
19
26
  /**
20
27
  * See {@link LuaEntity#unit_number LuaEntity.unit_number}.
21
28
  *