typed-factorio 1.14.0 → 1.16.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -24,7 +24,7 @@ interface LuaAISettings {
24
24
  */
25
25
  do_separation: boolean
26
26
  /**
27
- * The pathing resolution modifier, must be between -8 and 8.
27
+ * Defines how coarse the pathfinder's grid is, where smaller values mean a coarser grid. Defaults to `0`, which equals a resolution of `1x1` tiles, centered on tile centers. Values range from `-8` to `8` inclusive, where each integer increment doubles/halves the resolution. So, a resolution of `-8` equals a grid of `256x256` tiles, and a resolution of `8` equals `1/256` of a tile.
28
28
  * @see {@link https://lua-api.factorio.com/latest/LuaAISettings.html#LuaAISettings.path_resolution_modifier Online documentation}
29
29
  */
30
30
  path_resolution_modifier: int8
@@ -217,9 +217,11 @@ interface LuaBootstrap {
217
217
  */
218
218
  on_init(handler: (() => void) | nil): void
219
219
  /**
220
- * Register a function to be run on save load. This is only called for mods that have been part of the save previously, or for players connecting to a running multiplayer session. It gives the mod the opportunity to do some very specific actions, should it need to. Doing anything other than these three will lead to desyncs, which breaks multiplayer and replay functionality. Access to {@link LuaGameScript} is not available. The {@linkplain https://lua-api.factorio.com/latest/Global.html global} table can be accessed and is safe to read from, but not write to, as doing so will lead to an error.
220
+ * Register a function to be run on save load. This is only called for mods that have been part of the save previously, or for players connecting to a running multiplayer session.
221
221
  *
222
- * The only legitimate uses of this event are the following:
222
+ * It gives the mod the opportunity to rectify potential differences in local state introduced by the save/load cycle. Doing anything other than the following three will lead to desyncs, breaking multiplayer and replay functionality. Access to {@link LuaGameScript} is not available. The {@linkplain https://lua-api.factorio.com/latest/Global.html global} table can be accessed and is safe to read from, but not write to, as doing so will lead to an error.
223
+ *
224
+ * The only legitimate uses of this event are these:
223
225
  * - Re-setup {@linkplain https://www.lua.org/pil/13.html metatables} as they are not persisted through the save/load cycle.
224
226
  * - Re-setup conditional event handlers, meaning subscribing to an event only when some condition is met to save processing time.
225
227
  * - Create local references to data stored in the {@linkplain https://lua-api.factorio.com/latest/Global.html global} table.
@@ -230,14 +232,6 @@ interface LuaBootstrap {
230
232
  * @see {@link https://lua-api.factorio.com/latest/LuaBootstrap.html#LuaBootstrap.on_load Online documentation}
231
233
  */
232
234
  on_load(handler: (() => void) | nil): void
233
- /**
234
- * Register a metatable to have linkage recorded and restored when saving/loading. The metatable itself will not be saved. Instead, only the linkage to a registered metatable is saved, and the metatable registered under that name will be used when loading the table.
235
- * @param name The name of this metatable. Names must be unique per mod.
236
- * @param metatable The metatable to register.
237
- * @remarks `register_metatable()` can not be used in the console, in event listeners or during a `remote.call()`.
238
- * @see {@link https://lua-api.factorio.com/latest/LuaBootstrap.html#LuaBootstrap.register_metatable Online documentation}
239
- */
240
- register_metatable(name: string, metatable: table): void
241
235
  /**
242
236
  * 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
237
  * @param handler The handler for this event. Passing `nil` will unregister it.
@@ -287,6 +281,31 @@ interface LuaBootstrap {
287
281
  * @see {@link https://lua-api.factorio.com/latest/LuaBootstrap.html#LuaBootstrap.register_on_entity_destroyed Online documentation}
288
282
  */
289
283
  register_on_entity_destroyed(entity: LuaEntity): RegistrationNumber
284
+ /**
285
+ * Register a metatable to have linkage recorded and restored when saving/loading. The metatable itself will not be saved. Instead, only the linkage to a registered metatable is saved, and the metatable registered under that name will be used when loading the table.
286
+ * @param name The name of this metatable. Names must be unique per mod.
287
+ * @param metatable The metatable to register.
288
+ * @example The metatable first needs to be defined in the mod's root scope, then registered using this method. From then on, it will be properly restored for tables in {@linkplain https://lua-api.factorio.com/latest/Global.html global}.
289
+ *
290
+ * ```
291
+ * local metatable = {
292
+ * __index = function(key)
293
+ * return "no value for key " .. key
294
+ * end
295
+ * }
296
+ * script.register_metatable("my_metatable", metatable)
297
+ * ```
298
+ *
299
+ * This previously defined `metatable` can then be set on any table as usual:
300
+ *
301
+ * ```
302
+ * local table = {key="value"}
303
+ * setmetatable(table, metatable)
304
+ * ```
305
+ * @remarks `register_metatable()` can not be used in the console, in event listeners or during a `remote.call()`.
306
+ * @see {@link https://lua-api.factorio.com/latest/LuaBootstrap.html#LuaBootstrap.register_metatable Online documentation}
307
+ */
308
+ register_metatable(name: string, metatable: table): void
290
309
  /**
291
310
  * Generate a new, unique event ID that can be used to raise custom events with {@link LuaBootstrap#raise_event LuaBootstrap::raise_event}.
292
311
  * @returns The newly generated event ID.
@@ -351,6 +370,7 @@ interface LuaBootstrap {
351
370
  * - {@link ScriptRaisedBuiltEvent script_raised_built}
352
371
  * - {@link ScriptRaisedDestroyEvent script_raised_destroy}
353
372
  * - {@link ScriptRaisedReviveEvent script_raised_revive}
373
+ * - {@link ScriptRaisedTeleportedEvent script_raised_teleported}
354
374
  * - {@link ScriptRaisedSetTilesEvent script_raised_set_tiles}
355
375
  * @param event ID of the event to raise.
356
376
  * @param data Table with extra data that will be passed to the event handler. Any invalid LuaObjects will silently stop the event from being raised.
@@ -615,7 +635,7 @@ interface LuaBurner {
615
635
  */
616
636
  remaining_burning_fuel: double
617
637
  /**
618
- * The currently burning item.
638
+ * The currently burning item. Writing `nil` will void the currently burning item without producing a {@link LuaBurner#burnt_result LuaBurner::burnt_result}.
619
639
  * @remarks Writing to this automatically handles correcting {@link LuaBurner#remaining_burning_fuel LuaBurner::remaining_burning_fuel}.
620
640
  * @see {@link https://lua-api.factorio.com/latest/LuaBurner.html#LuaBurner.currently_burning Online documentation}
621
641
  */
@@ -859,10 +879,11 @@ interface LuaCommandProcessor {
859
879
  */
860
880
  interface LuaConstantCombinatorControlBehavior extends LuaControlBehavior {
861
881
  /**
862
- * Sets the signal at the given index
882
+ * Sets the signal at the given index.
883
+ * @param signal Passing `nil` clears the signal.
863
884
  * @see {@link https://lua-api.factorio.com/latest/LuaConstantCombinatorControlBehavior.html#LuaConstantCombinatorControlBehavior.set_signal Online documentation}
864
885
  */
865
- set_signal(index: uint, signal: Signal): void
886
+ set_signal(index: uint, signal?: Signal): void
866
887
  /**
867
888
  * Gets the signal at the given index. Returned {@link Signal} will not contain signal if none is set for the index.
868
889
  * @see {@link https://lua-api.factorio.com/latest/LuaConstantCombinatorControlBehavior.html#LuaConstantCombinatorControlBehavior.get_signal Online documentation}
@@ -881,7 +902,7 @@ interface LuaConstantCombinatorControlBehavior extends LuaControlBehavior {
881
902
  */
882
903
  enabled: boolean
883
904
  /**
884
- * The number of signals this constant combinator supports
905
+ * The number of signals this constant combinator supports.
885
906
  * @see {@link https://lua-api.factorio.com/latest/LuaConstantCombinatorControlBehavior.html#LuaConstantCombinatorControlBehavior.signals_count Online documentation}
886
907
  */
887
908
  readonly signals_count: uint
@@ -999,7 +1020,12 @@ interface LuaControl {
999
1020
  */
1000
1021
  get_inventory(inventory: defines.inventory): LuaInventory | nil
1001
1022
  /**
1002
- * The maximum inventory index this entity may use.
1023
+ * The highest index of all inventories this entity can use. Allows iteration over all of them if desired.
1024
+ * @example
1025
+ *
1026
+ * ```
1027
+ * for k = 1, entity.get_max_inventory_index() do [...] end
1028
+ * ```
1003
1029
  * @see {@link https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.get_max_inventory_index Online documentation}
1004
1030
  */
1005
1031
  get_max_inventory_index(): defines.inventory
@@ -1274,7 +1300,7 @@ interface LuaControl {
1274
1300
  */
1275
1301
  readonly surface: LuaSurface
1276
1302
  /**
1277
- * Unique ID associated with the surface this entity is currently on.
1303
+ * Unique {@link LuaSurface#index index} (ID) associated with the surface this entity is currently on.
1278
1304
  * @see {@link https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.surface_index Online documentation}
1279
1305
  */
1280
1306
  readonly surface_index: SurfaceIndex
@@ -1295,7 +1321,7 @@ interface LuaControl {
1295
1321
  get force(): LuaForce
1296
1322
  set force(value: ForceIdentification)
1297
1323
  /**
1298
- * Unique ID associated with the force of this entity.
1324
+ * Unique {@link LuaForce#index index} (ID) associated with the force of this entity.
1299
1325
  * @see {@link https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.force_index Online documentation}
1300
1326
  */
1301
1327
  readonly force_index: ForceIndex
@@ -1375,26 +1401,26 @@ interface LuaControl {
1375
1401
  riding_state: RidingState
1376
1402
  /**
1377
1403
  * Current mining state.
1378
- * @remarks When the player isn't mining tiles the player will mine what ever entity is currently selected. See {@link LuaControl#selected LuaControl::selected} and {@link LuaControl#update_selected_entity LuaControl::update_selected_entity}.
1404
+ * @remarks When the player isn't mining tiles, the player will mine what ever entity is currently selected. See {@link LuaControl#selected LuaControl::selected} and {@link LuaControl#update_selected_entity LuaControl::update_selected_entity}.
1379
1405
  * @see {@link https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.mining_state Online documentation}
1380
1406
  */
1381
1407
  get mining_state(): {
1382
1408
  /**
1383
- * Whether the player is mining at all
1409
+ * Whether the player is mining at all.
1384
1410
  */
1385
1411
  readonly mining: boolean
1386
1412
  /**
1387
- * What tiles the player is mining; only used when the player is mining tiles (holding a tile in the cursor).
1413
+ * What location the player is mining. Only relevant if `mining` is `true`.
1388
1414
  */
1389
1415
  readonly position?: MapPosition
1390
1416
  }
1391
1417
  set mining_state(value: {
1392
1418
  /**
1393
- * Whether the player is mining at all
1419
+ * Whether the player is mining at all.
1394
1420
  */
1395
1421
  readonly mining: boolean
1396
1422
  /**
1397
- * What tiles the player is mining; only used when the player is mining tiles (holding a tile in the cursor).
1423
+ * What location the player is mining. Only relevant if `mining` is `true`.
1398
1424
  */
1399
1425
  readonly position?: MapPosition | MapPositionArray
1400
1426
  })
@@ -1734,6 +1760,16 @@ interface LuaCustomInputPrototype {
1734
1760
  * @see {@link https://lua-api.factorio.com/latest/LuaCustomInputPrototype.html#LuaCustomInputPrototype.alternative_key_sequence Online documentation}
1735
1761
  */
1736
1762
  readonly alternative_key_sequence?: string
1763
+ /**
1764
+ * The default controller key sequence for this custom input, if any
1765
+ * @see {@link https://lua-api.factorio.com/latest/LuaCustomInputPrototype.html#LuaCustomInputPrototype.controller_key_sequence Online documentation}
1766
+ */
1767
+ readonly controller_key_sequence?: string
1768
+ /**
1769
+ * The default controller alternative key sequence for this custom input, if any
1770
+ * @see {@link https://lua-api.factorio.com/latest/LuaCustomInputPrototype.html#LuaCustomInputPrototype.controller_alternative_key_sequence Online documentation}
1771
+ */
1772
+ readonly controller_alternative_key_sequence?: string
1737
1773
  /**
1738
1774
  * The linked game control name, if any.
1739
1775
  * @see {@link https://lua-api.factorio.com/latest/LuaCustomInputPrototype.html#LuaCustomInputPrototype.linked_game_control Online documentation}
@@ -2638,21 +2674,21 @@ interface LuaEntity extends LuaControl {
2638
2674
  */
2639
2675
  update_connections(): void
2640
2676
  /**
2641
- * Current recipe being assembled by this machine or `nil` if no recipe is set.
2677
+ * Current recipe being assembled by this machine, if any.
2642
2678
  *
2643
2679
  * _Can only be used if this is CraftingMachine_
2644
2680
  * @see {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_recipe Online documentation}
2645
2681
  */
2646
2682
  get_recipe(): LuaRecipe | nil
2647
2683
  /**
2648
- * Sets the current recipe in this assembly machine.
2684
+ * Sets the given recipe in this assembly machine.
2649
2685
  *
2650
2686
  * _Can only be used if this is AssemblingMachine_
2651
- * @param recipe The new recipe or `nil` to clear the recipe.
2687
+ * @param recipe The new recipe. Writing `nil` clears the recipe, if any.
2652
2688
  * @returns Any items removed from this entity as a result of setting the recipe.
2653
2689
  * @see {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.set_recipe Online documentation}
2654
2690
  */
2655
- set_recipe(recipe: string | LuaRecipe | nil): Record<string, uint>
2691
+ set_recipe(recipe?: string | LuaRecipe): Record<string, uint>
2656
2692
  /**
2657
2693
  * Rotates this entity as if the player rotated it.
2658
2694
  *
@@ -2699,11 +2735,11 @@ interface LuaEntity extends LuaControl {
2699
2735
  * - {@link OnPlayerDrivingChangedStateEvent on_player_driving_changed_state}? _instantly_
2700
2736
  *
2701
2737
  * _Can only be used if this is Vehicle_
2702
- * @param driver The new driver or `nil` to eject the current driver if any.
2703
- * @remarks This differs over {@link LuaEntity#set_passenger LuaEntity::set_passenger} in that the passenger can't drive the vehicle.
2738
+ * @param driver The new driver. Writing `nil` ejects the current driver, if any.
2739
+ * @remarks This differs from {@link LuaEntity#set_passenger LuaEntity::set_passenger} in that the passenger can't drive the vehicle.
2704
2740
  * @see {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.set_driver Online documentation}
2705
2741
  */
2706
- set_driver(driver: LuaEntity | PlayerIdentification | nil): void
2742
+ set_driver(driver?: LuaEntity | PlayerIdentification): void
2707
2743
  /**
2708
2744
  * Gets the passenger of this car or spidertron if any.
2709
2745
  *
@@ -2720,10 +2756,11 @@ interface LuaEntity extends LuaControl {
2720
2756
  * - {@link OnPlayerDrivingChangedStateEvent on_player_driving_changed_state}? _instantly_
2721
2757
  *
2722
2758
  * _Can only be used if this is Car or SpiderVehicle_
2723
- * @remarks This differs over {@link LuaEntity#get_driver LuaEntity::get_driver} in that the passenger can't drive the car.
2759
+ * @param passenger The new passenger. Writing `nil` ejects the current passenger, if any.
2760
+ * @remarks This differs from {@link LuaEntity#get_driver LuaEntity::get_driver} in that the passenger can't drive the car.
2724
2761
  * @see {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.set_passenger Online documentation}
2725
2762
  */
2726
- set_passenger(passenger: LuaEntity | PlayerIdentification): void
2763
+ set_passenger(passenger?: LuaEntity | PlayerIdentification): void
2727
2764
  /**
2728
2765
  * Returns `true` if this entity produces or consumes electricity and is connected to an electric network that has at least one entity that can produce power.
2729
2766
  * @see {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.is_connected_to_electric_network Online documentation}
@@ -3014,6 +3051,18 @@ interface LuaEntity extends LuaControl {
3014
3051
  * @see {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.stop_spider Online documentation}
3015
3052
  */
3016
3053
  stop_spider(): void
3054
+ /**
3055
+ * Returns a table with all beacons affecting this effect receiver. Can only be used when the entity has an effect receiver (AssemblingMachine, Furnace, Lab, MiningDrills)
3056
+ * @see {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_beacons Online documentation}
3057
+ */
3058
+ get_beacons(): LuaEntity[] | nil
3059
+ /**
3060
+ * Returns a table with all entities affected by this beacon
3061
+ *
3062
+ * _Can only be used if this is Beacon_
3063
+ * @see {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_beacon_effect_receivers Online documentation}
3064
+ */
3065
+ get_beacon_effect_receivers(): LuaEntity[]
3017
3066
  /**
3018
3067
  * Name of the entity prototype. E.g. "inserter" or "filter-inserter".
3019
3068
  * @see {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.name Online documentation}
@@ -3311,12 +3360,15 @@ interface LuaEntity extends LuaControl {
3311
3360
  fluidbox: LuaFluidBox
3312
3361
  /**
3313
3362
  * The backer name assigned to this entity. Entities that support backer names are labs, locomotives, radars, roboports, and train stops. `nil` if this entity doesn't support backer names.
3363
+ *
3364
+ * **Raised events:**
3365
+ * - {@link OnEntityRenamedEvent on_entity_renamed} _instantly_
3314
3366
  * @remarks While train stops get the name of a backer when placed down, players can rename them if they want to. In this case, `backer_name` returns the player-given name of the entity.
3315
3367
  * @see {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.backer_name Online documentation}
3316
3368
  */
3317
3369
  backer_name?: string
3318
3370
  /**
3319
- * The label on this entity, if any. `nil` if this is not a spider-vehicule.
3371
+ * The label on this spider-vehicle entity, if any. `nil` if this is not a spider-vehicle.
3320
3372
  *
3321
3373
  * **Raised events:**
3322
3374
  * - {@link OnEntityRenamedEvent on_entity_renamed} _instantly_
@@ -3326,7 +3378,7 @@ interface LuaEntity extends LuaControl {
3326
3378
  /**
3327
3379
  * The ticks left before a ghost, combat robot, highlight box or smoke with trigger is destroyed.
3328
3380
  *
3329
- * - for ghosts set to uint32 max (4,294,967,295) to never expire.
3381
+ * - for ghosts set to uint32 max (4'294'967'295) to never expire.
3330
3382
  * - for ghosts Cannot be set higher than {@link LuaForce#ghost_time_to_live LuaForce::ghost_time_to_live} of the entity's force.
3331
3383
  * @see {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.time_to_live Online documentation}
3332
3384
  */
@@ -3410,14 +3462,14 @@ interface LuaEntity extends LuaControl {
3410
3462
  */
3411
3463
  readonly consumption_bonus: double
3412
3464
  /**
3413
- * `"input"` or `"output"`, depending on whether this underground belt goes down or up.
3465
+ * Whether this underground belt goes into or out of the ground.
3414
3466
  *
3415
3467
  * _Can only be used if this is TransportBeltToGround_
3416
3468
  * @see {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.belt_to_ground_type Online documentation}
3417
3469
  */
3418
3470
  readonly belt_to_ground_type: "input" | "output"
3419
3471
  /**
3420
- * `"input"` or `"output"`, depending on whether this loader puts to or gets from a container.
3472
+ * Whether this loader gets items from or puts item into a container.
3421
3473
  *
3422
3474
  * _Can only be used if this is Loader_
3423
3475
  * @see {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.loader_type Online documentation}
@@ -3510,7 +3562,9 @@ interface LuaEntity extends LuaControl {
3510
3562
  */
3511
3563
  readonly electric_emissions?: double
3512
3564
  /**
3513
- * A universally unique number identifying this entity for the lifetime of the save. Only entities inheriting from {@linkplain https://wiki.factorio.com/Prototype/EntityWithOwner EntityWithOwner}, as well as {@linkplain https://wiki.factorio.com/Prototype/ItemRequestProxy ItemRequestProxy} and {@linkplain https://wiki.factorio.com/Prototype/EntityGhost EntityGhost} are assigned a unit number. `nil` if this entity doesn't have a unit number.
3565
+ * A unique number identifying this entity for the lifetime of the save. These are allocated sequentially, and not re-used (until overflow).
3566
+ *
3567
+ * Only entities inheriting from {@linkplain https://wiki.factorio.com/Prototype/EntityWithOwner EntityWithOwner}, as well as {@linkplain https://wiki.factorio.com/Prototype/ItemRequestProxy ItemRequestProxy} and {@linkplain https://wiki.factorio.com/Prototype/EntityGhost EntityGhost} are assigned a unit number. Returns `nil` otherwise.
3514
3568
  * @see {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.unit_number Online documentation}
3515
3569
  */
3516
3570
  readonly unit_number?: UnitNumber
@@ -3729,6 +3783,11 @@ interface LuaEntity extends LuaControl {
3729
3783
  * @see {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.effects Online documentation}
3730
3784
  */
3731
3785
  readonly effects?: ModuleEffects
3786
+ /**
3787
+ * Number of beacons affecting this effect receiver. Can only be used when the entity has an effect receiver (AssemblingMachine, Furnace, Lab, MiningDrills)
3788
+ * @see {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.beacons_count Online documentation}
3789
+ */
3790
+ readonly beacons_count?: uint
3732
3791
  /**
3733
3792
  * The filters for this infinity container.
3734
3793
  *
@@ -4007,7 +4066,7 @@ interface LuaEntity extends LuaControl {
4007
4066
  */
4008
4067
  time_to_next_effect: uint
4009
4068
  /**
4010
- * Destination of this spidertron's autopilot, if any.
4069
+ * Destination of this spidertron's autopilot, if any. Writing `nil` clears all destinations.
4011
4070
  *
4012
4071
  * _Can only be used if this is SpiderVehicle_
4013
4072
  * @see {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.autopilot_destination Online documentation}
@@ -4672,6 +4731,11 @@ interface BaseEntity extends LuaControl {
4672
4731
  * @see {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.is_registered_for_repair Online documentation}
4673
4732
  */
4674
4733
  is_registered_for_repair(): boolean
4734
+ /**
4735
+ * Returns a table with all beacons affecting this effect receiver. Can only be used when the entity has an effect receiver (AssemblingMachine, Furnace, Lab, MiningDrills)
4736
+ * @see {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_beacons Online documentation}
4737
+ */
4738
+ get_beacons(): LuaEntity[] | nil
4675
4739
  /**
4676
4740
  * Name of the entity prototype. E.g. "inserter" or "filter-inserter".
4677
4741
  * @see {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.name Online documentation}
@@ -4811,12 +4875,15 @@ interface BaseEntity extends LuaControl {
4811
4875
  fluidbox: LuaFluidBox
4812
4876
  /**
4813
4877
  * The backer name assigned to this entity. Entities that support backer names are labs, locomotives, radars, roboports, and train stops. `nil` if this entity doesn't support backer names.
4878
+ *
4879
+ * **Raised events:**
4880
+ * - {@link OnEntityRenamedEvent on_entity_renamed} _instantly_
4814
4881
  * @remarks While train stops get the name of a backer when placed down, players can rename them if they want to. In this case, `backer_name` returns the player-given name of the entity.
4815
4882
  * @see {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.backer_name Online documentation}
4816
4883
  */
4817
4884
  backer_name?: string
4818
4885
  /**
4819
- * The label on this entity, if any. `nil` if this is not a spider-vehicule.
4886
+ * The label on this spider-vehicle entity, if any. `nil` if this is not a spider-vehicle.
4820
4887
  *
4821
4888
  * **Raised events:**
4822
4889
  * - {@link OnEntityRenamedEvent on_entity_renamed} _instantly_
@@ -4826,7 +4893,7 @@ interface BaseEntity extends LuaControl {
4826
4893
  /**
4827
4894
  * The ticks left before a ghost, combat robot, highlight box or smoke with trigger is destroyed.
4828
4895
  *
4829
- * - for ghosts set to uint32 max (4,294,967,295) to never expire.
4896
+ * - for ghosts set to uint32 max (4'294'967'295) to never expire.
4830
4897
  * - for ghosts Cannot be set higher than {@link LuaForce#ghost_time_to_live LuaForce::ghost_time_to_live} of the entity's force.
4831
4898
  * @see {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.time_to_live Online documentation}
4832
4899
  */
@@ -4902,7 +4969,9 @@ interface BaseEntity extends LuaControl {
4902
4969
  */
4903
4970
  readonly electric_emissions?: double
4904
4971
  /**
4905
- * A universally unique number identifying this entity for the lifetime of the save. Only entities inheriting from {@linkplain https://wiki.factorio.com/Prototype/EntityWithOwner EntityWithOwner}, as well as {@linkplain https://wiki.factorio.com/Prototype/ItemRequestProxy ItemRequestProxy} and {@linkplain https://wiki.factorio.com/Prototype/EntityGhost EntityGhost} are assigned a unit number. `nil` if this entity doesn't have a unit number.
4972
+ * A unique number identifying this entity for the lifetime of the save. These are allocated sequentially, and not re-used (until overflow).
4973
+ *
4974
+ * Only entities inheriting from {@linkplain https://wiki.factorio.com/Prototype/EntityWithOwner EntityWithOwner}, as well as {@linkplain https://wiki.factorio.com/Prototype/ItemRequestProxy ItemRequestProxy} and {@linkplain https://wiki.factorio.com/Prototype/EntityGhost EntityGhost} are assigned a unit number. Returns `nil` otherwise.
4906
4975
  * @see {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.unit_number Online documentation}
4907
4976
  */
4908
4977
  readonly unit_number?: UnitNumber
@@ -5062,6 +5131,11 @@ interface BaseEntity extends LuaControl {
5062
5131
  * @see {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.effects Online documentation}
5063
5132
  */
5064
5133
  readonly effects?: ModuleEffects
5134
+ /**
5135
+ * Number of beacons affecting this effect receiver. Can only be used when the entity has an effect receiver (AssemblingMachine, Furnace, Lab, MiningDrills)
5136
+ * @see {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.beacons_count Online documentation}
5137
+ */
5138
+ readonly beacons_count?: uint
5065
5139
  /**
5066
5140
  * The status of this entity, if any.
5067
5141
  * @see {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.status Online documentation}
@@ -5352,7 +5426,7 @@ interface CraftingMachineEntity extends BaseEntity {
5352
5426
  */
5353
5427
  is_crafting(): boolean
5354
5428
  /**
5355
- * Current recipe being assembled by this machine or `nil` if no recipe is set.
5429
+ * Current recipe being assembled by this machine, if any.
5356
5430
  *
5357
5431
  * _Can only be used if this is CraftingMachine_
5358
5432
  * @see {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_recipe Online documentation}
@@ -5763,14 +5837,14 @@ interface ProgrammableSpeakerEntity extends BaseEntity {
5763
5837
  */
5764
5838
  interface AssemblingMachineEntity extends BaseEntity {
5765
5839
  /**
5766
- * Sets the current recipe in this assembly machine.
5840
+ * Sets the given recipe in this assembly machine.
5767
5841
  *
5768
5842
  * _Can only be used if this is AssemblingMachine_
5769
- * @param recipe The new recipe or `nil` to clear the recipe.
5843
+ * @param recipe The new recipe. Writing `nil` clears the recipe, if any.
5770
5844
  * @returns Any items removed from this entity as a result of setting the recipe.
5771
5845
  * @see {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.set_recipe Online documentation}
5772
5846
  */
5773
- set_recipe(recipe: string | LuaRecipe | nil): Record<string, uint>
5847
+ set_recipe(recipe?: string | LuaRecipe): Record<string, uint>
5774
5848
  /**
5775
5849
  * When locked; the recipe in this assembling machine can't be changed by the player.
5776
5850
  *
@@ -5799,11 +5873,11 @@ interface VehicleEntity extends BaseEntity {
5799
5873
  * - {@link OnPlayerDrivingChangedStateEvent on_player_driving_changed_state}? _instantly_
5800
5874
  *
5801
5875
  * _Can only be used if this is Vehicle_
5802
- * @param driver The new driver or `nil` to eject the current driver if any.
5803
- * @remarks This differs over {@link LuaEntity#set_passenger LuaEntity::set_passenger} in that the passenger can't drive the vehicle.
5876
+ * @param driver The new driver. Writing `nil` ejects the current driver, if any.
5877
+ * @remarks This differs from {@link LuaEntity#set_passenger LuaEntity::set_passenger} in that the passenger can't drive the vehicle.
5804
5878
  * @see {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.set_driver Online documentation}
5805
5879
  */
5806
- set_driver(driver: LuaEntity | PlayerIdentification | nil): void
5880
+ set_driver(driver?: LuaEntity | PlayerIdentification): void
5807
5881
  /**
5808
5882
  * Whether equipment grid logistics are enabled while this vehicle is moving.
5809
5883
  *
@@ -5833,10 +5907,11 @@ interface CarEntity extends BaseEntity {
5833
5907
  * - {@link OnPlayerDrivingChangedStateEvent on_player_driving_changed_state}? _instantly_
5834
5908
  *
5835
5909
  * _Can only be used if this is Car or SpiderVehicle_
5836
- * @remarks This differs over {@link LuaEntity#get_driver LuaEntity::get_driver} in that the passenger can't drive the car.
5910
+ * @param passenger The new passenger. Writing `nil` ejects the current passenger, if any.
5911
+ * @remarks This differs from {@link LuaEntity#get_driver LuaEntity::get_driver} in that the passenger can't drive the car.
5837
5912
  * @see {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.set_passenger Online documentation}
5838
5913
  */
5839
- set_passenger(passenger: LuaEntity | PlayerIdentification): void
5914
+ set_passenger(passenger?: LuaEntity | PlayerIdentification): void
5840
5915
  /**
5841
5916
  * Multiplies the acceleration the vehicle can create for one unit of energy. Defaults to `1`.
5842
5917
  *
@@ -5899,10 +5974,11 @@ interface SpiderVehicleEntity extends BaseEntity {
5899
5974
  * - {@link OnPlayerDrivingChangedStateEvent on_player_driving_changed_state}? _instantly_
5900
5975
  *
5901
5976
  * _Can only be used if this is Car or SpiderVehicle_
5902
- * @remarks This differs over {@link LuaEntity#get_driver LuaEntity::get_driver} in that the passenger can't drive the car.
5977
+ * @param passenger The new passenger. Writing `nil` ejects the current passenger, if any.
5978
+ * @remarks This differs from {@link LuaEntity#get_driver LuaEntity::get_driver} in that the passenger can't drive the car.
5903
5979
  * @see {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.set_passenger Online documentation}
5904
5980
  */
5905
- set_passenger(passenger: LuaEntity | PlayerIdentification): void
5981
+ set_passenger(passenger?: LuaEntity | PlayerIdentification): void
5906
5982
  /**
5907
5983
  * Adds the given position to this spidertron's autopilot's queue of destinations.
5908
5984
  *
@@ -5954,7 +6030,7 @@ interface SpiderVehicleEntity extends BaseEntity {
5954
6030
  */
5955
6031
  selected_gun_index?: uint
5956
6032
  /**
5957
- * Destination of this spidertron's autopilot, if any.
6033
+ * Destination of this spidertron's autopilot, if any. Writing `nil` clears all destinations.
5958
6034
  *
5959
6035
  * _Can only be used if this is SpiderVehicle_
5960
6036
  * @see {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.autopilot_destination Online documentation}
@@ -6140,6 +6216,19 @@ interface LinkedBeltEntity extends BaseEntity {
6140
6216
  readonly linked_belt_neighbour?: LuaEntity
6141
6217
  }
6142
6218
 
6219
+ /**
6220
+ * @noSelf
6221
+ */
6222
+ interface BeaconEntity extends BaseEntity {
6223
+ /**
6224
+ * Returns a table with all entities affected by this beacon
6225
+ *
6226
+ * _Can only be used if this is Beacon_
6227
+ * @see {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_beacon_effect_receivers Online documentation}
6228
+ */
6229
+ get_beacon_effect_receivers(): LuaEntity[]
6230
+ }
6231
+
6143
6232
  interface GhostEntity extends BaseEntity {
6144
6233
  /**
6145
6234
  * Name of the entity or tile contained in this ghost
@@ -6304,7 +6393,7 @@ interface FlyingTextEntity extends BaseEntity {
6304
6393
 
6305
6394
  interface TransportBeltToGroundEntity extends BaseEntity {
6306
6395
  /**
6307
- * `"input"` or `"output"`, depending on whether this underground belt goes down or up.
6396
+ * Whether this underground belt goes into or out of the ground.
6308
6397
  *
6309
6398
  * _Can only be used if this is TransportBeltToGround_
6310
6399
  * @see {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.belt_to_ground_type Online documentation}
@@ -6314,7 +6403,7 @@ interface TransportBeltToGroundEntity extends BaseEntity {
6314
6403
 
6315
6404
  interface LoaderEntity extends BaseEntity {
6316
6405
  /**
6317
- * `"input"` or `"output"`, depending on whether this loader puts to or gets from a container.
6406
+ * Whether this loader gets items from or puts item into a container.
6318
6407
  *
6319
6408
  * _Can only be used if this is Loader_
6320
6409
  * @see {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.loader_type Online documentation}
@@ -6635,10 +6724,10 @@ interface LuaEntityPrototype {
6635
6724
  readonly mining_trigger?: TriggerItem[]
6636
6725
  }
6637
6726
  /**
6638
- * Items that when placed will produce this entity, if any. Construction bots will always choose the first item in this list to build this entity.
6727
+ * Items that when placed will produce this entity, if any. Construction bots will choose the first item in the list to build this entity.
6639
6728
  * @see {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.items_to_place_this Online documentation}
6640
6729
  */
6641
- readonly items_to_place_this?: SimpleItemStack[]
6730
+ readonly items_to_place_this?: ItemStackDefinition[]
6642
6731
  /**
6643
6732
  * The bounding box used for collision checking.
6644
6733
  * @see {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.collision_box Online documentation}
@@ -7054,7 +7143,7 @@ interface LuaEntityPrototype {
7054
7143
  */
7055
7144
  readonly guns?: Record<string, LuaItemPrototype>
7056
7145
  /**
7057
- * A vector of the gun prototypes of this car, spider vehicule, or artillery wagon or turret.
7146
+ * A vector of the gun prototypes of this car, spider vehicle, artillery wagon, or turret.
7058
7147
  *
7059
7148
  * _Can only be used if this is Car, SpiderVehicle, ArtilleryTurret or ArtilleryWagon_
7060
7149
  * @see {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.indexed_guns Online documentation}
@@ -7196,7 +7285,7 @@ interface LuaEntityPrototype {
7196
7285
  /**
7197
7286
  * The default maximum power output of this generator prototype.
7198
7287
  *
7199
- * _Can only be used if this is Generator_
7288
+ * _Can only be used if this is BurnerGenerator or Generator_
7200
7289
  * @see {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.max_power_output Online documentation}
7201
7290
  */
7202
7291
  readonly max_power_output?: double
@@ -8170,10 +8259,10 @@ interface BaseEntityPrototype {
8170
8259
  readonly mining_trigger?: TriggerItem[]
8171
8260
  }
8172
8261
  /**
8173
- * Items that when placed will produce this entity, if any. Construction bots will always choose the first item in this list to build this entity.
8262
+ * Items that when placed will produce this entity, if any. Construction bots will choose the first item in the list to build this entity.
8174
8263
  * @see {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.items_to_place_this Online documentation}
8175
8264
  */
8176
- readonly items_to_place_this?: SimpleItemStack[]
8265
+ readonly items_to_place_this?: ItemStackDefinition[]
8177
8266
  /**
8178
8267
  * The bounding box used for collision checking.
8179
8268
  * @see {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.collision_box Online documentation}
@@ -9104,7 +9193,7 @@ interface CarEntityPrototype extends BaseEntityPrototype {
9104
9193
  */
9105
9194
  readonly turret_rotation_speed?: double
9106
9195
  /**
9107
- * A vector of the gun prototypes of this car, spider vehicule, or artillery wagon or turret.
9196
+ * A vector of the gun prototypes of this car, spider vehicle, artillery wagon, or turret.
9108
9197
  *
9109
9198
  * _Can only be used if this is Car, SpiderVehicle, ArtilleryTurret or ArtilleryWagon_
9110
9199
  * @see {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.indexed_guns Online documentation}
@@ -9165,7 +9254,7 @@ interface GeneratorEntityPrototype extends BaseEntityPrototype {
9165
9254
  /**
9166
9255
  * The default maximum power output of this generator prototype.
9167
9256
  *
9168
- * _Can only be used if this is Generator_
9257
+ * _Can only be used if this is BurnerGenerator or Generator_
9169
9258
  * @see {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.max_power_output Online documentation}
9170
9259
  */
9171
9260
  readonly max_power_output?: double
@@ -9190,7 +9279,7 @@ interface RollingStockEntityPrototype extends BaseEntityPrototype {
9190
9279
 
9191
9280
  interface SpiderVehicleEntityPrototype extends BaseEntityPrototype {
9192
9281
  /**
9193
- * A vector of the gun prototypes of this car, spider vehicule, or artillery wagon or turret.
9282
+ * A vector of the gun prototypes of this car, spider vehicle, artillery wagon, or turret.
9194
9283
  *
9195
9284
  * _Can only be used if this is Car, SpiderVehicle, ArtilleryTurret or ArtilleryWagon_
9196
9285
  * @see {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.indexed_guns Online documentation}
@@ -9242,7 +9331,7 @@ interface SpiderVehicleEntityPrototype extends BaseEntityPrototype {
9242
9331
 
9243
9332
  interface ArtilleryTurretEntityPrototype extends BaseEntityPrototype {
9244
9333
  /**
9245
- * A vector of the gun prototypes of this car, spider vehicule, or artillery wagon or turret.
9334
+ * A vector of the gun prototypes of this car, spider vehicle, artillery wagon, or turret.
9246
9335
  *
9247
9336
  * _Can only be used if this is Car, SpiderVehicle, ArtilleryTurret or ArtilleryWagon_
9248
9337
  * @see {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.indexed_guns Online documentation}
@@ -9259,7 +9348,7 @@ interface ArtilleryTurretEntityPrototype extends BaseEntityPrototype {
9259
9348
 
9260
9349
  interface ArtilleryWagonEntityPrototype extends BaseEntityPrototype {
9261
9350
  /**
9262
- * A vector of the gun prototypes of this car, spider vehicule, or artillery wagon or turret.
9351
+ * A vector of the gun prototypes of this car, spider vehicle, artillery wagon, or turret.
9263
9352
  *
9264
9353
  * _Can only be used if this is Car, SpiderVehicle, ArtilleryTurret or ArtilleryWagon_
9265
9354
  * @see {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.indexed_guns Online documentation}
@@ -9430,6 +9519,16 @@ interface RobotWithLogisticsInterfaceEntityPrototype extends BaseEntityPrototype
9430
9519
  readonly draw_cargo?: boolean
9431
9520
  }
9432
9521
 
9522
+ interface BurnerGeneratorEntityPrototype extends BaseEntityPrototype {
9523
+ /**
9524
+ * The default maximum power output of this generator prototype.
9525
+ *
9526
+ * _Can only be used if this is BurnerGenerator or Generator_
9527
+ * @see {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.max_power_output Online documentation}
9528
+ */
9529
+ readonly max_power_output?: double
9530
+ }
9531
+
9433
9532
  interface BoilerEntityPrototype extends BaseEntityPrototype {
9434
9533
  /**
9435
9534
  * The target temperature of this boiler prototype.
@@ -10248,7 +10347,7 @@ interface LuaEquipmentGrid {
10248
10347
  */
10249
10348
  readonly max_shield: float
10250
10349
  /**
10251
- * True if this movement bonus equipment is turned off, otherwise false.
10350
+ * Whether this grid's equipment movement bonus is active.
10252
10351
  * @see {@link https://lua-api.factorio.com/latest/LuaEquipmentGrid.html#LuaEquipmentGrid.inhibit_movement_bonus Online documentation}
10253
10352
  */
10254
10353
  inhibit_movement_bonus: boolean
@@ -11127,9 +11226,10 @@ interface LuaForce {
11127
11226
  clear_chart(surface?: SurfaceIdentification): void
11128
11227
  /**
11129
11228
  * Force a rechart of the whole chart.
11229
+ * @param surface Which surface to rechart or all if not given.
11130
11230
  * @see {@link https://lua-api.factorio.com/latest/LuaForce.html#LuaForce.rechart Online documentation}
11131
11231
  */
11132
- rechart(): void
11232
+ rechart(surface?: SurfaceIdentification): void
11133
11233
  /**
11134
11234
  * Chart all generated chunks.
11135
11235
  * @param surface Which surface to chart or all if not given.
@@ -11611,7 +11711,7 @@ interface LuaForce {
11611
11711
  */
11612
11712
  research_queue_enabled: boolean
11613
11713
  /**
11614
- * Unique ID associated with this force.
11714
+ * This force's index in {@link LuaGameScript#forces LuaGameScript::forces} (unique ID). It is assigned when a force is created, and remains so until it is {@link OnForcesMergedEvent merged} (ie. deleted). Indexes of merged forces can be reused.
11615
11715
  * @see {@link https://lua-api.factorio.com/latest/LuaForce.html#LuaForce.index Online documentation}
11616
11716
  */
11617
11717
  readonly index: ForceIndex
@@ -11916,7 +12016,7 @@ interface LuaGameScript {
11916
12016
  */
11917
12017
  remove_offline_players(players?: readonly (LuaPlayer | string)[]): void
11918
12018
  /**
11919
- * Force a CRC check. Tells all peers to calculate their current map CRC; these CRC are then compared against each other. If a mismatch is detected, the game is desynced and some peers are forced to reconnect.
12019
+ * Force a CRC check. Tells all peers to calculate their current CRC, which are then compared to each other. If a mismatch is detected, the game desyncs and some peers are forced to reconnect.
11920
12020
  * @see {@link https://lua-api.factorio.com/latest/LuaGameScript.html#LuaGameScript.force_crc Online documentation}
11921
12021
  */
11922
12022
  force_crc(): void
@@ -11951,7 +12051,7 @@ interface LuaGameScript {
11951
12051
  * @param name Name of the new surface.
11952
12052
  * @param settings Map generation settings.
11953
12053
  * @returns The surface that was just created.
11954
- * @remarks The game currently supports a maximum of 4,294,967,295 surfaces, including the default surface.<br>Surface names must be unique.
12054
+ * @remarks The game currently supports a maximum of 4'294'967'295 surfaces, including the default surface.<br>Surface names must be unique.
11955
12055
  * @see {@link https://lua-api.factorio.com/latest/LuaGameScript.html#LuaGameScript.create_surface Online documentation}
11956
12056
  */
11957
12057
  create_surface(name: string, settings?: MapGenSettingsWrite): LuaSurface
@@ -12112,7 +12212,7 @@ interface LuaGameScript {
12112
12212
  */
12113
12213
  count_pipe_groups(): void
12114
12214
  /**
12115
- * Is the map loaded is multiplayer?
12215
+ * Whether the save is loaded as a multiplayer map.
12116
12216
  * @see {@link https://lua-api.factorio.com/latest/LuaGameScript.html#LuaGameScript.is_multiplayer Online documentation}
12117
12217
  */
12118
12218
  is_multiplayer(): boolean
@@ -12370,7 +12470,7 @@ interface LuaGameScript {
12370
12470
  */
12371
12471
  readonly difficulty: defines.difficulty
12372
12472
  /**
12373
- * Get a table of all the forces that currently exist. This sparse table allows you to find forces by indexing it with either their `name` or `index`. Iterating this table with `pairs()` will only iterate the array part of the table. Iterating with `ipairs()` will not work at all.
12473
+ * Get a table of all the forces that currently exist. This sparse table allows you to find forces by indexing it with either their `name` or `index`. Iterating this table with `pairs()` will only iterate the hash part of the table. Iterating with `ipairs()` will not work at all.
12374
12474
  * @see {@link https://lua-api.factorio.com/latest/LuaGameScript.html#LuaGameScript.forces Online documentation}
12375
12475
  */
12376
12476
  readonly forces: LuaCustomTable<uint | string, LuaForce>
@@ -12541,8 +12641,9 @@ interface LuaGameScript {
12541
12641
  */
12542
12642
  readonly tick: uint
12543
12643
  /**
12544
- * The number of ticks since this game was 'created'. A game is 'created' either by using "new game" or "new game from scenario".
12545
- * @remarks This differs over {@link LuaGameScript#tick LuaGameScript::tick} in that making a game from a scenario always starts with ticks_played value at 0 even if the scenario has its own level data where the {@link LuaGameScript#tick LuaGameScript::tick} is > 0.<br>This value has no relation with {@link LuaGameScript#tick LuaGameScript::tick} and can be completely different values.
12644
+ * The number of ticks since this game was created using either "new game" or "new game from scenario". Notably, this number progresses even when the game is {@link LuaGameScript#tick_paused tick_paused}.
12645
+ *
12646
+ * This differs from {@link LuaGameScript#tick LuaGameScript::tick} in that creating a game from a scenario always starts with this value at `0`, even if the scenario has its own level data where the `tick` has progressed past `0`.
12546
12647
  * @see {@link https://lua-api.factorio.com/latest/LuaGameScript.html#LuaGameScript.ticks_played Online documentation}
12547
12648
  */
12548
12649
  readonly ticks_played: uint
@@ -12573,7 +12674,7 @@ interface LuaGameScript {
12573
12674
  */
12574
12675
  speed: float
12575
12676
  /**
12576
- * Get a table of all the surfaces that currently exist. This sparse table allows you to find surfaces by indexing it with either their `name` or `index`. Iterating this table with `pairs()` will only iterate the array part of the table. Iterating with `ipairs()` will not work at all.
12677
+ * Get a table of all the surfaces that currently exist. This sparse table allows you to find surfaces by indexing it with either their `name` or `index`. Iterating this table with `pairs()` will only iterate the hash part of the table. Iterating with `ipairs()` will not work at all.
12577
12678
  * @see {@link https://lua-api.factorio.com/latest/LuaGameScript.html#LuaGameScript.surfaces Online documentation}
12578
12679
  */
12579
12680
  readonly surfaces: LuaCustomTable<SurfaceIndex | string, LuaSurface>
@@ -12890,6 +12991,14 @@ interface BaseGuiSpec {
12890
12991
  * Where to position the child element when in the `relative` element.
12891
12992
  */
12892
12993
  readonly anchor?: GuiAnchor
12994
+ /**
12995
+ * How the element should interact with game controllers. Defaults to {@link defines.game_controller_interaction.normal}.
12996
+ */
12997
+ readonly game_controller_interaction?: defines.game_controller_interaction
12998
+ /**
12999
+ * Whether this element will raise {@link OnGuiHoverEvent on_gui_hover} and {@link OnGuiLeaveEvent on_gui_leave}. Defaults to `false`.
13000
+ */
13001
+ readonly raise_hover_events?: boolean
12893
13002
  }
12894
13003
 
12895
13004
  /**
@@ -12901,6 +13010,14 @@ interface ButtonGuiSpec extends BaseGuiSpec {
12901
13010
  * Which mouse buttons the button responds to. Defaults to `"left-and-right"`.
12902
13011
  */
12903
13012
  readonly mouse_button_filter?: MouseButtonFlagsWrite
13013
+ /**
13014
+ * Whether the button will automatically toggle when clicked. Defaults to `false`.
13015
+ */
13016
+ readonly auto_toggle?: boolean
13017
+ /**
13018
+ * The initial toggled state of the button. Defaults to `false`.
13019
+ */
13020
+ readonly toggled?: boolean
12904
13021
  }
12905
13022
 
12906
13023
  /**
@@ -13049,6 +13166,14 @@ interface SpriteButtonGuiSpec extends BaseGuiSpec {
13049
13166
  * The mouse buttons that the button responds to. Defaults to `"left-and-right"`.
13050
13167
  */
13051
13168
  readonly mouse_button_filter?: MouseButtonFlagsWrite
13169
+ /**
13170
+ * Whether the button will automatically toggle when clicked. Defaults to `false`.
13171
+ */
13172
+ readonly auto_toggle?: boolean
13173
+ /**
13174
+ * The initial toggled state of the button. Defaults to `false`.
13175
+ */
13176
+ readonly toggled?: boolean
13052
13177
  }
13053
13178
 
13054
13179
  /**
@@ -13574,6 +13699,11 @@ interface BaseGuiElement {
13574
13699
  */
13575
13700
  get location(): GuiLocation | nil
13576
13701
  set location(value: GuiLocation | GuiLocationArray | nil)
13702
+ /**
13703
+ * How this element should interact with game controllers.
13704
+ * @see {@link https://lua-api.factorio.com/latest/LuaGuiElement.html#LuaGuiElement.game_controller_interaction Online documentation}
13705
+ */
13706
+ game_controller_interaction: defines.game_controller_interaction
13577
13707
  /**
13578
13708
  * Whether this GUI element is enabled. Disabled GUI elements don't trigger events when clicked.
13579
13709
  * @see {@link https://lua-api.factorio.com/latest/LuaGuiElement.html#LuaGuiElement.enabled Online documentation}
@@ -13594,6 +13724,11 @@ interface BaseGuiElement {
13594
13724
  * @see {@link https://lua-api.factorio.com/latest/LuaGuiElement.html#LuaGuiElement.tags Online documentation}
13595
13725
  */
13596
13726
  tags: Tags
13727
+ /**
13728
+ * Whether this element will raise {@link OnGuiHoverEvent on_gui_hover} and {@link OnGuiLeaveEvent on_gui_leave}.
13729
+ * @see {@link https://lua-api.factorio.com/latest/LuaGuiElement.html#LuaGuiElement.raise_hover_events Online documentation}
13730
+ */
13731
+ raise_hover_events: boolean
13597
13732
  /**
13598
13733
  * 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.
13599
13734
  */
@@ -13961,6 +14096,20 @@ interface SpriteButtonGuiElementMembers extends BaseGuiElement {
13961
14096
  * @see {@link https://lua-api.factorio.com/latest/LuaGuiElement.html#LuaGuiElement.show_percent_for_small_numbers Online documentation}
13962
14097
  */
13963
14098
  show_percent_for_small_numbers: boolean
14099
+ /**
14100
+ * Whether this button will automatically toggle when clicked.
14101
+ *
14102
+ * _Can only be used if this is button or sprite-button_
14103
+ * @see {@link https://lua-api.factorio.com/latest/LuaGuiElement.html#LuaGuiElement.auto_toggle Online documentation}
14104
+ */
14105
+ auto_toggle: boolean
14106
+ /**
14107
+ * Whether this button is currently toggled. When a button is toggled, it will use the `selected_graphical_set` and `selected_font_color` defined in its style.
14108
+ *
14109
+ * _Can only be used if this is button or sprite-button_
14110
+ * @see {@link https://lua-api.factorio.com/latest/LuaGuiElement.html#LuaGuiElement.toggled Online documentation}
14111
+ */
14112
+ toggled: boolean
13964
14113
  /**
13965
14114
  * The mouse button filters for this button or sprite-button.
13966
14115
  *
@@ -14126,6 +14275,20 @@ interface ButtonGuiElementMembers extends BaseGuiElement {
14126
14275
  * @see {@link https://lua-api.factorio.com/latest/LuaGuiElement.html#LuaGuiElement.type Online documentation}
14127
14276
  */
14128
14277
  readonly type: "button"
14278
+ /**
14279
+ * Whether this button will automatically toggle when clicked.
14280
+ *
14281
+ * _Can only be used if this is button or sprite-button_
14282
+ * @see {@link https://lua-api.factorio.com/latest/LuaGuiElement.html#LuaGuiElement.auto_toggle Online documentation}
14283
+ */
14284
+ auto_toggle: boolean
14285
+ /**
14286
+ * Whether this button is currently toggled. When a button is toggled, it will use the `selected_graphical_set` and `selected_font_color` defined in its style.
14287
+ *
14288
+ * _Can only be used if this is button or sprite-button_
14289
+ * @see {@link https://lua-api.factorio.com/latest/LuaGuiElement.html#LuaGuiElement.toggled Online documentation}
14290
+ */
14291
+ toggled: boolean
14129
14292
  /**
14130
14293
  * The mouse button filters for this button or sprite-button.
14131
14294
  *
@@ -14763,7 +14926,7 @@ type GuiElementMembers =
14763
14926
  * - `"progressbar"`: A partially filled bar that can be used to indicate progress.
14764
14927
  * - `"table"`: An invisible container that lays out its children in a specific number of columns. The width of each column is determined by the widest element it contains.
14765
14928
  * - `"textfield"`: A single-line box the user can type into. Relevant events: {@link OnGuiTextChangedEvent on_gui_text_changed}, {@link OnGuiConfirmedEvent on_gui_confirmed}
14766
- * - `"radiobutton"`: A clickable element that is functionally identical to a `checkbox`, but has a circular appearance. Relevant event: {@link OnGuiCheckedStateChangedEvent on_gui_checked_state_changed}
14929
+ * - `"radiobutton"`: An element that is similar to a `checkbox`, but with a circular appearance. Clicking a selected radio button will not unselect it. Radio buttons are not linked to each other in any way. Relevant event: {@link OnGuiCheckedStateChangedEvent on_gui_checked_state_changed}
14767
14930
  * - `"sprite"`: An element that shows an image.
14768
14931
  * - `"scroll-pane"`: An invisible element that is similar to a `flow`, but has the ability to show and use scroll bars.
14769
14932
  * - `"drop-down"`: A drop-down containing strings of text. Relevant event: {@link OnGuiSelectionStateChangedEvent on_gui_selection_state_changed}
@@ -16404,6 +16567,14 @@ interface LuaItemStack {
16404
16567
  * @see {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.drain_durability Online documentation}
16405
16568
  */
16406
16569
  drain_durability(amount: double): void
16570
+ /**
16571
+ * Use the capsule item with the entity as the source, targeting the given position.
16572
+ * @param entity The entity to use the capsule item with.
16573
+ * @param target_position The position to use the capsule item with.
16574
+ * @returns Array of the entities that were created by the capsule action.
16575
+ * @see {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.use_capsule Online documentation}
16576
+ */
16577
+ use_capsule(entity: LuaEntity, target_position: MapPosition | MapPositionArray): LuaEntity[]
16407
16578
  /**
16408
16579
  * Would a call to {@link LuaItemStack#set_stack LuaItemStack::set_stack} succeed?
16409
16580
  * @param stack Stack that would be set, possibly `nil`.
@@ -16873,7 +17044,7 @@ interface LuaItemStack {
16873
17044
  * _Can only be used if this is BlueprintItem_
16874
17045
  * @see {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.default_icons Online documentation}
16875
17046
  */
16876
- readonly default_icons: BlueprintItemIcon[]
17047
+ readonly default_icons: BlueprintSignalIcon[]
16877
17048
  /**
16878
17049
  * _Can only be used if this is ItemWithTags_
16879
17050
  * @see {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.tags Online documentation}
@@ -17076,6 +17247,14 @@ interface BaseItemStack {
17076
17247
  * @see {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.is_blueprint_setup Online documentation}
17077
17248
  */
17078
17249
  is_blueprint_setup(): boolean
17250
+ /**
17251
+ * Use the capsule item with the entity as the source, targeting the given position.
17252
+ * @param entity The entity to use the capsule item with.
17253
+ * @param target_position The position to use the capsule item with.
17254
+ * @returns Array of the entities that were created by the capsule action.
17255
+ * @see {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.use_capsule Online documentation}
17256
+ */
17257
+ use_capsule(entity: LuaEntity, target_position: MapPosition | MapPositionArray): LuaEntity[]
17079
17258
  /**
17080
17259
  * Would a call to {@link LuaItemStack#set_stack LuaItemStack::set_stack} succeed?
17081
17260
  * @param stack Stack that would be set, possibly `nil`.
@@ -17537,7 +17716,7 @@ interface BlueprintItemStack extends BaseItemStack {
17537
17716
  * _Can only be used if this is BlueprintItem_
17538
17717
  * @see {@link https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.default_icons Online documentation}
17539
17718
  */
17540
- readonly default_icons: BlueprintItemIcon[]
17719
+ readonly default_icons: BlueprintSignalIcon[]
17541
17720
  }
17542
17721
 
17543
17722
  /**
@@ -18368,6 +18547,11 @@ interface LuaMiningDrillControlBehavior extends LuaGenericOnOffControlBehavior {
18368
18547
  * @noSelf
18369
18548
  */
18370
18549
  interface LuaModSettingPrototype {
18550
+ /**
18551
+ * Type of this prototype.
18552
+ * @see {@link https://lua-api.factorio.com/latest/LuaModSettingPrototype.html#LuaModSettingPrototype.type Online documentation}
18553
+ */
18554
+ readonly type: string
18371
18555
  /**
18372
18556
  * Name of this prototype.
18373
18557
  * @see {@link https://lua-api.factorio.com/latest/LuaModSettingPrototype.html#LuaModSettingPrototype.name Online documentation}
@@ -19254,7 +19438,7 @@ interface LuaPlayer extends LuaControl {
19254
19438
  */
19255
19439
  readonly cutscene_character: LuaEntity | nil
19256
19440
  /**
19257
- * This player's unique index in {@link LuaGameScript#players LuaGameScript::players}. It is given to them when they are {@link OnPlayerCreatedEvent created} and remains assigned to them until they are {@link OnPlayerRemovedEvent removed}.
19441
+ * This player's index in {@link LuaGameScript#players LuaGameScript::players} (unique ID). It is assigned when a player is created, and remains so (even when the player is not {@link LuaPlayer#connected connected}) until the player is irreversably {@link OnPlayerRemovedEvent removed}. Indexes of removed players can be reused.
19258
19442
  * @see {@link https://lua-api.factorio.com/latest/LuaPlayer.html#LuaPlayer.index Online documentation}
19259
19443
  */
19260
19444
  readonly index: PlayerIndex
@@ -19340,8 +19524,15 @@ interface LuaPlayer extends LuaControl {
19340
19524
  */
19341
19525
  permission_group?: LuaPermissionGroup
19342
19526
  /**
19343
- * The current per-player settings for the this player, indexed by prototype name. Returns the same structure as {@link LuaSettings#get_player_settings LuaSettings::get_player_settings}.
19344
- * @remarks This table will become invalid if its associated player does.
19527
+ * The current per-player settings for the this player, indexed by prototype name. Returns the same structure as {@link LuaSettings#get_player_settings LuaSettings::get_player_settings}. This table becomes invalid if its associated player does.
19528
+ *
19529
+ * Even though this attribute is marked as read-only, individual settings can be changed by overwriting their {@link ModSetting} table. Mods can only change their own settings. Using the in-game console, all player settings can be changed.
19530
+ * @example
19531
+ *
19532
+ * ```
19533
+ * -- Change the value of the "active_lifestyle" setting
19534
+ * player.mod_settings["active_lifestyle"] = {value = true}
19535
+ * ```
19345
19536
  * @see {@link https://lua-api.factorio.com/latest/LuaPlayer.html#LuaPlayer.mod_settings Online documentation}
19346
19537
  */
19347
19538
  readonly mod_settings: LuaCustomTable<string, ModSetting>
@@ -19375,6 +19566,11 @@ interface LuaPlayer extends LuaControl {
19375
19566
  * @see {@link https://lua-api.factorio.com/latest/LuaPlayer.html#LuaPlayer.render_mode Online documentation}
19376
19567
  */
19377
19568
  readonly render_mode: defines.render_mode
19569
+ /**
19570
+ * The input method of the player, mouse and keyboard or game controller
19571
+ * @see {@link https://lua-api.factorio.com/latest/LuaPlayer.html#LuaPlayer.input_method Online documentation}
19572
+ */
19573
+ readonly input_method: defines.input_method
19378
19574
  /**
19379
19575
  * If `true`, zoom-to-world noise effect will be disabled and environmental sounds will be based on zoom-to-world view instead of position of player's character.
19380
19576
  * @see {@link https://lua-api.factorio.com/latest/LuaPlayer.html#LuaPlayer.spectator Online documentation}
@@ -19719,22 +19915,22 @@ interface LuaRecipe {
19719
19915
  */
19720
19916
  readonly category: string
19721
19917
  /**
19722
- * Ingredients for this recipe.
19723
- * @example What the "steel-chest" recipe would return
19918
+ * The ingredients to this recipe.
19919
+ * @example The ingredients of `"advanced-oil-processing"` would look like this:
19724
19920
  *
19725
19921
  * ```
19726
- * {{type="item", name="steel-plate", amount=8}}
19727
- * ```
19728
- * @example What the "advanced-oil-processing" recipe would return
19729
- *
19730
- * ```
19731
- * {{type="fluid", name="crude-oil", amount=10}, {type="fluid", name="water", amount=5}}
19922
+ * {{type="fluid", name="crude-oil", amount=100}, {type="fluid", name="water", amount=50}}
19732
19923
  * ```
19733
19924
  * @see {@link https://lua-api.factorio.com/latest/LuaRecipe.html#LuaRecipe.ingredients Online documentation}
19734
19925
  */
19735
19926
  readonly ingredients: Ingredient[]
19736
19927
  /**
19737
- * The results of this recipe.
19928
+ * The results/products of this recipe.
19929
+ * @example The products of `"advanced-oil-processing"` would look like this:
19930
+ *
19931
+ * ```
19932
+ * {{type="fluid", name="heavy-oil", amount=25}, {type="fluid", name="light-oil", amount=45}, {type="fluid", name="petroleum-gas", amount=55}}
19933
+ * ```
19738
19934
  * @see {@link https://lua-api.factorio.com/latest/LuaRecipe.html#LuaRecipe.products Online documentation}
19739
19935
  */
19740
19936
  readonly products: Product[]
@@ -19847,12 +20043,22 @@ interface LuaRecipePrototype {
19847
20043
  */
19848
20044
  readonly category: string
19849
20045
  /**
19850
- * Ingredients for this recipe.
20046
+ * The ingredients to this recipe.
20047
+ * @example The ingredients of `"advanced-oil-processing"` would look like this:
20048
+ *
20049
+ * ```
20050
+ * {{type="fluid", name="crude-oil", amount=100}, {type="fluid", name="water", amount=50}}
20051
+ * ```
19851
20052
  * @see {@link https://lua-api.factorio.com/latest/LuaRecipePrototype.html#LuaRecipePrototype.ingredients Online documentation}
19852
20053
  */
19853
20054
  readonly ingredients: Ingredient[]
19854
20055
  /**
19855
- * The results of this recipe.
20056
+ * The results/products of this recipe.
20057
+ * @example The products of `"advanced-oil-processing"` would look like this:
20058
+ *
20059
+ * ```
20060
+ * {{type="fluid", name="heavy-oil", amount=25}, {type="fluid", name="light-oil", amount=45}, {type="fluid", name="petroleum-gas", amount=55}}
20061
+ * ```
19856
20062
  * @see {@link https://lua-api.factorio.com/latest/LuaRecipePrototype.html#LuaRecipePrototype.products Online documentation}
19857
20063
  */
19858
20064
  readonly products: Product[]
@@ -20344,6 +20550,10 @@ interface LuaRendering {
20344
20550
  * Only used if `orientation_target` is a LuaEntity.
20345
20551
  */
20346
20552
  readonly orientation_target_offset?: Vector
20553
+ /**
20554
+ * Only used if `orientation_target` is a LuaEntity.
20555
+ */
20556
+ readonly use_target_orientation?: boolean
20347
20557
  readonly surface: SurfaceIdentification
20348
20558
  /**
20349
20559
  * In ticks. Defaults to living forever.
@@ -20409,6 +20619,10 @@ interface LuaRendering {
20409
20619
  * Only used if `orientation_target` is a LuaEntity.
20410
20620
  */
20411
20621
  readonly orientation_target_offset?: Vector
20622
+ /**
20623
+ * Only used if `orientation_target` is a LuaEntity.
20624
+ */
20625
+ readonly use_target_orientation?: boolean
20412
20626
  /**
20413
20627
  * Offsets the center of the sprite if `orientation_target` is given. This offset will rotate together with the sprite.
20414
20628
  */
@@ -20545,6 +20759,10 @@ interface LuaRendering {
20545
20759
  * Only used if `orientation_target` is a LuaEntity.
20546
20760
  */
20547
20761
  readonly orientation_target_offset?: Vector
20762
+ /**
20763
+ * Only used if `orientation_target` is a LuaEntity.
20764
+ */
20765
+ readonly use_target_orientation?: boolean
20548
20766
  /**
20549
20767
  * Offsets the center of the animation if `orientation_target` is given. This offset will rotate together with the animation.
20550
20768
  */
@@ -20596,13 +20814,13 @@ interface LuaRendering {
20596
20814
  is_valid(id: uint64): boolean
20597
20815
  /**
20598
20816
  * Gets an array of all valid object ids.
20599
- * @param mod_name If provided, get only the render objects created by this mod.
20817
+ * @param mod_name If provided, get only the render objects created by this mod. An empty string (`""`) refers to all objects not belonging to a mod, such as those created using console commands.
20600
20818
  * @see {@link https://lua-api.factorio.com/latest/LuaRendering.html#LuaRendering.get_all_ids Online documentation}
20601
20819
  */
20602
20820
  get_all_ids(mod_name?: string): uint64[]
20603
20821
  /**
20604
- * Destroys all render objects.
20605
- * @param mod_name If provided, only the render objects created by this mod are destroyed.
20822
+ * Destroys all render objects. Passing an empty string (`""`)
20823
+ * @param mod_name If provided, only the render objects created by this mod are destroyed. An empty string (`""`) refers to all objects not belonging to a mod, such as those created using console commands.
20606
20824
  * @see {@link https://lua-api.factorio.com/latest/LuaRendering.html#LuaRendering.clear Online documentation}
20607
20825
  */
20608
20826
  clear(mod_name?: string): void
@@ -20687,6 +20905,17 @@ interface LuaRendering {
20687
20905
  * @see {@link https://lua-api.factorio.com/latest/LuaRendering.html#LuaRendering.set_only_in_alt_mode Online documentation}
20688
20906
  */
20689
20907
  set_only_in_alt_mode(id: uint64, only_in_alt_mode: boolean): void
20908
+ /**
20909
+ * Get whether this uses the target orientation.
20910
+ * @returns `nil` if the object is not a sprite, polygon, or animation.
20911
+ * @see {@link https://lua-api.factorio.com/latest/LuaRendering.html#LuaRendering.get_use_target_orientation Online documentation}
20912
+ */
20913
+ get_use_target_orientation(id: uint64): boolean | nil
20914
+ /**
20915
+ * Set whether this uses the target orientation.
20916
+ * @see {@link https://lua-api.factorio.com/latest/LuaRendering.html#LuaRendering.set_use_target_orientation Online documentation}
20917
+ */
20918
+ set_use_target_orientation(id: uint64, use_target_orientation: boolean): void
20690
20919
  /**
20691
20920
  * Get the color or tint of the object with this id.
20692
20921
  *
@@ -21346,8 +21575,15 @@ interface LuaRoboportControlBehavior extends LuaControlBehavior {
21346
21575
  */
21347
21576
  interface LuaSettings {
21348
21577
  /**
21349
- * Gets the current per-player settings for the given player, indexed by prototype name. Returns the same structure as {@link LuaPlayer#mod_settings LuaPlayer::mod_settings}.
21350
- * @remarks This table will become invalid if its associated player does.
21578
+ * Gets the current per-player settings for the given player, indexed by prototype name. Returns the same structure as {@link LuaPlayer#mod_settings LuaPlayer::mod_settings}. This table becomes invalid if its associated player does.
21579
+ *
21580
+ * Even though this attribute is marked as read-only, individual settings can be changed by overwriting their {@link ModSetting} table. Mods can only change their own settings. Using the in-game console, all player settings can be changed.
21581
+ * @example
21582
+ *
21583
+ * ```
21584
+ * -- Change the value of the "active_lifestyle" setting
21585
+ * settings.get_player_settings(player_index)["active_lifestyle"] = {value = true}
21586
+ * ```
21351
21587
  * @see {@link https://lua-api.factorio.com/latest/LuaSettings.html#LuaSettings.get_player_settings Online documentation}
21352
21588
  */
21353
21589
  get_player_settings(player: PlayerIdentification): LuaCustomTable<string, ModSetting>
@@ -21359,14 +21595,14 @@ interface LuaSettings {
21359
21595
  /**
21360
21596
  * The current global mod settings, indexed by prototype name.
21361
21597
  *
21362
- * Even though these are marked as read-only, they can be changed by overwriting individual {@link ModSetting} tables in the custom table. Mods can only change their own settings. Using the in-game console, all global settings can be changed.
21598
+ * Even though this attribute is marked as read-only, individual settings can be changed by overwriting their {@link ModSetting} table. Mods can only change their own settings. Using the in-game console, all player settings can be changed.
21363
21599
  * @see {@link https://lua-api.factorio.com/latest/LuaSettings.html#LuaSettings.global Online documentation}
21364
21600
  */
21365
21601
  readonly global: LuaCustomTable<string, ModSetting>
21366
21602
  /**
21367
21603
  * The default player mod settings for this map, indexed by prototype name.
21368
21604
  *
21369
- * Even though these are marked as read-only, they can be changed by overwriting individual {@link ModSetting} tables in the custom table. Mods can only change their own settings. Using the in-game console, all player settings can be changed.
21605
+ * Even though this attribute is marked as read-only, individual settings can be changed by overwriting their {@link ModSetting} table. Mods can only change their own settings. Using the in-game console, all player settings can be changed.
21370
21606
  * @see {@link https://lua-api.factorio.com/latest/LuaSettings.html#LuaSettings.player Online documentation}
21371
21607
  */
21372
21608
  readonly player: LuaCustomTable<string, ModSetting>
@@ -22263,7 +22499,7 @@ interface BaseSurfaceCreateEntity {
22263
22499
  */
22264
22500
  readonly target?: LuaEntity | (MapPosition | MapPositionArray)
22265
22501
  /**
22266
- * Source entity. Used for beams and highlight-boxes.
22502
+ * Source entity. Used for beams, projectiles, and highlight-boxes.
22267
22503
  */
22268
22504
  readonly source?: LuaEntity | (MapPosition | MapPositionArray)
22269
22505
  /**
@@ -22274,6 +22510,10 @@ interface BaseSurfaceCreateEntity {
22274
22510
  * If given set the last_user to this player. If fast_replace is true simulate fast replace using this player.
22275
22511
  */
22276
22512
  readonly player?: PlayerIdentification
22513
+ /**
22514
+ * If fast_replace is true simulate fast replace using this character.
22515
+ */
22516
+ readonly character?: LuaEntity
22277
22517
  /**
22278
22518
  * If false while fast_replace is true and player is nil any items from fast-replacing will be deleted instead of dropped on the ground.
22279
22519
  */
@@ -22704,7 +22944,7 @@ interface LuaSurface {
22704
22944
  readonly force?: ForceIdentification
22705
22945
  }): boolean
22706
22946
  /**
22707
- * Find a specific entity at a specific position.
22947
+ * Find an entity of the given type at the given position. This checks both the exact position and the bounding box of the entity.
22708
22948
  * @param entity Entity to look for.
22709
22949
  * @param position Coordinates to look at.
22710
22950
  * @returns `nil` if no such entity is found.
@@ -23225,6 +23465,16 @@ interface LuaSurface {
23225
23465
  position: MapPosition | MapPositionArray,
23226
23466
  force: ForceIdentification
23227
23467
  ): LuaLogisticNetwork | nil
23468
+ /**
23469
+ * Find the logistic network with a cell closest to a given position.
23470
+ * @param force Force the logistic network should belong to.
23471
+ * @returns The found network or `nil` if no such network was found.
23472
+ * @see {@link https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_closest_logistic_network_by_position Online documentation}
23473
+ */
23474
+ find_closest_logistic_network_by_position(
23475
+ position: MapPosition | MapPositionArray,
23476
+ force: ForceIdentification
23477
+ ): LuaLogisticNetwork | nil
23228
23478
  /**
23229
23479
  * Finds all of the logistics networks whose construction area intersects with the given position.
23230
23480
  * @param force Force the logistic networks should belong to.
@@ -23368,11 +23618,18 @@ interface LuaSurface {
23368
23618
  * Gets all tiles of the given types that are connected horizontally or vertically to the given tile position including the given tile position.
23369
23619
  * @param position The tile position to start at.
23370
23620
  * @param tiles The tiles to search for.
23621
+ * @param include_diagonal Include tiles that are connected diagonally.
23622
+ * @param area The area to find connected tiles in. If provided the start position must be in this area.
23371
23623
  * @returns The resulting set of tiles.
23372
23624
  * @remarks This won't find tiles in non-generated chunks.
23373
23625
  * @see {@link https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.get_connected_tiles Online documentation}
23374
23626
  */
23375
- get_connected_tiles(position: TilePosition | TilePositionArray, tiles: readonly string[]): TilePosition[]
23627
+ get_connected_tiles(
23628
+ position: TilePosition | TilePositionArray,
23629
+ tiles: readonly string[],
23630
+ include_diagonal?: boolean,
23631
+ area?: BoundingBoxWrite | BoundingBoxArray
23632
+ ): TilePosition[]
23376
23633
  /**
23377
23634
  * **Raised events:**
23378
23635
  * - {@link OnPreChunkDeletedEvent on_pre_chunk_deleted} _future_tick_
@@ -23673,7 +23930,7 @@ interface LuaSurface {
23673
23930
  */
23674
23931
  readonly can_open_gates?: boolean
23675
23932
  /**
23676
- * Defines how coarse the pathfinder's grid is. Smaller values mean a coarser grid (negative numbers allowed). Allowed values are from -8 to 8. Defaults to `0`.
23933
+ * Defines how coarse the pathfinder's grid is, where smaller values mean a coarser grid. Defaults to `0`, which equals a resolution of `1x1` tiles, centered on tile centers. Values range from `-8` to `8` inclusive, where each integer increment doubles/halves the resolution. So, a resolution of `-8` equals a grid of `256x256` tiles, and a resolution of `8` equals `1/256` of a tile.
23677
23934
  */
23678
23935
  readonly path_resolution_modifier?: int
23679
23936
  /**
@@ -23827,12 +24084,12 @@ interface LuaSurface {
23827
24084
  */
23828
24085
  name: string
23829
24086
  /**
23830
- * Unique ID associated with this surface.
24087
+ * This surface's index in {@link LuaGameScript#surfaces LuaGameScript::surfaces} (unique ID). It is assigned when a surface is created, and remains so until it is {@link OnSurfaceDeletedEvent deleted}. Indexes of deleted surfaces can be reused.
23831
24088
  * @see {@link https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.index Online documentation}
23832
24089
  */
23833
24090
  readonly index: SurfaceIndex
23834
24091
  /**
23835
- * The generation settings for this surface. These can be modified to after surface generation, but note that this will not retroactively update the surface. To manually adjust it, {@link LuaSurface#regenerate_entity LuaSurface::regenerate_entity}, {@link LuaSurface#regenerate_decorative LuaSurface::regenerate_decorative} and {@link LuaSurface#delete_chunk LuaSurface::delete_chunk} can be used.
24092
+ * The generation settings for this surface. These can be modified after surface generation, but note that this will not retroactively update the surface. To manually regenerate it, {@link LuaSurface#regenerate_entity LuaSurface::regenerate_entity}, {@link LuaSurface#regenerate_decorative LuaSurface::regenerate_decorative}, and {@link LuaSurface#delete_chunk LuaSurface::delete_chunk} can be used.
23836
24093
  * @see {@link https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.map_gen_settings Online documentation}
23837
24094
  */
23838
24095
  get map_gen_settings(): MapGenSettings
@@ -23858,7 +24115,7 @@ interface LuaSurface {
23858
24115
  */
23859
24116
  readonly darkness: float
23860
24117
  /**
23861
- * Current wind speed.
24118
+ * Current wind speed in tiles per tick.
23862
24119
  * @see {@link https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.wind_speed Online documentation}
23863
24120
  */
23864
24121
  wind_speed: double
@@ -24042,7 +24299,7 @@ interface LuaTechnology {
24042
24299
  */
24043
24300
  level: uint
24044
24301
  /**
24045
- * The count formula used for this infinite research. `nil` if this research isn't infinite.
24302
+ * The count formula, if this research has any. See the {@linkplain https://wiki.factorio.com/Prototype/Technology#Technology_data wiki} for details.
24046
24303
  * @see {@link https://lua-api.factorio.com/latest/LuaTechnology.html#LuaTechnology.research_unit_count_formula Online documentation}
24047
24304
  */
24048
24305
  readonly research_unit_count_formula?: string
@@ -24145,7 +24402,7 @@ interface LuaTechnologyPrototype {
24145
24402
  */
24146
24403
  readonly max_level: uint
24147
24404
  /**
24148
- * The count formula used for this infinite research. `nil` if this research isn't infinite.
24405
+ * The count formula, if this research has any. See the {@linkplain https://wiki.factorio.com/Prototype/Technology#Technology_data wiki} for details.
24149
24406
  * @see {@link https://lua-api.factorio.com/latest/LuaTechnologyPrototype.html#LuaTechnologyPrototype.research_unit_count_formula Online documentation}
24150
24407
  */
24151
24408
  readonly research_unit_count_formula?: string
@@ -24322,10 +24579,10 @@ interface LuaTilePrototype {
24322
24579
  */
24323
24580
  readonly next_direction?: LuaTilePrototype
24324
24581
  /**
24325
- * Items that when placed will produce this tile. It is a dictionary indexed by the item prototype name. `nil` (instead of an empty table) if no items can place this tile.
24582
+ * Items that when placed will produce this tile, if any. Construction bots will choose the first item in the list to build this tile.
24326
24583
  * @see {@link https://lua-api.factorio.com/latest/LuaTilePrototype.html#LuaTilePrototype.items_to_place_this Online documentation}
24327
24584
  */
24328
- readonly items_to_place_this: SimpleItemStack[] | nil
24585
+ readonly items_to_place_this?: ItemStackDefinition[]
24329
24586
  /**
24330
24587
  * False if this tile is not allowed in blueprints regardless of the ability to build it.
24331
24588
  * @see {@link https://lua-api.factorio.com/latest/LuaTilePrototype.html#LuaTilePrototype.can_be_part_of_blueprint Online documentation}