factorio-types 0.0.33 → 0.0.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/classes.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  // Factorio API reference https://lua-api.factorio.com/latest/index.html
3
3
  // Generated from JSON source https://lua-api.factorio.com/latest/runtime-api.json
4
4
  // Definition source https://github.com/sguest/factorio-types
5
- // Factorio version 1.1.77
5
+ // Factorio version 1.1.80
6
6
  // API version 3
7
7
 
8
8
  /**
@@ -35,7 +35,7 @@ interface LuaAISettings {
35
35
  readonly object_name: string
36
36
 
37
37
  /**
38
- * The pathing resolution modifier, must be between -8 and 8.
38
+ * 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.
39
39
  */
40
40
  path_resolution_modifier: number
41
41
 
@@ -310,9 +310,11 @@ interface LuaBootstrap {
310
310
  handler: (this: void) => any | null): void
311
311
 
312
312
  /**
313
- * 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 | LuaGameScript} is not available. The {@link global | global} table can be accessed and is safe to read from, but not write to, as doing so will lead to an error.
313
+ * 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.
314
314
  *
315
- * The only legitimate uses of this event are the following:
315
+ * 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 | LuaGameScript} is not available. The {@link global | global} table can be accessed and is safe to read from, but not write to, as doing so will lead to an error.
316
+ *
317
+ * The only legitimate uses of this event are these:
316
318
  * - Re-setup {@link metatables | https://www.lua.org/pil/13.html} as they are not persisted through the save/load cycle.
317
319
  * - Re-setup conditional event handlers, meaning subscribing to an event only when some condition is met to save processing time.
318
320
  * - Create local references to data stored in the {@link global | global} table.
@@ -364,6 +366,7 @@ interface LuaBootstrap {
364
366
  * - {@link script_raised_built | script_raised_built}
365
367
  * - {@link script_raised_destroy | script_raised_destroy}
366
368
  * - {@link script_raised_revive | script_raised_revive}
369
+ * - {@link script_raised_teleported | script_raised_teleported}
367
370
  * - {@link script_raised_set_tiles | script_raised_set_tiles}
368
371
  * @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.
369
372
  * @param event - ID of the event to raise.
@@ -474,6 +477,22 @@ interface LuaBootstrap {
474
477
  *
475
478
  * @param metatable - The metatable to register.
476
479
  * @param name - The name of this metatable. Names must be unique per mod.
480
+ * @example
481
+ * 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 [global](global).
482
+ * ```
483
+ * local metatable = {
484
+ * __index = function(key)
485
+ * return "no value for key " .. key
486
+ * end
487
+ * }
488
+ * script.register_metatable("my_metatable", metatable)
489
+ * ```
490
+ * This previously defined `metatable` can then be set on any table as usual:
491
+ * ```
492
+ * local table = {key="value"}
493
+ * setmetatable(table, metatable)
494
+ * ```
495
+ *
477
496
  */
478
497
  register_metatable(this: void,
479
498
  name: string,
@@ -587,7 +606,7 @@ interface LuaBurner {
587
606
  readonly burnt_result_inventory: LuaInventory
588
607
 
589
608
  /**
590
- * The currently burning item.
609
+ * The currently burning item. Writing `nil` will void the currently burning item without producing a {@link LuaBurner::burnt_result | LuaBurner::burnt_result}.
591
610
  * @remarks
592
611
  * Writing to this automatically handles correcting {@link LuaBurner::remaining_burning_fuel | LuaBurner::remaining_burning_fuel}.
593
612
  *
@@ -882,11 +901,12 @@ interface LuaConstantCombinatorControlBehavior extends LuaControlBehavior {
882
901
  help(this: void): void
883
902
 
884
903
  /**
885
- * Sets the signal at the given index
904
+ * Sets the signal at the given index.
905
+ * @param signal - Passing `nil` clears the signal.
886
906
  */
887
907
  set_signal(this: void,
888
908
  index: number,
889
- signal: Signal): void
909
+ signal?: Signal): void
890
910
 
891
911
  /**
892
912
  * Turns this constant combinator on and off.
@@ -906,7 +926,7 @@ interface LuaConstantCombinatorControlBehavior extends LuaControlBehavior {
906
926
  parameters?: ConstantCombinatorParameters[]
907
927
 
908
928
  /**
909
- * The number of signals this constant combinator supports
929
+ * The number of signals this constant combinator supports.
910
930
  */
911
931
  readonly signals_count: number
912
932
 
@@ -1370,7 +1390,7 @@ interface LuaControl {
1370
1390
  force: ForceIdentification
1371
1391
 
1372
1392
  /**
1373
- * Unique ID associated with the force of this entity.
1393
+ * Unique {@link index | LuaForce::index} (ID) associated with the force of this entity.
1374
1394
  */
1375
1395
  readonly force_index: number
1376
1396
 
@@ -1392,18 +1412,18 @@ interface LuaControl {
1392
1412
  /**
1393
1413
  * Current mining state.
1394
1414
  * @remarks
1395
- * 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}.
1415
+ * 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}.
1396
1416
  *
1397
1417
  */
1398
1418
  mining_state: {
1399
1419
 
1400
1420
  /**
1401
- * Whether the player is mining at all
1421
+ * Whether the player is mining at all.
1402
1422
  */
1403
1423
  mining: boolean,
1404
1424
 
1405
1425
  /**
1406
- * What tiles the player is mining; only used when the player is mining tiles (holding a tile in the cursor).
1426
+ * What location the player is mining. Only relevant if `mining` is `true`.
1407
1427
  */
1408
1428
  position?: MapPosition
1409
1429
  }
@@ -1488,7 +1508,7 @@ interface LuaControl {
1488
1508
  readonly surface: LuaSurface
1489
1509
 
1490
1510
  /**
1491
- * Unique ID associated with the surface this entity is currently on.
1511
+ * Unique {@link index | LuaSurface::index} (ID) associated with the surface this entity is currently on.
1492
1512
  */
1493
1513
  readonly surface_index: number
1494
1514
 
@@ -2151,6 +2171,19 @@ interface LuaEntity extends LuaControl {
2151
2171
  disconnect_rolling_stock(this: void,
2152
2172
  direction: defines.rail_direction): void
2153
2173
 
2174
+ /**
2175
+ * Returns a table with all entities affected by this beacon
2176
+ * @remarks
2177
+ * Applies to subclasses: Beacon
2178
+ *
2179
+ */
2180
+ get_beacon_effect_receivers(this: void): void
2181
+
2182
+ /**
2183
+ * 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)
2184
+ */
2185
+ get_beacons(this: void): void
2186
+
2154
2187
  /**
2155
2188
  * Get the source of this beam.
2156
2189
  * @remarks
@@ -2443,7 +2476,7 @@ interface LuaEntity extends LuaControl {
2443
2476
  direction: defines.rail_direction): void
2444
2477
 
2445
2478
  /**
2446
- * Current recipe being assembled by this machine or `nil` if no recipe is set.
2479
+ * Current recipe being assembled by this machine, if any.
2447
2480
  * @remarks
2448
2481
  * Applies to subclasses: CraftingMachine
2449
2482
  *
@@ -2807,13 +2840,13 @@ interface LuaEntity extends LuaControl {
2807
2840
  /**
2808
2841
  * Sets the driver of this vehicle.
2809
2842
  * @remarks
2810
- * This differs over {@link LuaEntity::set_passenger | LuaEntity::set_passenger} in that the passenger can't drive the vehicle.
2843
+ * This differs from {@link LuaEntity::set_passenger | LuaEntity::set_passenger} in that the passenger can't drive the vehicle.
2811
2844
  * Applies to subclasses: Vehicle
2812
2845
  *
2813
- * @param driver - The new driver or `nil` to eject the current driver if any.
2846
+ * @param driver - The new driver. Writing `nil` ejects the current driver, if any.
2814
2847
  */
2815
2848
  set_driver(this: void,
2816
- driver: LuaEntity | PlayerIdentification): void
2849
+ driver?: LuaEntity | PlayerIdentification): void
2817
2850
 
2818
2851
  /**
2819
2852
  * Set the filter for a slot in an inserter, loader, or logistic storage container.
@@ -2862,22 +2895,23 @@ interface LuaEntity extends LuaControl {
2862
2895
  /**
2863
2896
  * Sets the passenger of this car or spidertron.
2864
2897
  * @remarks
2865
- * This differs over {@link LuaEntity::get_driver | LuaEntity::get_driver} in that the passenger can't drive the car.
2898
+ * This differs from {@link LuaEntity::get_driver | LuaEntity::get_driver} in that the passenger can't drive the car.
2866
2899
  * Applies to subclasses: Car,SpiderVehicle
2867
2900
  *
2901
+ * @param passenger - The new passenger. Writing `nil` ejects the current passenger, if any.
2868
2902
  */
2869
2903
  set_passenger(this: void,
2870
- passenger: LuaEntity | PlayerIdentification): void
2904
+ passenger?: LuaEntity | PlayerIdentification): void
2871
2905
 
2872
2906
  /**
2873
- * Sets the current recipe in this assembly machine.
2907
+ * Sets the given recipe in this assembly machine.
2874
2908
  * @remarks
2875
2909
  * Applies to subclasses: AssemblingMachine
2876
2910
  *
2877
- * @param recipe - The new recipe or `nil` to clear the recipe.
2911
+ * @param recipe - The new recipe. Writing `nil` clears the recipe, if any.
2878
2912
  */
2879
2913
  set_recipe(this: void,
2880
- recipe: string | LuaRecipe): void
2914
+ recipe?: string | LuaRecipe): void
2881
2915
 
2882
2916
  /**
2883
2917
  * Set a logistic requester slot.
@@ -3019,7 +3053,7 @@ interface LuaEntity extends LuaControl {
3019
3053
  auto_launch: boolean
3020
3054
 
3021
3055
  /**
3022
- * Destination of this spidertron's autopilot, if any.
3056
+ * Destination of this spidertron's autopilot, if any. Writing `nil` clears all destinations.
3023
3057
  * @remarks
3024
3058
  * Applies to subclasses: SpiderVehicle
3025
3059
  *
@@ -3042,6 +3076,11 @@ interface LuaEntity extends LuaControl {
3042
3076
  */
3043
3077
  backer_name?: string
3044
3078
 
3079
+ /**
3080
+ * Number of beacons affecting this effect receiver. Can only be used when the entity has an effect receiver (AssemblingMachine, Furnace, Lab, MiningDrills)
3081
+ */
3082
+ readonly beacons_count?: number
3083
+
3045
3084
  /**
3046
3085
  * The belt connectable neighbours of this belt connectable entity. Only entities that input to or are outputs of this entity. Does not contain the other end of an underground belt, see {@link LuaEntity::neighbours | LuaEntity::neighbours} for that. This is a dictionary with `"inputs"`, `"outputs"` entries that are arrays of transport belt connectable entities, or empty tables if no entities.
3047
3086
  * @remarks
@@ -3362,7 +3401,7 @@ interface LuaEntity extends LuaControl {
3362
3401
  readonly energy_generated_last_tick: number
3363
3402
 
3364
3403
  /**
3365
- * The label on this entity, if any. `nil` if this is not a spider-vehicule.
3404
+ * The label on this spider-vehicle entity, if any. `nil` if this is not a spider-vehicle.
3366
3405
  */
3367
3406
  entity_label?: string
3368
3407
 
@@ -4166,7 +4205,9 @@ interface LuaEntity extends LuaControl {
4166
4205
  readonly unit_group?: LuaUnitGroup
4167
4206
 
4168
4207
  /**
4169
- * A universally unique number identifying this entity for the lifetime of the save. Only entities inheriting from {@link EntityWithOwner | https://wiki.factorio.com/Prototype/EntityWithOwner}, as well as {@link ItemRequestProxy | https://wiki.factorio.com/Prototype/ItemRequestProxy} and {@link EntityGhost | https://wiki.factorio.com/Prototype/EntityGhost} are assigned a unit number. `nil` if this entity doesn't have a unit number.
4208
+ * A unique number identifying this entity for the lifetime of the save. These are allocated sequentially, and not re-used (until overflow).
4209
+ *
4210
+ * Only entities inheriting from {@link EntityWithOwner | https://wiki.factorio.com/Prototype/EntityWithOwner}, as well as {@link ItemRequestProxy | https://wiki.factorio.com/Prototype/ItemRequestProxy} and {@link EntityGhost | https://wiki.factorio.com/Prototype/EntityGhost} are assigned a unit number. Returns `nil` otherwise.
4170
4211
  */
4171
4212
  readonly unit_number?: number
4172
4213
 
@@ -4962,7 +5003,7 @@ interface LuaEntityPrototype {
4962
5003
  readonly idle_energy_usage?: number
4963
5004
 
4964
5005
  /**
4965
- * A vector of the gun prototypes of this car, spider vehicule, or artillery wagon or turret.
5006
+ * A vector of the gun prototypes of this car, spider vehicle, artillery wagon, or turret.
4966
5007
  * @remarks
4967
5008
  * Applies to subclasses: Car,SpiderVehicle,ArtilleryTurret,ArtilleryWagon
4968
5009
  *
@@ -5126,9 +5167,9 @@ interface LuaEntityPrototype {
5126
5167
  readonly item_slot_count?: number
5127
5168
 
5128
5169
  /**
5129
- * 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.
5170
+ * Items that when placed will produce this entity, if any. Construction bots will choose the first item in the list to build this entity.
5130
5171
  */
5131
- readonly items_to_place_this?: SimpleItemStack[]
5172
+ readonly items_to_place_this?: ItemStackDefinition[]
5132
5173
 
5133
5174
  /**
5134
5175
  * The item prototype names that are the inputs of this lab prototype.
@@ -5326,7 +5367,7 @@ interface LuaEntityPrototype {
5326
5367
  /**
5327
5368
  * The default maximum power output of this generator prototype.
5328
5369
  * @remarks
5329
- * Applies to subclasses: Generator
5370
+ * Applies to subclasses: BurnerGenerator,Generator
5330
5371
  *
5331
5372
  */
5332
5373
  readonly max_power_output?: number
@@ -6208,7 +6249,7 @@ interface LuaEquipmentGrid {
6208
6249
  readonly height: number
6209
6250
 
6210
6251
  /**
6211
- * True if this movement bonus equipment is turned off, otherwise false.
6252
+ * Whether this grid's equipment movement bonus is active.
6212
6253
  */
6213
6254
  inhibit_movement_bonus: boolean
6214
6255
 
@@ -7406,7 +7447,7 @@ interface LuaForce {
7406
7447
  ghost_time_to_live: number
7407
7448
 
7408
7449
  /**
7409
- * Unique ID associated with this force.
7450
+ * 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 merged | on_forces_merged} (ie. deleted). Indexes of merged forces can be reused.
7410
7451
  */
7411
7452
  readonly index: number
7412
7453
 
@@ -7786,7 +7827,7 @@ interface LuaGameScript {
7786
7827
  variables?: {[key: string]: number}): void
7787
7828
 
7788
7829
  /**
7789
- * 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.
7830
+ * 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.
7790
7831
  */
7791
7832
  force_crc(this: void): void
7792
7833
 
@@ -8792,7 +8833,7 @@ interface LuaGui {
8792
8833
  * - `"progressbar"`: A partially filled bar that can be used to indicate progress.
8793
8834
  * - `"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.
8794
8835
  * - `"textfield"`: A single-line box the user can type into. Relevant events: {@link on_gui_text_changed | on_gui_text_changed}, {@link on_gui_confirmed | on_gui_confirmed}
8795
- * - `"radiobutton"`: A clickable element that is functionally identical to a `checkbox`, but has a circular appearance. Relevant event: {@link on_gui_checked_state_changed | on_gui_checked_state_changed}
8836
+ * - `"radiobutton"`: An element that is similar to a `checkbox`, but with a circular appearance. Clicking a selected radio button will not deselect it. Radio buttons are not linked to each other in any way. Relevant event: {@link on_gui_checked_state_changed | on_gui_checked_state_changed}
8796
8837
  * - `"sprite"`: An element that shows an image.
8797
8838
  * - `"scroll-pane"`: An invisible element that is similar to a `flow`, but has the ability to show and use scroll bars.
8798
8839
  * - `"drop-down"`: A drop-down containing strings of text. Relevant event: {@link on_gui_selection_state_changed | on_gui_selection_state_changed}
@@ -9488,6 +9529,11 @@ interface LuaGuiElement {
9488
9529
  */
9489
9530
  position: MapPosition
9490
9531
 
9532
+ /**
9533
+ * Whether this element will raise {@link on_gui_hover | on_gui_hover} and {@link on_gui_leave | on_gui_leave}.
9534
+ */
9535
+ raise_hover_events: boolean
9536
+
9491
9537
  /**
9492
9538
  * Whether this text-box is read-only. Defaults to `false`.
9493
9539
  * @remarks
@@ -11136,6 +11182,15 @@ interface LuaItemStack {
11136
11182
  transfer_stack(this: void,
11137
11183
  stack: ItemStackIdentification): void
11138
11184
 
11185
+ /**
11186
+ * Use the capsule item with the entity as the source, targeting the given position.
11187
+ * @param entity - The entity to use the capsule item with.
11188
+ * @param target_position - The position to use the capsule item with.
11189
+ */
11190
+ use_capsule(this: void,
11191
+ entity: LuaEntity,
11192
+ target_position: MapPosition): void
11193
+
11139
11194
  /**
11140
11195
  * The active blueprint index for this blueprint book. `nil` if this blueprint book is empty.
11141
11196
  * @remarks
@@ -11224,7 +11279,7 @@ interface LuaItemStack {
11224
11279
  * Applies to subclasses: BlueprintItem
11225
11280
  *
11226
11281
  */
11227
- readonly default_icons: BlueprintItemIcon[]
11282
+ readonly default_icons: BlueprintSignalIcon[]
11228
11283
 
11229
11284
  /**
11230
11285
  * Durability of the contained item. Automatically capped at the item's maximum durability.
@@ -12998,7 +13053,7 @@ interface LuaPlayer extends LuaControl {
12998
13053
  hand_location?: ItemStackLocation
12999
13054
 
13000
13055
  /**
13001
- * This player's unique index in {@link LuaGameScript::players | LuaGameScript::players}. It is given to them when they are {@link created | on_player_created} and remains assigned to them until they are {@link removed | on_player_removed}.
13056
+ * 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 connected | LuaPlayer::connected}) until the player is irreversably {@link removed | on_player_removed}. Indexes of removed players can be reused.
13002
13057
  */
13003
13058
  readonly index: number
13004
13059
 
@@ -13023,9 +13078,14 @@ interface LuaPlayer extends LuaControl {
13023
13078
  minimap_enabled: boolean
13024
13079
 
13025
13080
  /**
13026
- * 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}.
13027
- * @remarks
13028
- * This table will become invalid if its associated player does.
13081
+ * 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.
13082
+ *
13083
+ * Even though this attribute is marked as read-only, individual settings can be changed by overwriting their {@link ModSetting | ModSetting} table. Mods can only change their own settings. Using the in-game console, all player settings can be changed.
13084
+ * @example
13085
+ * ```
13086
+ * -- Change the value of the "active_lifestyle" setting
13087
+ * player.mod_settings["active_lifestyle"] = {value = true}
13088
+ * ```
13029
13089
  *
13030
13090
  */
13031
13091
  readonly mod_settings: {[key: string]: ModSetting}
@@ -13429,17 +13489,11 @@ interface LuaRecipe {
13429
13489
  hidden_from_flow_stats: boolean
13430
13490
 
13431
13491
  /**
13432
- * Ingredients for this recipe.
13492
+ * The ingredients to this recipe.
13433
13493
  * @example
13434
- * What the "steel-chest" recipe would return
13494
+ * The ingredients of `"advanced-oil-processing"` would look like this:
13435
13495
  * ```
13436
- * {{type="item", name="steel-plate", amount=8}}
13437
- * ```
13438
- *
13439
- * @example
13440
- * What the "advanced-oil-processing" recipe would return
13441
- * ```
13442
- * {{type="fluid", name="crude-oil", amount=10}, {type="fluid", name="water", amount=5}}
13496
+ * {{type="fluid", name="crude-oil", amount=100}, {type="fluid", name="water", amount=50}}
13443
13497
  * ```
13444
13498
  *
13445
13499
  */
@@ -13468,7 +13522,13 @@ interface LuaRecipe {
13468
13522
  readonly order: string
13469
13523
 
13470
13524
  /**
13471
- * The results of this recipe.
13525
+ * The results/products of this recipe.
13526
+ * @example
13527
+ * The products of `"advanced-oil-processing"` would look like this:
13528
+ * ```
13529
+ * {{type="fluid", name="heavy-oil", amount=25}, {type="fluid", name="light-oil", amount=45}, {type="fluid", name="petroleum-gas", amount=55}}
13530
+ * ```
13531
+ *
13472
13532
  */
13473
13533
  readonly products: Product[]
13474
13534
 
@@ -13604,7 +13664,13 @@ interface LuaRecipePrototype {
13604
13664
  readonly hidden_from_player_crafting: boolean
13605
13665
 
13606
13666
  /**
13607
- * Ingredients for this recipe.
13667
+ * The ingredients to this recipe.
13668
+ * @example
13669
+ * The ingredients of `"advanced-oil-processing"` would look like this:
13670
+ * ```
13671
+ * {{type="fluid", name="crude-oil", amount=100}, {type="fluid", name="water", amount=50}}
13672
+ * ```
13673
+ *
13608
13674
  */
13609
13675
  readonly ingredients: Ingredient[]
13610
13676
 
@@ -13641,7 +13707,13 @@ interface LuaRecipePrototype {
13641
13707
  readonly overload_multiplier: number
13642
13708
 
13643
13709
  /**
13644
- * The results of this recipe.
13710
+ * The results/products of this recipe.
13711
+ * @example
13712
+ * The products of `"advanced-oil-processing"` would look like this:
13713
+ * ```
13714
+ * {{type="fluid", name="heavy-oil", amount=25}, {type="fluid", name="light-oil", amount=45}, {type="fluid", name="petroleum-gas", amount=55}}
13715
+ * ```
13716
+ *
13645
13717
  */
13646
13718
  readonly products: Product[]
13647
13719
 
@@ -13747,8 +13819,8 @@ interface LuaRendering {
13747
13819
  id: number): void
13748
13820
 
13749
13821
  /**
13750
- * Destroys all render objects.
13751
- * @param mod_name - If provided, only the render objects created by this mod are destroyed.
13822
+ * Destroys all render objects. Passing an empty string (`""`)
13823
+ * @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.
13752
13824
  */
13753
13825
  clear(this: void,
13754
13826
  mod_name?: string): void
@@ -13774,6 +13846,7 @@ interface LuaRendering {
13774
13846
  * @param table.target - Center of the animation.
13775
13847
  * @param table.target_offset - Only used if `target` is a LuaEntity.
13776
13848
  * @param table.time_to_live - In ticks. Defaults to living forever.
13849
+ * @param table.use_target_orientation - Only used if `orientation_target` is a LuaEntity.
13777
13850
  * @param table.visible - If this is rendered to anyone at all. Defaults to true.
13778
13851
  * @param table.x_scale - Horizontal scale of the animation. Default is 1.
13779
13852
  * @param table.y_scale - Vertical scale of the animation. Default is 1.
@@ -13790,6 +13863,7 @@ interface LuaRendering {
13790
13863
  animation_offset?: number,
13791
13864
  orientation_target?: MapPosition | LuaEntity,
13792
13865
  orientation_target_offset?: Vector,
13866
+ use_target_orientation?: boolean,
13793
13867
  oriented_offset?: Vector,
13794
13868
  target: MapPosition | LuaEntity,
13795
13869
  target_offset?: Vector,
@@ -13958,6 +14032,7 @@ interface LuaRendering {
13958
14032
  * @param table.target - Acts like an offset applied to all vertices that are not set to an entity.
13959
14033
  * @param table.target_offset - Only used if `target` is a LuaEntity.
13960
14034
  * @param table.time_to_live - In ticks. Defaults to living forever.
14035
+ * @param table.use_target_orientation - Only used if `orientation_target` is a LuaEntity.
13961
14036
  * @param table.visible - If this is rendered to anyone at all. Defaults to true.
13962
14037
  */
13963
14038
  draw_polygon(this: void,
@@ -13969,6 +14044,7 @@ interface LuaRendering {
13969
14044
  orientation?: RealOrientation,
13970
14045
  orientation_target?: MapPosition | LuaEntity,
13971
14046
  orientation_target_offset?: Vector,
14047
+ use_target_orientation?: boolean,
13972
14048
  surface: SurfaceIdentification,
13973
14049
  time_to_live?: number,
13974
14050
  forces?: ForceIdentification[],
@@ -14021,6 +14097,7 @@ interface LuaRendering {
14021
14097
  * @param table.target - Center of the sprite.
14022
14098
  * @param table.target_offset - Only used if `target` is a LuaEntity.
14023
14099
  * @param table.time_to_live - In ticks. Defaults to living forever.
14100
+ * @param table.use_target_orientation - Only used if `orientation_target` is a LuaEntity.
14024
14101
  * @param table.visible - If this is rendered to anyone at all. Defaults to true.
14025
14102
  * @param table.x_scale - Horizontal scale of the sprite. Default is 1.
14026
14103
  * @param table.y_scale - Vertical scale of the sprite. Default is 1.
@@ -14047,6 +14124,7 @@ interface LuaRendering {
14047
14124
  render_layer?: RenderLayer,
14048
14125
  orientation_target?: MapPosition | LuaEntity,
14049
14126
  orientation_target_offset?: Vector,
14127
+ use_target_orientation?: boolean,
14050
14128
  oriented_offset?: Vector,
14051
14129
  target: MapPosition | LuaEntity,
14052
14130
  target_offset?: Vector,
@@ -14111,7 +14189,7 @@ interface LuaRendering {
14111
14189
 
14112
14190
  /**
14113
14191
  * Gets an array of all valid object ids.
14114
- * @param mod_name - If provided, get only the render objects created by this mod.
14192
+ * @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.
14115
14193
  */
14116
14194
  get_all_ids(this: void,
14117
14195
  mod_name?: string): void
@@ -14434,6 +14512,12 @@ interface LuaRendering {
14434
14512
  get_use_rich_text(this: void,
14435
14513
  id: number): void
14436
14514
 
14515
+ /**
14516
+ * Get whether this uses the target orientation.
14517
+ */
14518
+ get_use_target_orientation(this: void,
14519
+ id: number): void
14520
+
14437
14521
  /**
14438
14522
  * Get the vertical alignment of the text with this id.
14439
14523
  * @remarks
@@ -14885,6 +14969,13 @@ interface LuaRendering {
14885
14969
  id: number,
14886
14970
  use_rich_text: boolean): void
14887
14971
 
14972
+ /**
14973
+ * Set whether this uses the target orientation.
14974
+ */
14975
+ set_use_target_orientation(this: void,
14976
+ id: number,
14977
+ use_target_orientation: boolean): void
14978
+
14888
14979
  /**
14889
14980
  * Set the vertical alignment of the text with this id. Does nothing if this object is not a text.
14890
14981
  * @remarks
@@ -15029,9 +15120,14 @@ interface LuaRoboportControlBehavior extends LuaControlBehavior {
15029
15120
  */
15030
15121
  interface LuaSettings {
15031
15122
  /**
15032
- * 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}.
15033
- * @remarks
15034
- * This table will become invalid if its associated player does.
15123
+ * 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.
15124
+ *
15125
+ * Even though this attribute is marked as read-only, individual settings can be changed by overwriting their {@link ModSetting | ModSetting} table. Mods can only change their own settings. Using the in-game console, all player settings can be changed.
15126
+ * @example
15127
+ * ```
15128
+ * -- Change the value of the "active_lifestyle" setting
15129
+ * settings.get_player_settings(player_index)["active_lifestyle"] = {value = true}
15130
+ * ```
15035
15131
  *
15036
15132
  */
15037
15133
  get_player_settings(this: void,
@@ -15040,7 +15136,7 @@ interface LuaSettings {
15040
15136
  /**
15041
15137
  * The current global mod settings, indexed by prototype name.
15042
15138
  *
15043
- * Even though these are marked as read-only, they can be changed by overwriting individual {@link ModSetting | ModSetting} tables in the custom table. Mods can only change their own settings. Using the in-game console, all global settings can be changed.
15139
+ * Even though this attribute is marked as read-only, individual settings can be changed by overwriting their {@link ModSetting | ModSetting} table. Mods can only change their own settings. Using the in-game console, all player settings can be changed.
15044
15140
  */
15045
15141
  readonly global: {[key: string]: ModSetting}
15046
15142
 
@@ -15052,7 +15148,7 @@ interface LuaSettings {
15052
15148
  /**
15053
15149
  * The default player mod settings for this map, indexed by prototype name.
15054
15150
  *
15055
- * Even though these are marked as read-only, they can be changed by overwriting individual {@link ModSetting | ModSetting} tables in the custom table. Mods can only change their own settings. Using the in-game console, all player settings can be changed.
15151
+ * Even though this attribute is marked as read-only, individual settings can be changed by overwriting their {@link ModSetting | ModSetting} table. Mods can only change their own settings. Using the in-game console, all player settings can be changed.
15056
15152
  */
15057
15153
  readonly player: {[key: string]: ModSetting}
15058
15154
 
@@ -16447,7 +16543,7 @@ interface LuaSurface {
16447
16543
  * @param table.entity_to_ignore - Makes the pathfinder ignore collisions with this entity if it is given.
16448
16544
  * @param table.force - The force for which to generate the path, determining which gates can be opened for example.
16449
16545
  * @param table.goal - The position to find a path to.
16450
- * @param table.path_resolution_modifier - 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`.
16546
+ * @param table.path_resolution_modifier - 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.
16451
16547
  * @param table.pathfind_flags - Flags that affect pathfinder behavior.
16452
16548
  * @param table.radius - How close the pathfinder needs to get to its `goal` (in tiles). Defaults to `1`.
16453
16549
  * @param table.start - The position from which to start pathfinding.
@@ -16614,12 +16710,12 @@ interface LuaSurface {
16614
16710
  generate_with_lab_tiles: boolean
16615
16711
 
16616
16712
  /**
16617
- * Unique ID associated with this surface.
16713
+ * 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 deleted | on_surface_deleted}. Indexes of deleted surfaces can be reused.
16618
16714
  */
16619
16715
  readonly index: number
16620
16716
 
16621
16717
  /**
16622
- * 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.
16718
+ * 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.
16623
16719
  */
16624
16720
  map_gen_settings: MapGenSettings
16625
16721
 
@@ -16688,7 +16784,7 @@ interface LuaSurface {
16688
16784
  wind_orientation_change: number
16689
16785
 
16690
16786
  /**
16691
- * Current wind speed.
16787
+ * Current wind speed in tiles per tick.
16692
16788
  */
16693
16789
  wind_speed: number
16694
16790
 
@@ -16769,7 +16865,7 @@ interface LuaTechnology {
16769
16865
  readonly research_unit_count: number
16770
16866
 
16771
16867
  /**
16772
- * The count formula used for this infinite research. `nil` if this research isn't infinite.
16868
+ * The count formula, if this research has any. See the {@link wiki | https://wiki.factorio.com/Prototype/Technology#Technology_data} for details.
16773
16869
  */
16774
16870
  readonly research_unit_count_formula?: string
16775
16871
 
@@ -16883,7 +16979,7 @@ interface LuaTechnologyPrototype {
16883
16979
  readonly research_unit_count: number
16884
16980
 
16885
16981
  /**
16886
- * The count formula used for this infinite research. `nil` if this research isn't infinite.
16982
+ * The count formula, if this research has any. See the {@link wiki | https://wiki.factorio.com/Prototype/Technology#Technology_data} for details.
16887
16983
  */
16888
16984
  readonly research_unit_count_formula?: string
16889
16985
 
@@ -17054,9 +17150,9 @@ interface LuaTilePrototype {
17054
17150
  readonly emissions_per_second: number
17055
17151
 
17056
17152
  /**
17057
- * 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.
17153
+ * Items that when placed will produce this tile, if any. Construction bots will choose the first item in the list to build this tile.
17058
17154
  */
17059
- readonly items_to_place_this: SimpleItemStack[]
17155
+ readonly items_to_place_this?: ItemStackDefinition[]
17060
17156
 
17061
17157
  readonly layer: number
17062
17158
 
@@ -18496,6 +18592,11 @@ interface LuaGuiElementAddParamsTextfield extends LuaGuiElementAddParams {
18496
18592
  *
18497
18593
  */
18498
18594
  interface LuaSurfaceCreateEntityParams {
18595
+ /**
18596
+ * If fast_replace is true simulate fast replace using this character.
18597
+ */
18598
+ 'character'?: LuaEntity
18599
+
18499
18600
  /**
18500
18601
  * If false, the building effect smoke will not be shown around the new entity.
18501
18602
  */
@@ -18547,7 +18648,7 @@ interface LuaSurfaceCreateEntityParams {
18547
18648
  'raise_built'?: boolean
18548
18649
 
18549
18650
  /**
18550
- * Source entity. Used for beams and highlight-boxes.
18651
+ * Source entity. Used for beams, projectiles, and highlight-boxes.
18551
18652
  */
18552
18653
  'source'?: LuaEntity | MapPosition
18553
18654
 
@@ -2,7 +2,7 @@
2
2
  // Factorio API reference https://lua-api.factorio.com/latest/index.html
3
3
  // Generated from JSON source https://lua-api.factorio.com/latest/runtime-api.json
4
4
  // Definition source https://github.com/sguest/factorio-types
5
- // Factorio version 1.1.77
5
+ // Factorio version 1.1.80
6
6
  // API version 3
7
7
 
8
8
  /**
@@ -309,19 +309,6 @@ interface BlueprintEntity {
309
309
  tags?: Tags
310
310
  }
311
311
 
312
- interface BlueprintItemIcon {
313
-
314
- /**
315
- * Index of the icon in the blueprint icons slots. Has to be an integer in the range [1, 4].
316
- */
317
- index: number,
318
-
319
- /**
320
- * Name of the item prototype whose icon should be used.
321
- */
322
- name: string
323
- }
324
-
325
312
  interface BlueprintSignalIcon {
326
313
 
327
314
  /**
@@ -1343,7 +1330,7 @@ interface ItemStackLocation {
1343
1330
  *
1344
1331
  * The template can contain placeholders such as `__1__` or `__2__`. These will be replaced by the respective parameter in the LocalisedString. The parameters themselves can be other localised strings, which will be processed recursively in the same fashion. Localised strings can not be recursed deeper than 20 levels and can not have more than 20 parameters.
1345
1332
  *
1346
- * As a special case, when the key is just the empty string, all the parameters will be concatenated (after processing, if any are localised strings). If there is only one parameter, it will be used as is.
1333
+ * There are two special flags for the localised string, indicated by the key being a particular string. First, if the key is the empty string (`""`), then all parameters will be concatenated (after processing, if any are localised strings themselves). Second, if the key is a question mark (`"?"`), then the first valid parameter will be used. A parameter can be invalid if its name doesn't match any string template. If no parameters are valid, the last one is returned. This is useful to implement a fallback for missing locale templates.
1347
1334
  *
1348
1335
  * Furthermore, when an API function expects a localised string, it will also accept a regular string (i.e. not a table) which will not be translated, as well as a number, boolean or `nil`, which will be converted to their textual representation.
1349
1336
  * @example
@@ -1371,6 +1358,13 @@ interface ItemStackLocation {
1371
1358
  * game.print({"", {"item-name.iron-plate"}, ": ", 60})
1372
1359
  * ```
1373
1360
  *
1361
+ * @example
1362
+ * As an example of a localised string with fallback, consider this:
1363
+ * ```
1364
+ * {"?", {"", {"entity-description.furnace"}, "\n"}, {"item-description.furnace"}, "optional fallback"}
1365
+ * ```
1366
+ * If `entity-description.furnace` exists, it is concatenated with `"\n"` and returned. Otherwise, if `item-description.furnace` exists, it is returned as-is. Otherwise, `"optional fallback"` is returned. If this value wasn't specified, the translation result would be `"Unknown key: 'item-description.furnace'"`.
1367
+ *
1374
1368
  */
1375
1369
  type LocalisedString = string | number | boolean | object | null | Array<string | LocalisedString>
1376
1370
 
@@ -1828,11 +1822,6 @@ interface ModChangeData {
1828
1822
  old_version: string
1829
1823
  }
1830
1824
 
1831
- /**
1832
- * @remarks
1833
- * Runtime settings can be changed through console commands and by the mod that owns the settings by writing a new table to the ModSetting.
1834
- *
1835
- */
1836
1825
  interface ModSetting {
1837
1826
 
1838
1827
  /**
@@ -2885,7 +2874,7 @@ interface WireConnectionDefinition {
2885
2874
  target_wire_id?: defines.wire_connection_id,
2886
2875
 
2887
2876
  /**
2888
- * Wire color, either {@link defines.wire_type.red | defines.wire_type.red} or {@link defines.wire_type.green | defines.wire_type.green}.
2877
+ * The type of wire used.
2889
2878
  */
2890
2879
  wire: defines.wire_type
2891
2880
  }
package/dist/defines.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  // Factorio API reference https://lua-api.factorio.com/latest/index.html
3
3
  // Generated from JSON source https://lua-api.factorio.com/latest/runtime-api.json
4
4
  // Definition source https://github.com/sguest/factorio-types
5
- // Factorio version 1.1.77
5
+ // Factorio version 1.1.80
6
6
  // API version 3
7
7
 
8
8
  declare namespace defines {
@@ -539,6 +539,8 @@ declare namespace defines {
539
539
  on_gui_closed,
540
540
  on_gui_confirmed,
541
541
  on_gui_elem_changed,
542
+ on_gui_hover,
543
+ on_gui_leave,
542
544
  on_gui_location_changed,
543
545
  on_gui_opened,
544
546
  on_gui_selected_tab_changed,
@@ -794,6 +796,8 @@ declare namespace defines {
794
796
  gui_click,
795
797
  gui_confirmed,
796
798
  gui_elem_changed,
799
+ gui_hover,
800
+ gui_leave,
797
801
  gui_location_changed,
798
802
  gui_selected_tab_changed,
799
803
  gui_selection_state_changed,
package/dist/events.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  // Factorio API reference https://lua-api.factorio.com/latest/index.html
3
3
  // Generated from JSON source https://lua-api.factorio.com/latest/runtime-api.json
4
4
  // Definition source https://github.com/sguest/factorio-types
5
- // Factorio version 1.1.77
5
+ // Factorio version 1.1.80
6
6
  // API version 3
7
7
 
8
8
  /**
@@ -686,6 +686,32 @@ interface on_gui_elem_changed extends event {
686
686
  */
687
687
  player_index: number
688
688
  }
689
+ /**
690
+ * Called when {@link LuaGuiElement | LuaGuiElement} is hovered by the mouse.
691
+ */
692
+ interface on_gui_hover extends event {
693
+ /**
694
+ * The element that is being hovered over.
695
+ */
696
+ element: LuaGuiElement
697
+ /**
698
+ * The player whose cursor is hovering.
699
+ */
700
+ player_index: number
701
+ }
702
+ /**
703
+ * Called when the player's cursor leaves a {@link LuaGuiElement | LuaGuiElement} that was previously hovered.
704
+ */
705
+ interface on_gui_leave extends event {
706
+ /**
707
+ * The element that was being hovered.
708
+ */
709
+ element: LuaGuiElement
710
+ /**
711
+ * The player whose cursor was hovering.
712
+ */
713
+ player_index: number
714
+ }
689
715
  /**
690
716
  * Called when {@link LuaGuiElement | LuaGuiElement} element location is changed (related to frames in `player.gui.screen`).
691
717
  */
@@ -1210,7 +1236,7 @@ interface on_player_created extends event {
1210
1236
  player_index: number
1211
1237
  }
1212
1238
  /**
1213
- * Called after a players cursorstack changed in some way.
1239
+ * Called after a player's {@link cursor stack | LuaControl::cursor_stack} changed in some way.
1214
1240
  */
1215
1241
  interface on_player_cursor_stack_changed extends event {
1216
1242
  player_index: number
@@ -1487,11 +1513,11 @@ interface on_player_promoted extends event {
1487
1513
  player_index: number
1488
1514
  }
1489
1515
  /**
1490
- * Called when a player is removed (deleted) from the game. Not to be confused with the player logging of this is different in that the player is deleted as if he never existed in the save file.
1516
+ * Called when a player is removed (deleted) from the game. This is markedly different from a player temporarily {@link leaving | on_player_left_game} the game, and instead behaves like the player never existed in the save file.
1491
1517
  */
1492
1518
  interface on_player_removed extends event {
1493
1519
  /**
1494
- * The player index that was removed
1520
+ * The index of the removed player.
1495
1521
  */
1496
1522
  player_index: number
1497
1523
  }
@@ -1910,11 +1936,11 @@ interface on_pre_player_mined_item extends event {
1910
1936
  player_index: number
1911
1937
  }
1912
1938
  /**
1913
- * Called before a player is removed (deleted) from the game. Not to be confused with the player logging of this is different in that the player is deleted as if he never existed in the save file.
1939
+ * Called before a player is removed (deleted) from the game. This is markedly different from a player temporarily {@link leaving | on_player_left_game} the game, and instead behaves like the player never existed in the save file.
1914
1940
  */
1915
1941
  interface on_pre_player_removed extends event {
1916
1942
  /**
1917
- * The player index that will be removed
1943
+ * The index of the removed player.
1918
1944
  */
1919
1945
  player_index: number
1920
1946
  }
@@ -2332,7 +2358,7 @@ interface on_surface_deleted extends event {
2332
2358
  surface_index: number
2333
2359
  }
2334
2360
  /**
2335
- * Called after a surface is imported.
2361
+ * Called after a surface is imported via the map editor.
2336
2362
  */
2337
2363
  interface on_surface_imported extends event {
2338
2364
  /**
package/dist/global.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  // Factorio API reference https://lua-api.factorio.com/latest/index.html
3
3
  // Generated from JSON source https://lua-api.factorio.com/latest/runtime-api.json
4
4
  // Definition source https://github.com/sguest/factorio-types
5
- // Factorio version 1.1.77
5
+ // Factorio version 1.1.80
6
6
  // API version 3
7
7
 
8
8
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "factorio-types",
3
- "version": "0.0.33",
3
+ "version": "0.0.35",
4
4
  "description": "Typescript declarations for the factorio mod API",
5
5
  "main": "index.d.ts",
6
6
  "repository": "https://github.com/sguest/factorio-types.git",