factorio-types 1.2.32 → 1.2.34

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 2.0.45
5
+ // Factorio version 2.0.49
6
6
  // API version 6
7
7
 
8
8
  declare namespace runtime {
@@ -4714,7 +4714,7 @@ interface LuaCommandable {
4714
4714
  */
4715
4715
  readonly is_entity: boolean;
4716
4716
  /**
4717
- * Whether this unit group is controlled by a script or by the game engine. This can be changed using {@link LuaCommandable::set_autonomous | runtime:LuaCommandable::set_autonomous}.
4717
+ * Whether this unit group is controlled by a script or by the game engine. This can be changed using {@link LuaCommandable::set_autonomous | runtime:LuaCommandable::set_autonomous}. Units created by {@link LuaSurface::create_unit_group | runtime:LuaSurface::create_unit_group} are considered script-driven.
4718
4718
  */
4719
4719
  readonly is_script_driven: boolean;
4720
4720
  /**
@@ -4899,6 +4899,10 @@ interface LuaControl {
4899
4899
  * @returns The inventory or `nil` if none with the given index was found.
4900
4900
  */
4901
4901
  get_inventory(this: void, inventory: defines.inventory): LuaInventory | null;
4902
+ /**
4903
+ * Get name of inventory. Names match keys of {@link defines.inventory | runtime:defines.inventory}.
4904
+ */
4905
+ get_inventory_name(this: void, inventory: defines.inventory): string | null;
4902
4906
  /**
4903
4907
  * Get the number of all or some items in this entity.
4904
4908
  * @param item The item to count. If not specified, count all items.
@@ -5957,6 +5961,15 @@ interface LuaEntity extends LuaControl {
5957
5961
  * @param fluid Prototype name of the fluid to count. If not specified, count all fluids.
5958
5962
  */
5959
5963
  get_fluid_count(this: void, fluid?: string): double;
5964
+ /**
5965
+ * Checks what is expected fluid to be produced from the offshore pump's source tile. It accounts for visible tile, hidden tile and double hidden tile. It ignores currently set fluid box filter.
5966
+ * @returns Name of fluid that should be produced by this offshore pump based on existing tiles.
5967
+ */
5968
+ get_fluid_source_fluid(this: void): string | null;
5969
+ /**
5970
+ * Gives TilePosition of a tile which this offshore pump uses to check what fluid should be produced.
5971
+ */
5972
+ get_fluid_source_tile(this: void): TilePosition;
5960
5973
  /**
5961
5974
  * The fuel inventory for this entity or `nil` if this entity doesn't have a fuel inventory.
5962
5975
  */
@@ -6231,7 +6244,7 @@ interface LuaEntity extends LuaControl {
6231
6244
  */
6232
6245
  is_registered_for_deconstruction(this: void, force: ForceID): boolean;
6233
6246
  /**
6234
- * Is this entity registered for repair? If false, it means a construction robot has been dispatched to upgrade it, or it is not damaged. This is worst-case O(N) complexity where N is the current number of things in the repair queue.
6247
+ * Is this entity registered for repair? If false, it means a construction robot has been dispatched to repair it, or it is not damaged. This is worst-case O(N) complexity where N is the current number of things in the repair queue.
6235
6248
  */
6236
6249
  is_registered_for_repair(this: void): boolean;
6237
6250
  /**
@@ -6239,9 +6252,10 @@ interface LuaEntity extends LuaControl {
6239
6252
  */
6240
6253
  is_registered_for_upgrade(this: void): boolean;
6241
6254
  /**
6255
+ * @param character If provided, must be of `character` type.
6242
6256
  * @returns `true` if the rocket was successfully launched. Return value of `false` means the silo is not ready for launch.
6243
6257
  */
6244
- launch_rocket(this: void, destination?: CargoDestination): boolean;
6258
+ launch_rocket(this: void, destination?: CargoDestination, character?: LuaEntity): boolean;
6245
6259
  /**
6246
6260
  * Mines this entity.
6247
6261
  *
@@ -6503,11 +6517,18 @@ interface LuaEntity extends LuaControl {
6503
6517
  *
6504
6518
  * The player will be automatically disassociated when a controller is set on the character. Also, all characters associated to a player will be logged off when the player logs off in multiplayer.
6505
6519
  *
6506
- * Reading this property will return a {@link LuaPlayer | runtime:LuaPlayer}, while {@link PlayerIdentification | runtime:PlayerIdentification} can be used when writing.
6520
+ * A character associated with a player is not directly controlled by any player.
6521
+ */
6522
+ readonly associated_player?: LuaPlayer;
6523
+ /**
6524
+ * The player this character is associated with, if any. Set to `nil` to clear.
6525
+ *
6526
+ * The player will be automatically disassociated when a controller is set on the character. Also, all characters associated to a player will be logged off when the player logs off in multiplayer.
6507
6527
  *
6508
6528
  * A character associated with a player is not directly controlled by any player.
6529
+ * @customName associated_player
6509
6530
  */
6510
- associated_player?: LuaPlayer | PlayerIdentification;
6531
+ associated_player_write?: PlayerIdentification;
6511
6532
  /**
6512
6533
  * The cargo pod attached to this rocket silo rocket if any.
6513
6534
  */
@@ -6526,6 +6547,7 @@ interface LuaEntity extends LuaControl {
6526
6547
  * 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.
6527
6548
  */
6528
6549
  backer_name?: string;
6550
+ base_damage_modifiers: TriggerModifierData;
6529
6551
  /**
6530
6552
  * Number of beacons affecting this effect receiver. Can only be used when the entity has an effect receiver (AssemblingMachine, Furnace, Lab, MiningDrills)
6531
6553
  */
@@ -6553,6 +6575,7 @@ interface LuaEntity extends LuaControl {
6553
6575
  * Whether this underground belt goes into or out of the ground.
6554
6576
  */
6555
6577
  readonly belt_to_ground_type: 'input' | 'output';
6578
+ bonus_damage_modifiers: TriggerModifierData;
6556
6579
  /**
6557
6580
  * The bonus mining progress for this mining drill. Read yields a number in range [0, mining_target.prototype.mineable_properties.mining_time]. `nil` if this isn't a mining drill.
6558
6581
  */
@@ -6569,6 +6592,10 @@ interface LuaEntity extends LuaControl {
6569
6592
  * The burner energy source for this entity, if any.
6570
6593
  */
6571
6594
  readonly burner?: LuaBurner;
6595
+ /**
6596
+ * The space platform hub or cargo landing pad this cargo bay is connected to if any.
6597
+ */
6598
+ readonly cargo_bay_connection_owner?: LuaEntity;
6572
6599
  /**
6573
6600
  * The cargo hatches owned by this entity if any.
6574
6601
  */
@@ -6941,6 +6968,10 @@ interface LuaEntity extends LuaControl {
6941
6968
  * If the entity is updatable.
6942
6969
  */
6943
6970
  readonly is_updatable: boolean;
6971
+ /**
6972
+ * The first found item request proxy targeting this entity.
6973
+ */
6974
+ readonly item_request_proxy?: LuaEntity;
6944
6975
  /**
6945
6976
  * Items this ghost will request when revived or items this item request proxy is requesting.
6946
6977
  */
@@ -6951,10 +6982,13 @@ interface LuaEntity extends LuaControl {
6951
6982
  kills: uint;
6952
6983
  /**
6953
6984
  * The last player that changed any setting on this entity. This includes building the entity, changing its color, or configuring its circuit network. `nil` if the last user is not part of the save anymore.
6954
- *
6955
- * Reading this property will return a {@link LuaPlayer | runtime:LuaPlayer}, while {@link PlayerIdentification | runtime:PlayerIdentification} can be used when writing.
6956
6985
  */
6957
- last_user?: LuaPlayer | PlayerIdentification;
6986
+ readonly last_user?: LuaPlayer;
6987
+ /**
6988
+ * The last player that changed any setting on this entity. This includes building the entity, changing its color, or configuring its circuit network. `nil` if the last user is not part of the save anymore.
6989
+ * @customName last_user
6990
+ */
6991
+ last_user_write?: PlayerIdentification;
6958
6992
  /**
6959
6993
  * The link ID this linked container is using.
6960
6994
  */
@@ -7070,6 +7104,10 @@ interface LuaEntity extends LuaControl {
7070
7104
  * The smooth orientation of this entity.
7071
7105
  */
7072
7106
  orientation: RealOrientation;
7107
+ /**
7108
+ * Plants registered by this agricultural tower.
7109
+ */
7110
+ readonly owned_plants: LuaEntity[];
7073
7111
  parameters: ProgrammableSpeakerParameters;
7074
7112
  /**
7075
7113
  * Where the inserter will pick up items from.
@@ -7173,10 +7211,13 @@ interface LuaEntity extends LuaControl {
7173
7211
  remove_unfiltered_items: boolean;
7174
7212
  /**
7175
7213
  * The player that this `simple-entity-with-owner`, `simple-entity-with-force`, or `highlight-box` is visible to. `nil` when this entity is rendered for all players.
7176
- *
7177
- * Reading this property will return a {@link LuaPlayer | runtime:LuaPlayer}, while {@link PlayerIdentification | runtime:PlayerIdentification} can be used when writing.
7178
7214
  */
7179
- render_player?: LuaPlayer | PlayerIdentification;
7215
+ readonly render_player?: LuaPlayer;
7216
+ /**
7217
+ * The player that this `simple-entity-with-owner`, `simple-entity-with-force`, or `highlight-box` is visible to. `nil` when this entity is rendered for all players.
7218
+ * @customName render_player
7219
+ */
7220
+ render_player_write?: PlayerIdentification;
7180
7221
  /**
7181
7222
  * The forces that this `simple-entity-with-owner` or `simple-entity-with-force` is visible to. `nil` or an empty array when this entity is rendered for all forces.
7182
7223
  *
@@ -7432,10 +7473,22 @@ interface LuaEntity extends LuaControl {
7432
7473
  * This has no effect if the prototype does not support filters.
7433
7474
  */
7434
7475
  use_filters: boolean;
7476
+ /**
7477
+ * When true, the rocket silo will request items for space platforms in orbit.
7478
+ *
7479
+ * Setting the value will have no effect when the silo doesn't support logistics.
7480
+ */
7481
+ use_transitional_requests: boolean;
7435
7482
  /**
7436
7483
  * 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.
7437
7484
  */
7438
7485
  readonly valid: boolean;
7486
+ /**
7487
+ * The threshold override of this valve, or `nil` if an override is not defined.
7488
+ *
7489
+ * If no override is defined, the threshold is taken from {@link LuaEntityPrototype::valve_threshold | runtime:LuaEntityPrototype::valve_threshold}.
7490
+ */
7491
+ valve_threshold_override?: float;
7439
7492
  /**
7440
7493
  * Read when this spidertron auto-targets enemies
7441
7494
  */
@@ -7513,6 +7566,10 @@ interface LuaEntityPrototype extends LuaPrototypeBase {
7513
7566
  * The supply area of this electric pole or beacon prototype.
7514
7567
  */
7515
7568
  get_supply_area_distance(this: void, quality?: QualityID): double;
7569
+ /**
7570
+ * The maximum flow rate through this valve.
7571
+ */
7572
+ get_valve_flow_rate(this: void, quality?: QualityID): double;
7516
7573
  /**
7517
7574
  * Test whether this entity prototype has a certain flag set.
7518
7575
  * @param flag The flag to test.
@@ -7523,6 +7580,7 @@ interface LuaEntityPrototype extends LuaPrototypeBase {
7523
7580
  * A table of pollutions amounts that has to be absorbed by the unit's spawner before the unit will leave the spawner and attack the source of the pollution, indexed by the name of each absorbed pollution type.
7524
7581
  */
7525
7582
  readonly absorptions_to_join_attack?: Record<string, float>;
7583
+ readonly accepted_seeds?: string[];
7526
7584
  /**
7527
7585
  * The active energy usage of this rocket silo or combinator prototype.
7528
7586
  */
@@ -7535,6 +7593,7 @@ interface LuaEntityPrototype extends LuaPrototypeBase {
7535
7593
  * Whether this unit prototype is affected by tile walking speed modifiers.
7536
7594
  */
7537
7595
  readonly affected_by_tiles?: boolean;
7596
+ readonly agricultural_tower_radius?: double;
7538
7597
  /**
7539
7598
  * The air resistance of this rolling stock prototype.
7540
7599
  */
@@ -7725,6 +7784,10 @@ interface LuaEntityPrototype extends LuaPrototypeBase {
7725
7784
  * The value in the dictionary is meaningless and exists just to allow for easy lookup.
7726
7785
  */
7727
7786
  readonly crafting_categories?: Record<string, true>;
7787
+ /**
7788
+ * The crane energy usage of this agricultural tower prototype.
7789
+ */
7790
+ readonly crane_energy_usage?: double;
7728
7791
  /**
7729
7792
  * If this prototype will attempt to create a ghost of itself on death.
7730
7793
  *
@@ -7878,6 +7941,7 @@ interface LuaEntityPrototype extends LuaPrototypeBase {
7878
7941
  * The fluid energy source prototype this entity uses, if any.
7879
7942
  */
7880
7943
  readonly fluid_energy_source_prototype?: LuaFluidEnergySourcePrototype;
7944
+ readonly fluid_source_offset?: Vector;
7881
7945
  /**
7882
7946
  * The fluid usage of this generator prototype. This property is deprecated in favor of {@link LuaEntityPrototype::get_fluid_usage_per_tick | runtime:LuaEntityPrototype::get_fluid_usage_per_tick} and should not be used.
7883
7947
  */
@@ -7906,6 +7970,7 @@ interface LuaEntityPrototype extends LuaPrototypeBase {
7906
7970
  * The equipment grid prototype for this entity, if any.
7907
7971
  */
7908
7972
  readonly grid_prototype?: LuaEquipmentGridPrototype;
7973
+ readonly growth_area_radius?: double;
7909
7974
  readonly growth_grid_tile_size?: uint;
7910
7975
  readonly growth_ticks?: uint;
7911
7976
  /**
@@ -8049,6 +8114,7 @@ interface LuaEntityPrototype extends LuaPrototypeBase {
8049
8114
  * The lamp energy usage of this rocket silo prototype.
8050
8115
  */
8051
8116
  readonly lamp_energy_usage?: double;
8117
+ readonly launch_to_space_platforms?: boolean;
8052
8118
  /**
8053
8119
  * The rocket launch delay for this rocket silo prototype.
8054
8120
  */
@@ -8296,6 +8362,10 @@ interface LuaEntityPrototype extends LuaPrototypeBase {
8296
8362
  * The rocket rising delay for this rocket silo prototype.
8297
8363
  */
8298
8364
  readonly rocket_rising_delay?: uint8;
8365
+ /**
8366
+ * The rotation snap angle of this car prototype.
8367
+ */
8368
+ readonly rotation_snap_angle?: double;
8299
8369
  /**
8300
8370
  * The rotation speed of this car prototype.
8301
8371
  */
@@ -8332,6 +8402,9 @@ interface LuaEntityPrototype extends LuaPrototypeBase {
8332
8402
  * The cursor size used when shooting at this entity.
8333
8403
  */
8334
8404
  readonly shooting_cursor_size: float;
8405
+ readonly solar_panel_performance_at_day: double;
8406
+ readonly solar_panel_performance_at_night: double;
8407
+ readonly solar_panel_solar_coefficient_property: LuaSurfacePropertyPrototype;
8335
8408
  /**
8336
8409
  * The spawning cooldown for this enemy spawner prototype.
8337
8410
  */
@@ -8441,11 +8514,19 @@ interface LuaEntityPrototype extends LuaPrototypeBase {
8441
8514
  /**
8442
8515
  * If this drill uses force productivity bonus
8443
8516
  */
8444
- readonly uses_force_mining_productivity_bonus?: bool;
8517
+ readonly uses_force_mining_productivity_bonus?: boolean;
8445
8518
  /**
8446
8519
  * 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.
8447
8520
  */
8448
8521
  readonly valid: boolean;
8522
+ /**
8523
+ * The mode of operation of this valve.
8524
+ */
8525
+ readonly valve_mode?: ValveMode;
8526
+ /**
8527
+ * The default threshold of this valve.
8528
+ */
8529
+ readonly valve_threshold?: float;
8449
8530
  readonly vector_to_place_result?: Vector;
8450
8531
  /**
8451
8532
  * Vertical selection shift used by rolling stocks. It affects selection box vertical position but is also used to shift rolling stock graphics along the rails to fine tune train's look.
@@ -8503,7 +8584,7 @@ interface LuaEquipment {
8503
8584
  */
8504
8585
  readonly max_energy: double;
8505
8586
  /**
8506
- * Maximum shield value.
8587
+ * Maximum shield value. `0` if this equipment doesn't have a shield.
8507
8588
  */
8508
8589
  readonly max_shield: double;
8509
8590
  /**
@@ -8539,9 +8620,9 @@ interface LuaEquipment {
8539
8620
  height: uint;
8540
8621
  };
8541
8622
  /**
8542
- * Current shield value of the equipment.
8623
+ * Current shield value of the equipment. Can't be set higher than {@link LuaEquipment::max_shield | runtime:LuaEquipment::max_shield}.
8543
8624
  *
8544
- * Can't be set higher than {@link LuaEquipment::max_shield | runtime:LuaEquipment::max_shield}.
8625
+ * Trying to write this value on non-shield equipment will throw an error.
8545
8626
  */
8546
8627
  shield: double;
8547
8628
  /**
@@ -8987,7 +9068,7 @@ interface LuaFluidBox {
8987
9068
  */
8988
9069
  flush(this: void, index: uint, fluid?: FluidID): Record<string, float>;
8989
9070
  /**
8990
- * The capacity of the given fluidbox index.
9071
+ * The capacity of the given fluidbox segment.
8991
9072
  */
8992
9073
  get_capacity(this: void, index: uint): double;
8993
9074
  /**
@@ -9002,6 +9083,8 @@ interface LuaFluidBox {
9002
9083
  get_filter(this: void, index: uint): FluidBoxFilter | null;
9003
9084
  /**
9004
9085
  * Gets counts of all fluids in the fluid segment. May return `nil` for fluid wagon, fluid turret's internal buffer, or a fluidbox which does not belong to a fluid segment.
9086
+ *
9087
+ * Note that this method only ever returns one fluid, since fluids can't be mixed anymore.
9005
9088
  * @returns The counts, indexed by fluid name.
9006
9089
  */
9007
9090
  get_fluid_segment_contents(this: void, index: uint): Record<string, uint> | null;
@@ -10346,10 +10429,10 @@ interface LuaGenericOnOffControlBehavior extends LuaControlBehavior {
10346
10429
  * @example ```
10347
10430
  -- Tell an entity to be active (for example a lamp to be lit) when it receives a
10348
10431
  -- circuit signal of more than 4 chain signals.
10349
- a_behavior.circuit_condition = {condition={
10432
+ a_behavior.circuit_condition = {
10350
10433
  comparator=">",
10351
10434
  first_signal={type="item", name="rail-chain-signal"},
10352
- constant=4}
10435
+ constant=4
10353
10436
  }
10354
10437
  ```
10355
10438
  */
@@ -10371,10 +10454,10 @@ interface LuaGenericOnOffControlBehavior extends LuaControlBehavior {
10371
10454
  * @example ```
10372
10455
  -- Tell an entity to be active (for example a lamp to be lit) when the logistics
10373
10456
  -- network it's connected to has more than four chain signals.
10374
- a_behavior.logistic_condition = {condition={
10457
+ a_behavior.logistic_condition = {
10375
10458
  comparator=">",
10376
10459
  first_signal={type="item", name="rail-chain-signal"},
10377
- constant=4}
10460
+ constant=4
10378
10461
  }
10379
10462
  ```
10380
10463
  */
@@ -10879,6 +10962,15 @@ interface LuaGuiElement {
10879
10962
  * The position this camera or minimap is focused on, if any.
10880
10963
  */
10881
10964
  position: MapPosition;
10965
+ /**
10966
+ * The quality to be shown in the bottom left corner of this sprite-button, or `nil` to show nothing.
10967
+ */
10968
+ readonly quality?: LuaQualityPrototype;
10969
+ /**
10970
+ * The quality to be shown in the bottom left corner of this sprite-button, or `nil` to show nothing.
10971
+ * @customName quality
10972
+ */
10973
+ quality_write?: QualityID;
10882
10974
  /**
10883
10975
  * Whether this element will raise {@link on_gui_hover | runtime:on_gui_hover} and {@link on_gui_leave | runtime:on_gui_leave}.
10884
10976
  */
@@ -11428,6 +11520,10 @@ interface LuaGuiElementAddParamsSpriteButton extends BaseLuaGuiElementAddParams
11428
11520
  * The number shown on the button.
11429
11521
  */
11430
11522
  'number'?: double;
11523
+ /**
11524
+ * The name of the quality shown on the button.
11525
+ */
11526
+ 'quality'?: string;
11431
11527
  /**
11432
11528
  * Formats small numbers as percentages. Defaults to `false`.
11433
11529
  */
@@ -11893,6 +11989,10 @@ interface LuaInventory {
11893
11989
  * The mod that owns this inventory, if any.
11894
11990
  */
11895
11991
  readonly mod_owner?: string;
11992
+ /**
11993
+ * Name of this inventory, if any. Names match keys of {@link defines.inventory | runtime:defines.inventory}.
11994
+ */
11995
+ readonly name?: string;
11896
11996
  /**
11897
11997
  * The class name of this object. Available even when `valid` is false. For LuaStruct objects it may also be suffixed with a dotted path to a member of the struct.
11898
11998
  */
@@ -12150,7 +12250,7 @@ interface LuaItemCommon {
12150
12250
  *
12151
12251
  * In contrast to {@link LuaItemCommon::get_mapper | runtime:LuaItemCommon::get_mapper}, indices past the upgrade item's current size are valid and expand the list of mappings accordingly, if within reasonable bounds.
12152
12252
  * @param index The index of the mapper to set.
12153
- * @param mapper The mapper to set or `nil`
12253
+ * @param mapper The mapper to set. Set `nil` to clear the mapper.
12154
12254
  */
12155
12255
  set_mapper(this: void, index: uint, type: 'from' | 'to', mapper: UpgradeMapperSource | UpgradeMapperDestination | nil): void;
12156
12256
  /**
@@ -12665,9 +12765,9 @@ interface LuaItemStack extends LuaItemCommon {
12665
12765
  swap_stack(this: void, stack: LuaItemStack): boolean;
12666
12766
  /**
12667
12767
  * Transfers the given item stack into this item stack.
12668
- * @returns `true` if the full stack was transferred.
12768
+ * @returns `true` if the full stack (or requested amount) was transferred.
12669
12769
  */
12670
- transfer_stack(this: void, stack: ItemStackIdentification): boolean;
12770
+ transfer_stack(this: void, stack: ItemStackIdentification, amount?: uint): boolean;
12671
12771
  /**
12672
12772
  * Use the capsule item with the entity as the source, targeting the given position.
12673
12773
  * @param entity The entity to use the capsule item with.
@@ -14204,9 +14304,63 @@ interface LuaPlayer extends LuaControl {
14204
14304
  */
14205
14305
  readonly valid: boolean;
14206
14306
  /**
14207
- * The player's zoom-level. Must be positive.
14307
+ * The current player controller's zoom level. Must be positive. The baseline zoom level is 1. Values greater than 1 will zoom in closer to the world and values between 0 and 1 will zoom out away from the world.
14308
+ *
14309
+ * Writing values outside the current zoom limits is always valid, but read values will always be clamped to the range defined by {@link LuaPlayer::zoom_limits | runtime:LuaPlayer::zoom_limits}.
14208
14310
  */
14209
14311
  zoom: double;
14312
+ /**
14313
+ * The current player controller's zoom limits.
14314
+ *
14315
+ * Reading this field creates a copy, so modifying the returned table's fields directly will not alter the player's zoom limits. To change the zoom limits for the player's current controller, set the entire field to the desired {@link ZoomLimits | runtime:ZoomLimits} table.
14316
+ *
14317
+ * Zoom limits may or may not reset to default any time the player controller changes. Use the {@link defines.events.on_player_controller_changed | runtime:defines.events.on_player_controller_changed} event to respond to and correct the new controller's zoom limits.
14318
+ * @example ```
14319
+ -- Lets the player zoom in to 4x the standard zoom level. (3x is the default for most controllers.)
14320
+ -- Increases the player zoom out level so that they can view approximately 800 tiles across.
14321
+ -- Sets furthest_game_view to furthest so that all zoom levels are rendered in game view, never chart (map) view.
14322
+ game.player.zoom_limits = {
14323
+ closest = { zoom = 4 },
14324
+ furthest = { distance = 800, max_distance = 1000 },
14325
+ furthest_game_view = { distance = 800, max_distance = 1000 }
14326
+ }
14327
+ ```
14328
+ * @example ```
14329
+ -- Resets the closest and furthest_game_view limits to their defaults.
14330
+ -- Increases the furthest a player can zoom out to approximately 400 tiles across. There's a hard zoom limit at
14331
+ -- 800 tiles (either vertically or horizontally, whichever is more).
14332
+ game.player.zoom_limits = {
14333
+ furthest = { distance = 400, max_distance = 800 }
14334
+ }
14335
+ ```
14336
+ * @example ```
14337
+ -- Sets the closest that the player can zoom in to 3x (the default for most controllers).
14338
+ -- Sets the furthest that the player can view in game view to some number GREATER than
14339
+ -- closest, guaranteeing that the player can only view the chart. However, this does NOT mean that the player
14340
+ -- can interact with the game as if in remote view if they are not explicitly using remote view.
14341
+ game.player.zoom_limits = {
14342
+ closest = { zoom = 3 },
14343
+ furthest_game_view = { zoom = 4 }
14344
+ }
14345
+ ```
14346
+ * @example ```
14347
+ -- Save a copy of whatever zoom limits any script has previously set.
14348
+ local custom_limits = game.player.zoom_limits
14349
+ -- Resets all zoom limits to default.
14350
+ game.player.zoom_limits = {}
14351
+ -- Save a copy of whatever the default zoom limits are for the current controller.
14352
+ local default_limits = game.player.zoom_limits
14353
+ -- Set the zoom limits to a modification of the engine-default closest zoom limit (or 6 if the engine-default is
14354
+ -- not a fixed zoom value), the furthest limit previously defined by script (or the engine default if not
14355
+ -- previously set by a script), and some arbitrary value for `furthest_game_view`.
14356
+ game.player.zoom_limits = {
14357
+ closest = { zoom = (default_limits.furthest.zoom or 3.0) * 2 },
14358
+ furthest = custom_limits.furthest,
14359
+ furthest_game_view = { zoom = 0.25 }
14360
+ }
14361
+ ```
14362
+ */
14363
+ zoom_limits: ZoomLimits;
14210
14364
  }
14211
14365
  /**
14212
14366
  * Prototype of a procession inheritance group which synchronizes offsets between procession steps.
@@ -14878,10 +15032,19 @@ interface LuaReactorControlBehavior extends LuaControlBehavior {
14878
15032
  * A crafting recipe. Recipes belong to forces (see {@link LuaForce | runtime:LuaForce}) because some recipes are unlocked by research, and researches are per-force.
14879
15033
  */
14880
15034
  interface LuaRecipe {
15035
+ /**
15036
+ * Checks if recipe has given category
15037
+ * @returns `true` if recipe has this category.
15038
+ */
15039
+ has_category(this: void, category: RecipeCategoryID): boolean;
14881
15040
  /**
14882
15041
  * Reload the recipe from the prototype.
14883
15042
  */
14884
15043
  reload(this: void): void;
15044
+ /**
15045
+ * Additional categories of this recipe.
15046
+ */
15047
+ readonly additional_categories: string[];
14885
15048
  /**
14886
15049
  * Category of the recipe.
14887
15050
  */
@@ -14977,6 +15140,15 @@ interface LuaRecipeCategoryPrototype extends LuaPrototypeBase {
14977
15140
  * A crafting recipe prototype.
14978
15141
  */
14979
15142
  interface LuaRecipePrototype extends LuaPrototypeBase {
15143
+ /**
15144
+ * Checks if recipe has given category
15145
+ * @returns `true` if recipe has this category.
15146
+ */
15147
+ has_category(this: void, category: RecipeCategoryID): boolean;
15148
+ /**
15149
+ * Additional categories of the recipe.
15150
+ */
15151
+ readonly additional_categories: string[];
14980
15152
  /**
14981
15153
  * If this recipe is enabled for the purpose of intermediate hand-crafting.
14982
15154
  */
@@ -15241,9 +15413,8 @@ interface LuaRecord {
15241
15413
  *
15242
15414
  * In contrast to {@link LuaRecord::set_mapper | runtime:LuaRecord::set_mapper}, indices past the upgrade item's current size are considered to be out of bounds.
15243
15415
  * @param index The index of the mapper to read.
15244
- * @param type `"from"` or `"to"`.
15245
15416
  */
15246
- get_mapper(this: void, index: uint, type: string): UpgradeMapperSource | UpgradeMapperDestination;
15417
+ get_mapper(this: void, index: uint, type: 'from' | 'to'): UpgradeMapperSource | UpgradeMapperDestination;
15247
15418
  /**
15248
15419
  * Gets the tile filter at the given index for this deconstruction planner.
15249
15420
  */
@@ -15285,10 +15456,9 @@ interface LuaRecord {
15285
15456
  *
15286
15457
  * In contrast to {@link LuaRecord::get_mapper | runtime:LuaRecord::get_mapper}, indices past the upgrade item's current size are valid and expand the list of mappings accordingly, if within reasonable bounds.
15287
15458
  * @param index The index of the mapper to set.
15288
- * @param type `"from"` or `"to"`.
15289
- * @param mapper The mapper to set or `nil`
15459
+ * @param mapper The mapper to set. Set `nil` to clear the mapper.
15290
15460
  */
15291
- set_mapper(this: void, index: uint, type: string, mapper: UpgradeMapperSource | UpgradeMapperDestination): void;
15461
+ set_mapper(this: void, index: uint, type: 'from' | 'to', mapper: UpgradeMapperSource | UpgradeMapperDestination | nil): void;
15292
15462
  /**
15293
15463
  * Sets the tile filter at the given index for this deconstruction planner.
15294
15464
  * @param filter Setting to nil erases the filter.
@@ -16308,6 +16478,7 @@ interface LuaSimulation {
16308
16478
  */
16309
16479
  deactivate_rail_planner(this: void): void;
16310
16480
  /**
16481
+ * @param table.slot_index This index is 0-based, unlike other inventory indices.
16311
16482
  * @param table.inventory Defaults to `"character"`.
16312
16483
  * @returns Position of the GUI slot on the screen, if successfully found.
16313
16484
  */
@@ -16449,6 +16620,10 @@ interface LuaSpacePlatform {
16449
16620
  * Cancels deletion of this space platform if it was scheduled for deletion.
16450
16621
  */
16451
16622
  cancel_deletion(this: void): void;
16623
+ /**
16624
+ * Removes all ejected items from this space platform.
16625
+ */
16626
+ clear_ejected_items(this: void): void;
16452
16627
  /**
16453
16628
  * Creates the given asteroid chunks on this platform.
16454
16629
  */
@@ -16477,6 +16652,13 @@ interface LuaSpacePlatform {
16477
16652
  limit?: uint;
16478
16653
  invert?: boolean;
16479
16654
  }): void;
16655
+ /**
16656
+ * Ejects an item into space on this space platform.
16657
+ *
16658
+ * If a LuaItemStack is provided, the actual item is ejected and removed from the source.
16659
+ * @param movement When inserters drop items into space, the {@link InserterPrototype::insert_position | prototype:InserterPrototype::insert_position} rotated to the inserter direction is used.
16660
+ */
16661
+ eject_item(this: void, item: ItemStackIdentification, position: MapPosition, movement: Vector): void;
16480
16662
  /**
16481
16663
  * Find asteroid chunks of a given name in a given area.
16482
16664
  *
@@ -16512,6 +16694,10 @@ interface LuaSpacePlatform {
16512
16694
  * It is represented as a number in range `[0, 1]`, with 0 being {@link LuaSpaceConnectionPrototype::from | runtime:LuaSpaceConnectionPrototype::from} and 1 being {@link LuaSpaceConnectionPrototype::to | runtime:LuaSpaceConnectionPrototype::to}.
16513
16695
  */
16514
16696
  distance?: double;
16697
+ /**
16698
+ * All items that have been thrown overboard.
16699
+ */
16700
+ readonly ejected_items: EjectedItem[];
16515
16701
  /**
16516
16702
  * The force of this space platform.
16517
16703
  */
@@ -17047,6 +17233,28 @@ interface LuaSurface {
17047
17233
  check_collision?: boolean;
17048
17234
  decoratives: Decorative[];
17049
17235
  }): void;
17236
+ /**
17237
+ * This method only works when used in simulations.
17238
+ *
17239
+ * Places entities via the given blueprint string. These entities are force-built.
17240
+ * @param table.string The blueprint string to import.
17241
+ * @param table.position The position to place the blueprint at.
17242
+ * @param table.force The force to place the blueprint for. Defaults to the player force.
17243
+ * @param table.direction The direction to place the blueprint in. Defaults to north.
17244
+ * @param table.flip_horizontal Whether to flip the blueprint horizontally. Defaults to `false`.
17245
+ * @param table.flip_vertical Whether to flip the blueprint vertically. Defaults to `false`.
17246
+ * @param table.by_player The player that placed the blueprint. Defaults to `nil`.
17247
+ * @returns If the blueprint string was invalid, `1` is returned. Otherwise, `nil` is returned.
17248
+ */
17249
+ create_entities_from_blueprint_string(this: void, table: {
17250
+ string: string;
17251
+ position: MapPosition;
17252
+ force?: ForceID;
17253
+ direction?: defines.direction;
17254
+ flip_horizontal?: boolean;
17255
+ flip_vertical?: boolean;
17256
+ by_player?: PlayerIdentification;
17257
+ }): int | null;
17050
17258
  /**
17051
17259
  * Create an entity on this surface.
17052
17260
  * @example ```
@@ -17587,6 +17795,14 @@ interface LuaSurface {
17587
17795
  force?: ForceID;
17588
17796
  unit_search_distance?: uint;
17589
17797
  }): uint;
17798
+ /**
17799
+ * Set the pollution for a given position.
17800
+ *
17801
+ * Pollution changes by this are not included in pollution statistics and do not affect evolution factors (as opposed to {@link LuaSurface::pollute | runtime:LuaSurface::pollute}).
17802
+ * @param position The position to set the chunk's pollution
17803
+ * @param amount New amount of pollution to be set on the chunk. Must be >= 0.
17804
+ */
17805
+ set_pollution(this: void, position: MapPosition, amount: double): void;
17590
17806
  /**
17591
17807
  * Sets the value of surface property on this surface.
17592
17808
  * @param property Property to change.
@@ -17616,6 +17832,7 @@ interface LuaSurface {
17616
17832
  * @param table.allow_belts Whether items can be spilled onto belts. Defaults to `true`.
17617
17833
  * @param table.max_radius Max radius from the specified `position` to spill items.
17618
17834
  * @param table.use_start_position_on_failure Allow spilling items at `position` if no non-colliding position is found. Note: Setting to false might cause some items not to be spilled. Defaults to `true`.
17835
+ * @param table.drop_full_stack If item on ground should be made out of an entire provided stack. Defaults to `false`.
17619
17836
  * @returns The created item-on-ground entities.
17620
17837
  */
17621
17838
  spill_item_stack(this: void, table: {
@@ -17626,6 +17843,7 @@ interface LuaSurface {
17626
17843
  allow_belts?: boolean;
17627
17844
  max_radius?: double;
17628
17845
  use_start_position_on_failure?: boolean;
17846
+ drop_full_stack?: boolean;
17629
17847
  }): LuaEntity[];
17630
17848
  /**
17631
17849
  * Place an upgrade request.
@@ -17670,6 +17888,29 @@ interface LuaSurface {
17670
17888
  * Current time of day, as a number in range `[0, 1)`.
17671
17889
  */
17672
17890
  daytime: double;
17891
+ /**
17892
+ * Parameters of daytime. Equivalent as reading {@link dusk | runtime:LuaSurface::dusk}, {@link evening | runtime:LuaSurface::evening}, {@link morning | runtime:LuaSurface::morning} and {@link dawn | runtime:LuaSurface::dawn} at the same time.
17893
+ *
17894
+ * In order for a write to take place, a new table needs to be written in one go: changing individual members of the returned table has no effect as those are value copies.
17895
+ */
17896
+ daytime_parameters: {
17897
+ /**
17898
+ * Must be < evening.
17899
+ */
17900
+ dusk: double;
17901
+ /**
17902
+ * Must be > dusk and < morning.
17903
+ */
17904
+ evening: double;
17905
+ /**
17906
+ * Must be > evening and < dawn.
17907
+ */
17908
+ morning: double;
17909
+ /**
17910
+ * Must be > morning.
17911
+ */
17912
+ dawn: double;
17913
+ };
17673
17914
  /**
17674
17915
  * If this surface can be deleted.
17675
17916
  */
@@ -17691,9 +17932,13 @@ interface LuaSurface {
17691
17932
  */
17692
17933
  generate_with_lab_tiles: boolean;
17693
17934
  /**
17694
- * Surface-wide effects applied to entities with effect receivers. May be `nil` if surface is not using surface-wide effect source.
17935
+ * Surface-wide effects applied to entities with effect receivers. `nil` if this surface is not using surface-wide effect source.
17695
17936
  */
17696
17937
  global_effect?: ModuleEffects;
17938
+ /**
17939
+ * The global electric network statistics for this surface.
17940
+ */
17941
+ readonly global_electric_network_statistics?: LuaFlowStatistics;
17697
17942
  /**
17698
17943
  * Whether this surface currently has a global electric network.
17699
17944
  */
@@ -17753,6 +17998,10 @@ interface LuaSurface {
17753
17998
  * The type of pollutant enabled on the surface, or `nil` if no pollutant is enabled.
17754
17999
  */
17755
18000
  readonly pollutant_type?: LuaAirbornePollutantPrototype;
18001
+ /**
18002
+ * The pollution statistics for this surface.
18003
+ */
18004
+ readonly pollution_statistics: LuaFlowStatistics;
17756
18005
  /**
17757
18006
  * If clouds are shown on this surface. If false, clouds are never shown. If true the player must also have clouds enabled in graphics settings for them to be shown.
17758
18007
  */
@@ -17782,7 +18031,7 @@ interface LuaSurface {
17782
18031
  */
17783
18032
  wind_speed: double;
17784
18033
  }
17785
- type LuaSurfaceCreateEntityParams = BaseLuaSurfaceCreateEntityParams | LuaSurfaceCreateEntityParamsArtilleryFlare | LuaSurfaceCreateEntityParamsArtilleryProjectile | LuaSurfaceCreateEntityParamsAssemblingMachine | LuaSurfaceCreateEntityParamsBeam | LuaSurfaceCreateEntityParamsCharacterCorpse | LuaSurfaceCreateEntityParamsCliff | LuaSurfaceCreateEntityParamsContainer | LuaSurfaceCreateEntityParamsElectricPole | LuaSurfaceCreateEntityParamsEntityGhost | LuaSurfaceCreateEntityParamsFire | LuaSurfaceCreateEntityParamsHighlightBox | LuaSurfaceCreateEntityParamsInserter | LuaSurfaceCreateEntityParamsItemEntity | LuaSurfaceCreateEntityParamsItemRequestProxy | LuaSurfaceCreateEntityParamsLamp | LuaSurfaceCreateEntityParamsLoader | LuaSurfaceCreateEntityParamsLoader1x1 | LuaSurfaceCreateEntityParamsLocomotive | LuaSurfaceCreateEntityParamsLogisticContainer | LuaSurfaceCreateEntityParamsParticle | LuaSurfaceCreateEntityParamsPlant | LuaSurfaceCreateEntityParamsProgrammableSpeaker | LuaSurfaceCreateEntityParamsProjectile | LuaSurfaceCreateEntityParamsRailChainSignal | LuaSurfaceCreateEntityParamsRailSignal | LuaSurfaceCreateEntityParamsResource | LuaSurfaceCreateEntityParamsRollingStock | LuaSurfaceCreateEntityParamsSimpleEntityWithForce | LuaSurfaceCreateEntityParamsSimpleEntityWithOwner | LuaSurfaceCreateEntityParamsSpeechBubble | LuaSurfaceCreateEntityParamsStream | LuaSurfaceCreateEntityParamsTileGhost | LuaSurfaceCreateEntityParamsUndergroundBelt;
18034
+ type LuaSurfaceCreateEntityParams = BaseLuaSurfaceCreateEntityParams | LuaSurfaceCreateEntityParamsArtilleryFlare | LuaSurfaceCreateEntityParamsArtilleryProjectile | LuaSurfaceCreateEntityParamsAssemblingMachine | LuaSurfaceCreateEntityParamsBeam | LuaSurfaceCreateEntityParamsCharacterCorpse | LuaSurfaceCreateEntityParamsCliff | LuaSurfaceCreateEntityParamsContainer | LuaSurfaceCreateEntityParamsElectricPole | LuaSurfaceCreateEntityParamsEntityGhost | LuaSurfaceCreateEntityParamsFire | LuaSurfaceCreateEntityParamsHighlightBox | LuaSurfaceCreateEntityParamsInserter | LuaSurfaceCreateEntityParamsItemEntity | LuaSurfaceCreateEntityParamsItemRequestProxy | LuaSurfaceCreateEntityParamsLamp | LuaSurfaceCreateEntityParamsLoader | LuaSurfaceCreateEntityParamsLoader1x1 | LuaSurfaceCreateEntityParamsLocomotive | LuaSurfaceCreateEntityParamsLogisticContainer | LuaSurfaceCreateEntityParamsParticle | LuaSurfaceCreateEntityParamsPlant | LuaSurfaceCreateEntityParamsProgrammableSpeaker | LuaSurfaceCreateEntityParamsProjectile | LuaSurfaceCreateEntityParamsProjectile | LuaSurfaceCreateEntityParamsRailChainSignal | LuaSurfaceCreateEntityParamsRailSignal | LuaSurfaceCreateEntityParamsResource | LuaSurfaceCreateEntityParamsRollingStock | LuaSurfaceCreateEntityParamsSimpleEntityWithForce | LuaSurfaceCreateEntityParamsSimpleEntityWithOwner | LuaSurfaceCreateEntityParamsSpeechBubble | LuaSurfaceCreateEntityParamsStream | LuaSurfaceCreateEntityParamsTileGhost | LuaSurfaceCreateEntityParamsUndergroundBelt;
17786
18035
  interface BaseLuaSurfaceCreateEntityParams {
17787
18036
  /**
17788
18037
  * Cause entity / force. The entity or force that triggered the chain of events that led to this entity being created. Used for beams, projectiles, stickers, etc. so that the damage receiver can know which entity or force to retaliate against.
@@ -18137,6 +18386,14 @@ interface LuaSurfaceCreateEntityParamsProjectile extends BaseLuaSurfaceCreateEnt
18137
18386
  */
18138
18387
  'speed'?: double;
18139
18388
  }
18389
+ /**
18390
+ *
18391
+ * Applies to variant case `projectile`
18392
+ */
18393
+ interface LuaSurfaceCreateEntityParamsProjectile extends BaseLuaSurfaceCreateEntityParams {
18394
+ 'base_damage_modifiers'?: TriggerModifierData;
18395
+ 'bonus_damage_modifiers'?: TriggerModifierData;
18396
+ }
18140
18397
  /**
18141
18398
  *
18142
18399
  * Applies to variant case `rail-chain-signal`
@@ -19058,6 +19315,10 @@ interface LuaTransportLine {
19058
19315
  * The entity this transport line belongs to.
19059
19316
  */
19060
19317
  readonly owner: LuaEntity;
19318
+ /**
19319
+ * Total length of segment which consists of this line, all lines in front and lines in the back directly connected.
19320
+ */
19321
+ readonly total_segment_length: double;
19061
19322
  /**
19062
19323
  * 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.
19063
19324
  */