typed-factorio 1.12.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.12.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",
@@ -29,33 +29,34 @@
29
29
  "next-factorio-version": "yarn run download-latest-runtime-api && yarn run clean && yarn run check && yarn run new-version-changelog && npm version minor"
30
30
  },
31
31
  "peerDependencies": {
32
- "lua-types": "^2.13.0",
32
+ "lua-types": "^2.13.1",
33
33
  "typescript-to-lua": "^1.6.1"
34
34
  },
35
35
  "devDependencies": {
36
- "@types/jest": "^29.2.2",
37
- "@types/node": "^18.11.9",
38
- "@types/prettier": "^2.7.1",
39
- "@typescript-eslint/eslint-plugin": "^5.42.0",
40
- "@typescript-eslint/parser": "^5.42.0",
41
- "chalk": "^5.1.2",
42
- "eslint": "~8.26.0",
43
- "eslint-config-prettier": "^8.5.0",
36
+ "@types/jest": "^29.4.0",
37
+ "@types/node": "^18.14.6",
38
+ "@types/prettier": "^2.7.2",
39
+ "@typescript-eslint/eslint-plugin": "^5.54.0",
40
+ "@typescript-eslint/parser": "^5.54.0",
41
+ "array.prototype.flatmap": "^1.3.1",
42
+ "chalk": "^5.2.0",
43
+ "eslint": "~8.35.0",
44
+ "eslint-config-prettier": "^8.6.0",
44
45
  "eslint-config-standard": "^17.0.0",
45
- "eslint-import-resolver-typescript": "^3.5.2",
46
- "eslint-plugin-import": "^2.26.0",
47
- "eslint-plugin-n": "^15.4.0",
46
+ "eslint-import-resolver-typescript": "^3.5.3",
47
+ "eslint-plugin-import": "^2.27.5",
48
+ "eslint-plugin-n": "^15.6.1",
48
49
  "eslint-plugin-node": "^11.1.0",
49
50
  "eslint-plugin-prettier": "^4.2.1",
50
51
  "eslint-plugin-promise": "^6.1.1",
51
- "jest": "^29.2.2",
52
- "lua-types": "^2.13.0",
53
- "prettier": "^2.7.1",
52
+ "jest": "^29.4.3",
53
+ "lua-types": "^2.13.1",
54
+ "prettier": "^2.8.4",
54
55
  "rimraf": "^3.0.2",
55
- "ts-jest": "^29.0.3",
56
+ "ts-jest": "^29.0.5",
56
57
  "ts-node": "^10.9.1",
57
- "typescript": "~4.8.4",
58
- "typescript-to-lua": "^1.10.1"
58
+ "typescript": "~4.9.5",
59
+ "typescript-to-lua": "^1.13.2"
59
60
  },
60
61
  "packageManager": "yarn@3.2.3"
61
62
  }
@@ -239,7 +239,7 @@ interface LuaBootstrap {
239
239
  */
240
240
  register_metatable(name: string, metatable: table): void
241
241
  /**
242
- * Register a function to be run when mod configuration changes. This is called when the major game version or any mod version changed, when any mod was added or removed, when a startup setting has changed, or when any prototypes have been added or removed. It allows the mod to make any changes it deems appropriate to both the data structures in its {@linkplain https://lua-api.factorio.com/latest/Global.html global} table or to the game state through {@link LuaGameScript}.
242
+ * Register a function to be run when mod configuration changes. This is called when the game version or any mod version changed, when any mod was added or removed, when a startup setting has changed, when any prototypes have been added or removed, or when a migration was applied. It allows the mod to make any changes it deems appropriate to both the data structures in its {@linkplain https://lua-api.factorio.com/latest/Global.html global} table or to the game state through {@link LuaGameScript}.
243
243
  * @param handler The handler for this event. Passing `nil` will unregister it.
244
244
  * @remarks For more context, refer to the {@linkplain https://lua-api.factorio.com/latest/Data-Lifecycle.html Data Lifecycle} page.
245
245
  * @see {@link https://lua-api.factorio.com/latest/LuaBootstrap.html#LuaBootstrap.on_configuration_changed Online documentation}
@@ -335,6 +335,11 @@ interface LuaBootstrap {
335
335
  * @see {@link https://lua-api.factorio.com/latest/LuaBootstrap.html#LuaBootstrap.get_event_filter Online documentation}
336
336
  */
337
337
  get_event_filter<E extends EventId<any, table>>(event: E): E["_filter"][] | nil
338
+ /**
339
+ * Gets the prototype history for the given type and name.
340
+ * @see {@link https://lua-api.factorio.com/latest/LuaBootstrap.html#LuaBootstrap.get_prototype_history Online documentation}
341
+ */
342
+ get_prototype_history(type: string, name: string): PrototypeHistory
338
343
  /**
339
344
  * Raise an event. Only events generated with {@link LuaBootstrap#generate_event_name LuaBootstrap::generate_event_name} and the following can be raised:
340
345
  *
@@ -413,6 +418,10 @@ interface LuaBootstrap {
413
418
  * Whether the transfer was from player to entity. If `false`, the transfer was from entity to player.
414
419
  */
415
420
  readonly from_player: boolean
421
+ /**
422
+ * Whether the transfer was a split action (half stack).
423
+ */
424
+ readonly is_split: boolean
416
425
  }): void
417
426
  /**
418
427
  * **Raised events:**
@@ -485,6 +494,25 @@ interface LuaBootstrap {
485
494
  */
486
495
  readonly tags?: Tags
487
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
488
516
  /**
489
517
  * **Raised events:**
490
518
  * - {@link ScriptRaisedSetTilesEvent script_raised_set_tiles} _instantly_ Raised with the provided arguments.
@@ -776,7 +804,7 @@ interface LuaCombinatorControlBehavior extends LuaControlBehavior {
776
804
  }
777
805
 
778
806
  /**
779
- * 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.
780
808
  * @see {@link https://lua-api.factorio.com/latest/LuaCommandProcessor.html Online documentation}
781
809
  * @noSelf
782
810
  */
@@ -970,6 +998,11 @@ interface LuaControl {
970
998
  * @see {@link https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.get_inventory Online documentation}
971
999
  */
972
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
973
1006
  /**
974
1007
  * Gets the main inventory for this character or player if this is a character or player.
975
1008
  * @returns The inventory or `nil` if this entity is not a character or player.
@@ -1039,10 +1072,12 @@ interface LuaControl {
1039
1072
  *
1040
1073
  * **Raised events:**
1041
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.
1042
1076
  * @param position Where to teleport to.
1043
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.
1044
1079
  * @returns `true` if the entity was successfully teleported.
1045
- * @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.
1046
1081
  * @see {@link https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.teleport Online documentation}
1047
1082
  */
1048
1083
  teleport(position: MapPosition | MapPositionArray, surface?: SurfaceIdentification): boolean
@@ -1238,6 +1273,11 @@ interface LuaControl {
1238
1273
  * @see {@link https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.surface Online documentation}
1239
1274
  */
1240
1275
  readonly surface: LuaSurface
1276
+ /**
1277
+ * Unique ID associated with the surface this entity is currently on.
1278
+ * @see {@link https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.surface_index Online documentation}
1279
+ */
1280
+ readonly surface_index: SurfaceIndex
1241
1281
  /**
1242
1282
  * The current position of the entity.
1243
1283
  * @see {@link https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.position Online documentation}
@@ -1254,6 +1294,11 @@ interface LuaControl {
1254
1294
  */
1255
1295
  get force(): LuaForce
1256
1296
  set force(value: ForceIdentification)
1297
+ /**
1298
+ * Unique ID associated with the force of this entity.
1299
+ * @see {@link https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.force_index Online documentation}
1300
+ */
1301
+ readonly force_index: ForceIndex
1257
1302
  /**
1258
1303
  * The currently selected entity. Assigning an entity will select it if is selectable, otherwise the selection is cleared.
1259
1304
  *
@@ -2146,7 +2191,7 @@ interface LuaEntity extends LuaControl {
2146
2191
  * Sets the entity to be deconstructed by construction robots.
2147
2192
  *
2148
2193
  * **Raised events:**
2149
- * - {@link OnMarkedForDeconstructionEvent on_marked_for_deconstruction}? _instantly_ Raised if the entity way successfully marked for deconstruction.
2194
+ * - {@link OnMarkedForDeconstructionEvent on_marked_for_deconstruction}? _instantly_ Raised if the entity was successfully marked for deconstruction.
2150
2195
  * @param force The force whose robots are supposed to do the deconstruction.
2151
2196
  * @param player The player to set the `last_user` to if any.
2152
2197
  * @returns if the entity was marked for deconstruction.
@@ -2172,7 +2217,7 @@ interface LuaEntity extends LuaControl {
2172
2217
  * Sets the entity to be upgraded by construction robots.
2173
2218
  *
2174
2219
  * **Raised events:**
2175
- * - {@link OnMarkedForUpgradeEvent on_marked_for_upgrade}? _instantly_ Raised if the entity way successfully marked for upgrade.
2220
+ * - {@link OnMarkedForUpgradeEvent on_marked_for_upgrade}? _instantly_ Raised if the entity was successfully marked for upgrade.
2176
2221
  * @returns Whether the entity was marked for upgrade.
2177
2222
  * @see {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.order_upgrade Online documentation}
2178
2223
  */
@@ -3645,6 +3690,12 @@ interface LuaEntity extends LuaControl {
3645
3690
  * @see {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.electric_network_statistics Online documentation}
3646
3691
  */
3647
3692
  readonly electric_network_statistics: LuaFlowStatistics
3693
+ /**
3694
+ * Returns the current target pickup count of the inserter.
3695
+ * @remarks This considers the circuit network, manual override and the inserter stack size limit based on technology.
3696
+ * @see {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.inserter_target_pickup_count Online documentation}
3697
+ */
3698
+ readonly inserter_target_pickup_count: uint
3648
3699
  /**
3649
3700
  * Sets the stack size limit on this inserter. If the stack size is > than the force stack size limit the value is ignored.
3650
3701
  * @remarks Set to 0 to reset.
@@ -4184,7 +4235,7 @@ interface BaseEntity extends LuaControl {
4184
4235
  * Sets the entity to be deconstructed by construction robots.
4185
4236
  *
4186
4237
  * **Raised events:**
4187
- * - {@link OnMarkedForDeconstructionEvent on_marked_for_deconstruction}? _instantly_ Raised if the entity way successfully marked for deconstruction.
4238
+ * - {@link OnMarkedForDeconstructionEvent on_marked_for_deconstruction}? _instantly_ Raised if the entity was successfully marked for deconstruction.
4188
4239
  * @param force The force whose robots are supposed to do the deconstruction.
4189
4240
  * @param player The player to set the `last_user` to if any.
4190
4241
  * @returns if the entity was marked for deconstruction.
@@ -4210,7 +4261,7 @@ interface BaseEntity extends LuaControl {
4210
4261
  * Sets the entity to be upgraded by construction robots.
4211
4262
  *
4212
4263
  * **Raised events:**
4213
- * - {@link OnMarkedForUpgradeEvent on_marked_for_upgrade}? _instantly_ Raised if the entity way successfully marked for upgrade.
4264
+ * - {@link OnMarkedForUpgradeEvent on_marked_for_upgrade}? _instantly_ Raised if the entity was successfully marked for upgrade.
4214
4265
  * @returns Whether the entity was marked for upgrade.
4215
4266
  * @see {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.order_upgrade Online documentation}
4216
4267
  */
@@ -4979,6 +5030,12 @@ interface BaseEntity extends LuaControl {
4979
5030
  * @see {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.sticked_to Online documentation}
4980
5031
  */
4981
5032
  readonly sticked_to: LuaEntity
5033
+ /**
5034
+ * Returns the current target pickup count of the inserter.
5035
+ * @remarks This considers the circuit network, manual override and the inserter stack size limit based on technology.
5036
+ * @see {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.inserter_target_pickup_count Online documentation}
5037
+ */
5038
+ readonly inserter_target_pickup_count: uint
4982
5039
  /**
4983
5040
  * Sets the stack size limit on this inserter. If the stack size is > than the force stack size limit the value is ignored.
4984
5041
  * @remarks Set to 0 to reset.
@@ -7159,7 +7216,7 @@ interface LuaEntityPrototype {
7159
7216
  readonly fluid?: LuaFluidPrototype
7160
7217
  /**
7161
7218
  * The fluid capacity of this entity or 0 if this entity doesn't support fluids.
7162
- * @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.
7163
7220
  * @see {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.fluid_capacity Online documentation}
7164
7221
  */
7165
7222
  readonly fluid_capacity: double
@@ -7686,6 +7743,11 @@ interface LuaEntityPrototype {
7686
7743
  * @see {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.alert_icon_shift Online documentation}
7687
7744
  */
7688
7745
  readonly alert_icon_shift: Vector
7746
+ /**
7747
+ * The alert icon scale of this entity prototype.
7748
+ * @see {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.alert_icon_scale Online documentation}
7749
+ */
7750
+ readonly alert_icon_scale: float
7689
7751
  /**
7690
7752
  * The item prototype names that are the inputs of this lab prototype.
7691
7753
  *
@@ -8355,7 +8417,7 @@ interface BaseEntityPrototype {
8355
8417
  readonly building_grid_bit_shift: uint
8356
8418
  /**
8357
8419
  * The fluid capacity of this entity or 0 if this entity doesn't support fluids.
8358
- * @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.
8359
8421
  * @see {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.fluid_capacity Online documentation}
8360
8422
  */
8361
8423
  readonly fluid_capacity: double
@@ -8458,6 +8520,11 @@ interface BaseEntityPrototype {
8458
8520
  * @see {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.alert_icon_shift Online documentation}
8459
8521
  */
8460
8522
  readonly alert_icon_shift: Vector
8523
+ /**
8524
+ * The alert icon scale of this entity prototype.
8525
+ * @see {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.alert_icon_scale Online documentation}
8526
+ */
8527
+ readonly alert_icon_scale: float
8461
8528
  /**
8462
8529
  * Whether this entity prototype could possibly ever be rotated.
8463
8530
  * @see {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.supports_direction Online documentation}
@@ -10651,10 +10718,10 @@ interface LuaFlowStatistics {
10651
10718
  */
10652
10719
  interface LuaFluidBox extends Array<Fluid | nil> {
10653
10720
  /**
10654
- * 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
10655
10722
  * @see {@link https://lua-api.factorio.com/latest/LuaFluidBox.html#LuaFluidBox.get_prototype Online documentation}
10656
10723
  */
10657
- get_prototype(index: uint): LuaFluidBoxPrototype
10724
+ get_prototype(index: uint): LuaFluidBoxPrototype | LuaFluidBoxPrototype[]
10658
10725
  /**
10659
10726
  * The capacity of the given fluidbox index.
10660
10727
  * @see {@link https://lua-api.factorio.com/latest/LuaFluidBox.html#LuaFluidBox.get_capacity Online documentation}
@@ -11547,7 +11614,7 @@ interface LuaForce {
11547
11614
  * Unique ID associated with this force.
11548
11615
  * @see {@link https://lua-api.factorio.com/latest/LuaForce.html#LuaForce.index Online documentation}
11549
11616
  */
11550
- readonly index: uint
11617
+ readonly index: ForceIndex
11551
11618
  /**
11552
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}.
11553
11620
  *
@@ -12458,6 +12525,11 @@ interface LuaGameScript {
12458
12525
  * @see {@link https://lua-api.factorio.com/latest/LuaGameScript.html#LuaGameScript.map_gen_presets Online documentation}
12459
12526
  */
12460
12527
  readonly map_gen_presets: LuaCustomTable<string, MapGenPreset>
12528
+ /**
12529
+ * Whether a console command has been used.
12530
+ * @see {@link https://lua-api.factorio.com/latest/LuaGameScript.html#LuaGameScript.console_command_used Online documentation}
12531
+ */
12532
+ readonly console_command_used: boolean
12461
12533
  /**
12462
12534
  * The styles that {@link LuaGuiElement} can use, indexed by `name`.
12463
12535
  * @see {@link https://lua-api.factorio.com/latest/LuaGameScript.html#LuaGameScript.styles Online documentation}
@@ -16896,6 +16968,21 @@ interface LuaItemStack {
16896
16968
  * @see {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.connected_entity Online documentation}
16897
16969
  */
16898
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)
16899
16986
  /**
16900
16987
  * If this is a blueprint item.
16901
16988
  * @see {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.is_blueprint Online documentation}
@@ -17674,6 +17761,21 @@ interface ItemWithEntityDataItemStack extends BaseItemStack {
17674
17761
  * @see {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.create_grid Online documentation}
17675
17762
  */
17676
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)
17677
17779
  }
17678
17780
 
17679
17781
  interface ItemWithLabelItemStack extends BaseItemStack {
@@ -18835,10 +18937,6 @@ interface LuaPlayer extends LuaControl {
18835
18937
  }): boolean
18836
18938
  /**
18837
18939
  * Checks if this player can build what ever is in the cursor on the surface the player is on.
18838
- *
18839
- * **Raised events:**
18840
- * - {@link OnPreBuildEvent on_pre_build}? _instantly_ Raised if the cursor was successfully built.
18841
- * - {@link OnBuiltEntityEvent on_built_entity}? _instantly_ Raised if the cursor was successfully built.
18842
18940
  * @see {@link https://lua-api.factorio.com/latest/LuaPlayer.html#LuaPlayer.can_build_from_cursor Online documentation}
18843
18941
  */
18844
18942
  can_build_from_cursor(params: {
@@ -18864,8 +18962,11 @@ interface LuaPlayer extends LuaControl {
18864
18962
  readonly skip_fog_of_war?: boolean
18865
18963
  }): boolean
18866
18964
  /**
18867
- * Builds what ever is in the cursor on the surface the player is on.
18868
- * @remarks Anything built will fire normal player-built events.<br>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.
18966
+ *
18967
+ * **Raised events:**
18968
+ * - {@link OnPreBuildEvent on_pre_build}? _instantly_ Raised if the cursor was successfully built.
18969
+ * - {@link OnBuiltEntityEvent on_built_entity}? _instantly_ Raised if the cursor was successfully built.
18869
18970
  * @see {@link https://lua-api.factorio.com/latest/LuaPlayer.html#LuaPlayer.build_from_cursor Online documentation}
18870
18971
  */
18871
18972
  build_from_cursor(params: {
@@ -19006,15 +19107,17 @@ interface LuaPlayer extends LuaControl {
19006
19107
  */
19007
19108
  exit_cutscene(): void
19008
19109
  /**
19009
- * Queues a request to open the map at the specified position. If the map is already opened, the request will simply set the position (and scale). Render mode change requests are processed before rendering of the next frame.
19110
+ * Queues a request to open the map at the specified position. If the map is already opened, the request will simply set the position, scale, and entity to follow. Render mode change requests are processed before rendering of the next frame.
19111
+ * @param entity The entity to follow. If not given the current entity being followed will be cleared.
19010
19112
  * @see {@link https://lua-api.factorio.com/latest/LuaPlayer.html#LuaPlayer.open_map Online documentation}
19011
19113
  */
19012
- open_map(position: MapPosition | MapPositionArray, scale?: double): void
19114
+ open_map(position: MapPosition | MapPositionArray, scale?: double, entity?: LuaEntity): void
19013
19115
  /**
19014
- * Queues a request to zoom to world at the specified position. If the player is already zooming to world, the request will simply set the position (and scale). Render mode change requests are processed before rendering of the next frame.
19116
+ * Queues a request to zoom to world at the specified position. If the player is already zooming to world, the request will simply set the position, scale, and entity to follow. Render mode change requests are processed before rendering of the next frame.
19117
+ * @param entity The entity to follow. If not given the current entity being followed will be cleared.
19015
19118
  * @see {@link https://lua-api.factorio.com/latest/LuaPlayer.html#LuaPlayer.zoom_to_world Online documentation}
19016
19119
  */
19017
- zoom_to_world(position: MapPosition | MapPositionArray, scale?: double): void
19120
+ zoom_to_world(position: MapPosition | MapPositionArray, scale?: double, entity?: LuaEntity): void
19018
19121
  /**
19019
19122
  * Queues request to switch to the normal game view from the map or zoom to world view. Render mode change requests are processed before rendering of the next frame.
19020
19123
  * @see {@link https://lua-api.factorio.com/latest/LuaPlayer.html#LuaPlayer.close_map Online documentation}
@@ -19074,22 +19177,22 @@ interface LuaPlayer extends LuaControl {
19074
19177
  */
19075
19178
  toggle_map_editor(): void
19076
19179
  /**
19077
- * 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.
19078
19181
  *
19079
19182
  * **Raised events:**
19080
19183
  * - {@link OnStringTranslatedEvent on_string_translated}? _future_tick_ Raised if the request was successfully sent.
19081
- * @returns The unique id for the requested translation.
19082
- * @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}).
19083
19186
  * @see {@link https://lua-api.factorio.com/latest/LuaPlayer.html#LuaPlayer.request_translation Online documentation}
19084
19187
  */
19085
19188
  request_translation(localised_string: LocalisedString): uint | nil
19086
19189
  /**
19087
- * 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.
19088
19191
  *
19089
19192
  * **Raised events:**
19090
19193
  * - {@link OnStringTranslatedEvent on_string_translated}? _future_tick_ Raised if the request was successfully sent.
19091
- * @returns The unique id for the requested translation.
19092
- * @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}).
19093
19196
  * @see {@link https://lua-api.factorio.com/latest/LuaPlayer.html#LuaPlayer.request_translations Online documentation}
19094
19197
  */
19095
19198
  request_translations(localised_strings: readonly LocalisedString[]): uint[] | nil
@@ -19307,6 +19410,11 @@ interface LuaPlayer extends LuaControl {
19307
19410
  * @see {@link https://lua-api.factorio.com/latest/LuaPlayer.html#LuaPlayer.cursor_stack_temporary Online documentation}
19308
19411
  */
19309
19412
  cursor_stack_temporary: boolean
19413
+ /**
19414
+ * The wire drag target for this player, if any.
19415
+ * @see {@link https://lua-api.factorio.com/latest/LuaPlayer.html#LuaPlayer.drag_target Online documentation}
19416
+ */
19417
+ readonly drag_target?: DragTarget
19310
19418
  /**
19311
19419
  * The player's zoom-level.
19312
19420
  * @see {@link https://lua-api.factorio.com/latest/LuaPlayer.html#LuaPlayer.zoom Online documentation}
@@ -19405,7 +19513,7 @@ interface LuaProgrammableSpeakerControlBehavior extends LuaControlBehavior {
19405
19513
  }
19406
19514
 
19407
19515
  /**
19408
- * 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`.
19409
19517
  * @see {@link https://lua-api.factorio.com/latest/LuaRCON.html Online documentation}
19410
19518
  * @noSelf
19411
19519
  */
@@ -19476,6 +19584,11 @@ interface LuaRailPath {
19476
19584
  * @see {@link https://lua-api.factorio.com/latest/LuaRailPath.html#LuaRailPath.rails Online documentation}
19477
19585
  */
19478
19586
  readonly rails: LuaCustomTable<uint, LuaEntity>
19587
+ /**
19588
+ * If the path goes from the front of the train
19589
+ * @see {@link https://lua-api.factorio.com/latest/LuaRailPath.html#LuaRailPath.is_front Online documentation}
19590
+ */
19591
+ readonly is_front: boolean
19479
19592
  /**
19480
19593
  * 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.
19481
19594
  */
@@ -19909,7 +20022,7 @@ interface LuaRemote {
19909
20022
  }
19910
20023
 
19911
20024
  /**
19912
- * 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.
19913
20026
  * @remarks If an entity target of an object is destroyed or changes surface, then the object is also destroyed.
19914
20027
  * @see {@link https://lua-api.factorio.com/latest/LuaRendering.html Online documentation}
19915
20028
  * @noSelf
@@ -20020,7 +20133,7 @@ interface LuaRendering {
20020
20133
  */
20021
20134
  readonly visible?: boolean
20022
20135
  /**
20023
- * 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.
20024
20137
  */
20025
20138
  readonly draw_on_ground?: boolean
20026
20139
  /**
@@ -20043,6 +20156,10 @@ interface LuaRendering {
20043
20156
  * If this should only be rendered in alt mode. Defaults to false.
20044
20157
  */
20045
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
20046
20163
  }): uint64
20047
20164
  /**
20048
20165
  * Create a circle.
@@ -20793,6 +20910,21 @@ interface LuaRendering {
20793
20910
  * @see {@link https://lua-api.factorio.com/latest/LuaRendering.html#LuaRendering.set_scale_with_zoom Online documentation}
20794
20911
  */
20795
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
20796
20928
  /**
20797
20929
  * Get if the circle or rectangle with this id is filled.
20798
20930
  *
@@ -21269,7 +21401,7 @@ interface LuaShortcutPrototype {
21269
21401
  */
21270
21402
  readonly item_to_spawn?: LuaItemPrototype
21271
21403
  /**
21272
- * The technology to unlock when this shortcut is used, if any.
21404
+ * The technology that needs to be researched once (in any save) for this shortcut to be unlocked (in all saves).
21273
21405
  * @see {@link https://lua-api.factorio.com/latest/LuaShortcutPrototype.html#LuaShortcutPrototype.technology_to_unlock Online documentation}
21274
21406
  */
21275
21407
  readonly technology_to_unlock?: LuaTechnologyPrototype
@@ -22635,6 +22767,7 @@ interface LuaSurface {
22635
22767
  readonly to_be_upgraded?: boolean
22636
22768
  readonly limit?: uint
22637
22769
  readonly is_military_target?: boolean
22770
+ readonly has_item_inside?: LuaItemPrototype
22638
22771
  /**
22639
22772
  * Whether the filters should be inverted.
22640
22773
  */
@@ -23642,6 +23775,7 @@ interface LuaSurface {
23642
23775
  */
23643
23776
  get_total_pollution(): double
23644
23777
  /**
23778
+ * Whether the given entity prototype collides at the given position and direction.
23645
23779
  * @param prototype The entity prototype to check
23646
23780
  * @param position The position to check
23647
23781
  * @param use_map_generation_bounding_box If the map generation bounding box should be used instead of the collision bounding box
@@ -23652,13 +23786,14 @@ interface LuaSurface {
23652
23786
  position: MapPosition | MapPositionArray,
23653
23787
  use_map_generation_bounding_box: boolean,
23654
23788
  direction?: defines.direction
23655
- ): void
23789
+ ): boolean
23656
23790
  /**
23791
+ * Whether the given decorative prototype collides at the given position and direction.
23657
23792
  * @param prototype The decorative prototype to check
23658
23793
  * @param position The position to check
23659
23794
  * @see {@link https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.decorative_prototype_collides Online documentation}
23660
23795
  */
23661
- decorative_prototype_collides(prototype: string, position: MapPosition | MapPositionArray): void
23796
+ decorative_prototype_collides(prototype: string, position: MapPosition | MapPositionArray): boolean
23662
23797
  /**
23663
23798
  * @param property_names Names of properties (e.g. "elevation") to calculate
23664
23799
  * @param positions Positions for which to calculate property values
@@ -23684,6 +23819,9 @@ interface LuaSurface {
23684
23819
  build_checkerboard(area: BoundingBoxWrite | BoundingBoxArray): void
23685
23820
  /**
23686
23821
  * The name of this surface. Names are unique among surfaces.
23822
+ *
23823
+ * **Raised events:**
23824
+ * - {@link OnSurfaceRenamedEvent on_surface_renamed} _instantly_
23687
23825
  * @remarks the default surface can't be renamed.
23688
23826
  * @see {@link https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.name Online documentation}
23689
23827
  */
@@ -23776,7 +23914,7 @@ interface LuaSurface {
23776
23914
  */
23777
23915
  solar_power_multiplier: double
23778
23916
  /**
23779
- * The minimal brightness during the night. Default is `0.15`. The value has an effect on the game simalution only, it doesn't have any effect on rendering.
23917
+ * The minimal brightness during the night. Defaults to `0.15`. This has an effect on both rendering and game mechanics such as biter spawns and solar power.
23780
23918
  * @see {@link https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.min_brightness Online documentation}
23781
23919
  */
23782
23920
  min_brightness: double
@@ -242,6 +242,8 @@ interface OldTileAndPosition {
242
242
 
243
243
  /**
244
244
  * A dictionary of string to the four basic Lua types: `string`, `boolean`, `number`, `table`.
245
+ *
246
+ * Note that the API returns tags as a simple table, meaning any modifications to it will not propagate back to the game. Thus, to modify a set of tags, the whole table needs to be written back to the respective property.
245
247
  * @example
246
248
  *
247
249
  * ```
@@ -546,6 +548,17 @@ interface DecorativeResult {
546
548
  readonly amount: uint
547
549
  }
548
550
 
551
+ interface PrototypeHistory {
552
+ /**
553
+ * The mod that created this prototype.
554
+ */
555
+ readonly created: string
556
+ /**
557
+ * The mods that changed this prototype in the order they changed it.
558
+ */
559
+ readonly changed: string[]
560
+ }
561
+
549
562
  /**
550
563
  * @remarks Either `icon`, `text`, or both must be provided.
551
564
  * @see {@link https://lua-api.factorio.com/latest/Concepts.html#ChartTagSpec Online documentation}
@@ -2636,11 +2649,23 @@ interface WireConnectionDefinition {
2636
2649
  /**
2637
2650
  * Mandatory if the source entity has more than one wire connection using copper wire.
2638
2651
  */
2639
- readonly source_wire_id?: defines.circuit_connector_id
2652
+ readonly source_wire_id?: defines.wire_connection_id
2640
2653
  /**
2641
2654
  * Mandatory if the target entity has more than one wire connection using copper wire.
2642
2655
  */
2643
- readonly target_wire_id?: defines.circuit_connector_id
2656
+ readonly target_wire_id?: defines.wire_connection_id
2657
+ }
2658
+
2659
+ interface DragTarget {
2660
+ readonly target_entity: LuaEntity
2661
+ /**
2662
+ * If the wire being dragged is a circuit wire this is the connector id.
2663
+ */
2664
+ readonly target_circuit_id?: defines.circuit_connector_id
2665
+ /**
2666
+ * If the wire being dragged is copper wire this is the wire id.
2667
+ */
2668
+ readonly target_wire_id?: defines.wire_connection_id
2644
2669
  }
2645
2670
 
2646
2671
  interface InventoryFilter {
@@ -3068,14 +3093,15 @@ type SimpleItemStack = string | ItemStackDefinition
3068
3093
  type FluidIdentification = string | LuaFluidPrototype | Fluid
3069
3094
 
3070
3095
  /**
3071
- * A force may be specified in one of two ways.
3096
+ * A force may be specified in one of three ways.
3072
3097
  *
3073
3098
  * **Options:**
3099
+ * - ForceIndex: The force index.
3074
3100
  * - `string`: The force name.
3075
3101
  * - {@link LuaForce}: A reference to {@link LuaForce} may be passed directly.
3076
3102
  * @see {@link https://lua-api.factorio.com/latest/Concepts.html#ForceIdentification Online documentation}
3077
3103
  */
3078
- type ForceIdentification = string | LuaForce
3104
+ type ForceIdentification = ForceIndex | string | LuaForce
3079
3105
 
3080
3106
  /**
3081
3107
  * A technology may be specified in one of three ways.
@@ -4235,7 +4261,7 @@ interface ModSetting {
4235
4261
  /**
4236
4262
  * The value of the mod setting. The type depends on the kind of setting.
4237
4263
  */
4238
- readonly value: int | double | boolean | string
4264
+ readonly value: int | double | boolean | string | Color
4239
4265
  }
4240
4266
 
4241
4267
  /**
@@ -5169,7 +5195,7 @@ type ModSettingPrototypeFilter =
5169
5195
  */
5170
5196
  interface BaseTechnologyPrototypeFilter {
5171
5197
  /**
5172
- * 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"`.
5173
5199
  */
5174
5200
  readonly filter:
5175
5201
  | "enabled"
@@ -5179,6 +5205,7 @@ interface BaseTechnologyPrototypeFilter {
5179
5205
  | "has-effects"
5180
5206
  | "has-prerequisites"
5181
5207
  | "research-unit-ingredient"
5208
+ | "unlocks-recipe"
5182
5209
  | "level"
5183
5210
  | "max-level"
5184
5211
  | "time"
@@ -5203,6 +5230,17 @@ interface ResearchUnitIngredientTechnologyPrototypeFilter extends BaseTechnology
5203
5230
  readonly ingredient: string
5204
5231
  }
5205
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
+
5206
5244
  /**
5207
5245
  * `"level"` variant of {@link TechnologyPrototypeFilter}.
5208
5246
  */
@@ -5280,6 +5318,7 @@ interface OtherTechnologyPrototypeFilter extends BaseTechnologyPrototypeFilter {
5280
5318
  *
5281
5319
  * Other attributes may be specified depending on `filter`:
5282
5320
  * - `"research-unit-ingredient"`: {@link ResearchUnitIngredientTechnologyPrototypeFilter}
5321
+ * - `"unlocks-recipe"`: {@link UnlocksRecipeTechnologyPrototypeFilter}
5283
5322
  * - `"level"`: {@link LevelTechnologyPrototypeFilter}
5284
5323
  * - `"max-level"`: {@link MaxLevelTechnologyPrototypeFilter}
5285
5324
  * - `"time"`: {@link TimeTechnologyPrototypeFilter}
@@ -5287,6 +5326,7 @@ interface OtherTechnologyPrototypeFilter extends BaseTechnologyPrototypeFilter {
5287
5326
  */
5288
5327
  type TechnologyPrototypeFilter =
5289
5328
  | ResearchUnitIngredientTechnologyPrototypeFilter
5329
+ | UnlocksRecipeTechnologyPrototypeFilter
5290
5330
  | LevelTechnologyPrototypeFilter
5291
5331
  | MaxLevelTechnologyPrototypeFilter
5292
5332
  | TimeTechnologyPrototypeFilter
@@ -5298,6 +5338,7 @@ type TechnologyPrototypeFilter =
5298
5338
  */
5299
5339
  type TechnologyPrototypeFilterWrite =
5300
5340
  | ResearchUnitIngredientTechnologyPrototypeFilter
5341
+ | UnlocksRecipeTechnologyPrototypeFilter
5301
5342
  | LevelTechnologyPrototypeFilterWrite
5302
5343
  | MaxLevelTechnologyPrototypeFilterWrite
5303
5344
  | TimeTechnologyPrototypeFilterWrite
@@ -7289,6 +7330,120 @@ type LuaPlayerRepairedEntityEventFilter =
7289
7330
  | GhostNamePlayerRepairedEntityEventFilter
7290
7331
  | OtherPlayerRepairedEntityEventFilter
7291
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
+
7292
7447
  /**
7293
7448
  * Common attributes to all variants of {@link LuaEntityMarkedForUpgradeEventFilter}.
7294
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
  */
@@ -1332,7 +1338,7 @@ declare namespace defines {
1332
1338
  * See the {@linkplain https://lua-api.factorio.com/latest/events.html events page} for more info on what events contain and when they get raised.
1333
1339
  * @see {@link https://lua-api.factorio.com/latest/defines.html#defines.events Online documentation}
1334
1340
  */
1335
- type events = typeof events[keyof typeof events]
1341
+ type events = (typeof events)[keyof typeof events]
1336
1342
  enum flow_precision_index {
1337
1343
  five_seconds,
1338
1344
  one_minute,
@@ -2152,6 +2152,10 @@ interface OnPlayerFastTransferredEvent extends EventData {
2152
2152
  * Whether the transfer was from player to entity. If `false`, the transfer was from entity to player.
2153
2153
  */
2154
2154
  readonly from_player: boolean
2155
+ /**
2156
+ * Whether the transfer was a split action (half stack).
2157
+ */
2158
+ readonly is_split: boolean
2155
2159
  /**
2156
2160
  * Identifier of the event
2157
2161
  */
@@ -2920,15 +2924,15 @@ interface OnPreBuildEvent extends EventData {
2920
2924
  */
2921
2925
  readonly direction: defines.direction
2922
2926
  /**
2923
- * If building this blueprint was flipped horizontally.
2927
+ * Whether the blueprint was flipped horizontally. `nil` if not built by a blueprint.
2924
2928
  */
2925
- readonly flip_horizontal: boolean
2929
+ readonly flip_horizontal: boolean | nil
2926
2930
  /**
2927
- * If building this blueprint was flipped vertically.
2931
+ * Whether the blueprint was flipped vertically. `nil` if not built by a blueprint.
2928
2932
  */
2929
- readonly flip_vertical: boolean
2933
+ readonly flip_vertical: boolean | nil
2930
2934
  /**
2931
- * Item was placed while moving.
2935
+ * Whether the item was placed while moving.
2932
2936
  */
2933
2937
  readonly created_by_moving: boolean
2934
2938
  /**
@@ -3798,7 +3802,7 @@ interface OnSpiderCommandCompletedEvent extends EventData {
3798
3802
  }
3799
3803
 
3800
3804
  /**
3801
- * 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.
3802
3806
  * @see {@link https://lua-api.factorio.com/latest/events.html#on_string_translated Online documentation}
3803
3807
  */
3804
3808
  interface OnStringTranslatedEvent extends EventData {
@@ -4211,6 +4215,33 @@ interface ScriptRaisedSetTilesEvent extends EventData {
4211
4215
  readonly tick: uint
4212
4216
  }
4213
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
+
4214
4245
  /** An event id. */
4215
4246
  type EventId<T extends table, F = unknown> = uint & {
4216
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
  *