factorio-types 1.2.53 → 1.2.55

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/README.md CHANGED
@@ -23,7 +23,7 @@ This library includes [tsconfig.base.json](https://github.com/sguest/factorio-ty
23
23
 
24
24
  ## Stages
25
25
 
26
- Factorio mods and the api go through [three distinct stages](https://lua-api.factorio.com/latest/). Types are organized into namespaces `runtime`, `prototype`, and `settings` representing the types to be used in each stage. These types, and therefore their corresponding namespaces, are a compile-time-only feature as lua does not have types, however using a type from the wrong namespace during the wrong stage is likely to result in a runtime error as you will be attempting to access something Factorio does not let you access at that time.
26
+ Factorio mods and the api go through [three distinct stages](https://lua-api.factorio.com/latest/). Types are organized into namespaces `runtime`, `prototype`, and `settings` representing the types to be used in each stage. These types, and therefore their corresponding namespaces, are a compile-time-only feature as lua does not have types, so accessing a _type_ during the wrong phase is safe. Sometimes this is OK, such as when referencing utility functions that operate on values without interacting with game API like math functions. However, many game APIs will only work with types from the correct phase, so using an API that takes types from the wrong phase should be a red flag that you might encounter a runtime error.
27
27
 
28
28
  Note there is some overlap between the types for the Settings and Prototype phases since both regularly provide prototype data to `data.extend()`, and in fact the settings-phase prototypes extend `prototype.PrototypeBase`. However, you should only be providing types from the `settings` namespace during the settings phase, and from the `prototype` namespace during the prototype phase.
29
29
 
@@ -70,6 +70,20 @@ end
70
70
 
71
71
  Factorio makes various lua functions available to mods via [LuaLib](https://github.com/wube/factorio-data/tree/master/core/lualib)
72
72
 
73
- Unlike the main parts of the factorio API, these do not exist as ambient globals but instead must be imported
73
+ Unlike the main parts of the factorio API, these do not exist as ambient globals but instead must be imported. If you inherit the recommended [tsconfig.base.json](https://github.com/sguest/factorio-types/blob/master/tsconfig.base.json), these import paths will all be set to `noResolvePaths`, meaning TSTL will not attempt to resolve them and will simply emit `require` statements that will allow Factorio to load the lualib files at runtime.
74
74
 
75
- The `noise` lualib definitions were previous present in this library. However, as of version 2.0.7, `noise.lua` was [removed from lualib in the factorio-data repo](https://github.com/wube/factorio-data/commit/7522d3763e76e09ce1a46cba676dfc2b6d12b127). This was accompanied by many of the required supporting types being removed from the prototype definitions, and therefore the noise definitions have been removed from this library, at least temporarily.
75
+ ```typescript
76
+ import { split } from 'util';
77
+
78
+ let splitStr = split('a|b', '|');
79
+ ```
80
+
81
+ ```typescript
82
+ import * as util from 'util';
83
+
84
+ let result = util.split_whitespace('a b');
85
+ ```
86
+
87
+ The LuaLib definitions are not part of the machine-readable API spec that feeds the generation of the rest of the types in this repo. The devs [have said](https://forums.factorio.com/viewtopic.php?p=599930#p599930) better docs for lualib are in their longterm plans, but for now the only documentation is the files themselves in the `factorio-data` repo and any associated comments. Therefore, the lualib docs are hand-written by reading through the files and are more likely to contain errors. If you encounter any errors, please raise an issue and/or pull request.
88
+
89
+ The `noise` lualib definitions were previously present in this library. However, as of version 2.0.7, `noise.lua` was [removed from lualib in the factorio-data repo](https://github.com/wube/factorio-data/commit/7522d3763e76e09ce1a46cba676dfc2b6d12b127). This was accompanied by many of the required supporting types being removed from the prototype definitions, and therefore the noise definitions have been removed from this library, at least temporarily.
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.72
5
+ // Factorio version 2.0.73
6
6
  // API version 6
7
7
 
8
8
  declare namespace runtime {
@@ -5120,7 +5120,7 @@ interface LuaControl {
5120
5120
  */
5121
5121
  can_reach_entity(this: void, entity: LuaEntity): boolean;
5122
5122
  /**
5123
- * Cancels crafting the given count of the given crafting queue index.
5123
+ * Cancels the given amount of crafts at the given crafting queue position. If this causes any later crafts that depend on the cancelled one to have insufficient ingredients, those crafts will also be cancelled.
5124
5124
  * @param table.index The crafting queue index.
5125
5125
  * @param table.count The count to cancel crafting.
5126
5126
  */
@@ -6327,7 +6327,7 @@ interface LuaEntity extends LuaControl {
6327
6327
  * @param index Index of the transport line. Transport lines are 1-indexed.
6328
6328
  * @param position Linear position along the transport line. Clamped to the transport line range.
6329
6329
  */
6330
- get_line_item_position(this: void, index: uint32, position: float): MapPosition;
6330
+ get_line_item_position(this: void, index: defines.transport_line, position: float): MapPosition;
6331
6331
  /**
6332
6332
  * Gets all the `LuaLogisticPoint`s that this entity owns. Optionally returns only the point specified by the index parameter.
6333
6333
  * @param index If provided, this method only returns the `LuaLogisticPoint` specified by this index, or `nil` if it doesn't exist.
@@ -6344,7 +6344,7 @@ interface LuaEntity extends LuaControl {
6344
6344
  /**
6345
6345
  * Get the maximum transport line index of a belt or belt connectable entity.
6346
6346
  */
6347
- get_max_transport_line_index(this: void): uint32;
6347
+ get_max_transport_line_index(this: void): defines.transport_line;
6348
6348
  /**
6349
6349
  * Inventory for storing modules of this entity; `nil` if this entity has no module inventory.
6350
6350
  */
@@ -6481,7 +6481,7 @@ interface LuaEntity extends LuaControl {
6481
6481
  * Get a transport line of a belt or belt connectable entity.
6482
6482
  * @param index Index of the requested transport line. Transport lines are 1-indexed.
6483
6483
  */
6484
- get_transport_line(this: void, index: uint32): LuaTransportLine;
6484
+ get_transport_line(this: void, index: defines.transport_line): LuaTransportLine;
6485
6485
  /**
6486
6486
  * Returns the new entity prototype and its quality.
6487
6487
  * @returns [0] - `nil` if this entity is not marked for upgrade.
@@ -6492,11 +6492,11 @@ interface LuaEntity extends LuaControl {
6492
6492
  LuaQualityPrototype | null
6493
6493
  ]>;
6494
6494
  /**
6495
- * Gets a single wire connector of this entity
6495
+ * Gets a single wire connector of this entity, if any.
6496
6496
  * @param wire_connector_id Identifier of a specific connector to get
6497
6497
  * @param or_create If true and connector does not exist, it will be allocated if possible
6498
6498
  */
6499
- get_wire_connector(this: void, wire_connector_id: defines.wire_connector_id, or_create: boolean): LuaWireConnector;
6499
+ get_wire_connector(this: void, wire_connector_id: defines.wire_connector_id, or_create: boolean): LuaWireConnector | null;
6500
6500
  /**
6501
6501
  * Gets all wire connectors of this entity
6502
6502
  * @param or_create If true, it will try to create all connectors possible
@@ -7486,10 +7486,10 @@ interface LuaEntity extends LuaControl {
7486
7486
  *
7487
7487
  * - When called on a pipe-connectable entity, this is an array of entity arrays of all entities a given fluidbox is connected to.
7488
7488
  * - When called on an underground transport belt, this is the other end of the underground belt connection, or `nil` if none.
7489
- * - When called on a wall-connectable entity or reactor, this is a dictionary of all connections indexed by the connection direction "north", "south", "east", and "west".
7489
+ * - When called on a wall-connectable entity, reactor or heat pipe, this is a dictionary of all connections indexed by the connection direction "north", "south", "east", and "west".
7490
7490
  * - When called on a cliff entity, this is a dictionary of all connections indexed by the connection direction "north", "south", "east", and "west".
7491
7491
  */
7492
- readonly neighbours?: Record<string, LuaEntity[]> | LuaEntity[][] | LuaEntity;
7492
+ readonly neighbours?: Record<string, LuaEntity> | LuaEntity[][] | LuaEntity;
7493
7493
  /**
7494
7494
  * 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.
7495
7495
  */
@@ -7672,7 +7672,7 @@ interface LuaEntity extends LuaControl {
7672
7672
  */
7673
7673
  readonly rocket?: LuaEntity;
7674
7674
  /**
7675
- * Number of rocket parts in the silo.
7675
+ * Number of rocket parts in this rocket silo.
7676
7676
  */
7677
7677
  rocket_parts: uint32;
7678
7678
  /**
@@ -7705,6 +7705,10 @@ interface LuaEntity extends LuaControl {
7705
7705
  * {@link LuaEntityPrototype::selection_box | runtime:LuaEntityPrototype::selection_box} around entity's given position and respecting the current entity orientation.
7706
7706
  */
7707
7707
  readonly selection_box: BoundingBox;
7708
+ /**
7709
+ * Whether this rocket silo is set to send items to orbit automatically. Only relevant if there is an item prototype with {@link launch products | runtime:LuaItemPrototype::rocket_launch_products} with automated {@link send_to_orbit_mode | runtime:LuaItemPrototype::send_to_orbit_mode}, such as the satellite in vanilla (without Space Age mod).
7710
+ */
7711
+ send_to_orbit_automatically: boolean;
7708
7712
  /**
7709
7713
  * The shooting target for this turret, if any. Can't be set to `nil` via script.
7710
7714
  */
@@ -9009,9 +9013,6 @@ interface LuaEntityPrototype extends LuaPrototypeBase {
9009
9013
  readonly ticks_to_keep_aiming_direction?: uint32;
9010
9014
  readonly ticks_to_keep_gun?: uint32;
9011
9015
  readonly ticks_to_stay_in_combat?: uint32;
9012
- /**
9013
- * The tile buildability rules of this entity prototype.
9014
- */
9015
9016
  readonly tile_buildability_rules?: TileBuildabilityRule[];
9016
9017
  /**
9017
9018
  * Specifies the tiling size of the entity, is used to decide, if the center should be in the center of the tile (odd tile size dimension) or on the tile border (even tile size dimension)
@@ -13955,7 +13956,7 @@ interface LuaLogisticPoint {
13955
13956
  /**
13956
13957
  * The Logistic member index of this logistic point.
13957
13958
  */
13958
- readonly logistic_member_index: uint32;
13959
+ readonly logistic_member_index: defines.logistic_member_index;
13959
13960
  readonly logistic_network: LuaLogisticNetwork;
13960
13961
  /**
13961
13962
  * The logistic mode.
@@ -19281,6 +19282,10 @@ interface BaseLuaSurfaceCreateEntityParams {
19281
19282
  * If provided, the entity will attempt to pull stored values from this item (for example; creating a spidertron from a previously named and mined spidertron)
19282
19283
  */
19283
19284
  'item'?: LuaItemStack;
19285
+ /**
19286
+ * Whether this entity is mirrored. Defaults to `false`.
19287
+ */
19288
+ 'mirror'?: boolean;
19284
19289
  /**
19285
19290
  * If true, any characters that are in the way of the entity are teleported out of the way.
19286
19291
  */
@@ -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.72
5
+ // Factorio version 2.0.73
6
6
  // API version 6
7
7
 
8
8
  declare namespace runtime {
@@ -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/prototype-api.json
4
4
  // Definition source https://github.com/sguest/factorio-types
5
- // Factorio version 2.0.72
5
+ // Factorio version 2.0.73
6
6
  // API version 6
7
7
 
8
8
  declare namespace prototype {
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 2.0.72
5
+ // Factorio version 2.0.73
6
6
  // API version 6
7
7
 
8
8
  declare namespace defines {
@@ -1365,6 +1365,9 @@ enum logistic_group_type {
1365
1365
  enum logistic_member_index {
1366
1366
  car_provider = 10,
1367
1367
  car_requester = 9,
1368
+ cargo_landing_pad_provider = 19,
1369
+ cargo_landing_pad_requester = 18,
1370
+ cargo_landing_pad_trash_provider = 20,
1368
1371
  character_provider = 5,
1369
1372
  character_requester = 3,
1370
1373
  character_storage = 4,
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 2.0.72
5
+ // Factorio version 2.0.73
6
6
  // API version 6
7
7
 
8
8
  declare namespace runtime {
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 2.0.72
5
+ // Factorio version 2.0.73
6
6
  // API version 6
7
7
 
8
8
  /**
@@ -0,0 +1,13 @@
1
+ // Type definitions for Factorio modding API
2
+ // Factorio API reference https://lua-api.factorio.com/latest/index.html
3
+ // Generated from JSON source https://lua-api.factorio.com/latest/runtime-api.json and https://lua-api.factorio.com/latest/prototype-api.json
4
+ // Definition source https://github.com/sguest/factorio-types
5
+
6
+ /// <reference path="./global.d.ts" />
7
+ /// <reference path="./classes.d.ts" />
8
+ /// <reference path="./concepts.d.ts" />
9
+ /// <reference path="./defines.d.ts" />
10
+ /// <reference path="./events.d.ts" />
11
+ /// <reference path="./prototypes.d.ts" />
12
+ /// <reference path="./types.d.ts" />
13
+ /// <reference path="./datacollection.d.ts" />
@@ -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/prototype-api.json
4
4
  // Definition source https://github.com/sguest/factorio-types
5
- // Factorio version 2.0.72
5
+ // Factorio version 2.0.73
6
6
  // API version 6
7
7
 
8
8
  declare namespace prototype {
@@ -3216,6 +3216,8 @@ interface EntityPrototype extends Prototype {
3216
3216
  * This allows you to replace an entity that's already placed, with a different one in your inventory. For example, replacing a burner inserter with a fast inserter. The replacement entity can be a different rotation to the replaced entity and you can replace an entity with the same type.
3217
3217
  *
3218
3218
  * This is simply a string, so any string can be used here. The entity that should be replaced simply has to use the same string here.
3219
+ *
3220
+ * Entities with the same fast replaceable group can be configured as upgrades for each other in the upgrade planner. Refer to the {@link upgrade planner prototype's page | prototype:UpgradeItemPrototype} the full requirements for entities to be shown in the upgrade planner.
3219
3221
  */
3220
3222
  fast_replaceable_group?: string;
3221
3223
  flags?: EntityPrototypeFlags;
@@ -3287,7 +3289,7 @@ interface EntityPrototype extends Prototype {
3287
3289
  mined_sound?: Sound;
3288
3290
  mining_sound?: Sound;
3289
3291
  /**
3290
- * Name of the entity that will be automatically selected as the upgrade of this entity when using the {@link upgrade planner | https://wiki.factorio.com/Upgrade_planner} without configuration.
3292
+ * Name of the entity that will be automatically selected as the upgrade of this entity when using the {@link upgrade planner | prototype:UpgradeItemPrototype} without configuration.
3291
3293
  *
3292
3294
  * This entity may not have "not-upgradable" flag set and must be minable. This entity mining result must not contain item product with {@link hidden | prototype:ItemPrototype::hidden} set to `true`. Mining results with no item products are allowed. This entity may not be a {@link RollingStockPrototype | prototype:RollingStockPrototype}.
3293
3295
  *
@@ -6517,7 +6519,7 @@ interface QualityPrototype extends Prototype {
6517
6519
  */
6518
6520
  beacon_power_usage_multiplier?: float;
6519
6521
  /**
6520
- * Only affects beacons with {@link BeaconPrototype::quality_affects_supply_area | prototype:BeaconPrototype::quality_affects_supply_area} set.
6522
+ * Only affects beacons with {@link BeaconPrototype::quality_affects_supply_area_distance | prototype:BeaconPrototype::quality_affects_supply_area_distance} set.
6521
6523
  *
6522
6524
  * Must be >= 0 and <= 64.
6523
6525
  */
@@ -6608,6 +6610,11 @@ interface QualityPrototype extends Prototype {
6608
6610
  * Must be >= 0.01.
6609
6611
  */
6610
6612
  logistic_cell_charging_energy_multiplier?: double;
6613
+ /**
6614
+ * Only affects roboports with {@link RoboportPrototype::charging_station_count_affected_by_quality | prototype:RoboportPrototype::charging_station_count_affected_by_quality} set.
6615
+ *
6616
+ * Only affects roboport equipment with {@link RoboportEquipmentPrototype::charging_station_count_affected_by_quality | prototype:RoboportEquipmentPrototype::charging_station_count_affected_by_quality} set.
6617
+ */
6611
6618
  logistic_cell_charging_station_count_bonus?: uint32;
6612
6619
  /**
6613
6620
  * Only affects mining drills with {@link MiningDrillPrototype::quality_affects_mining_radius | prototype:MiningDrillPrototype::quality_affects_mining_radius} set.
@@ -10071,6 +10078,14 @@ interface UnitPrototype extends EntityWithOwnerPrototype {
10071
10078
  }
10072
10079
  /**
10073
10080
  * An {@link upgrade planner | https://wiki.factorio.com/Upgrade_planner}.
10081
+ *
10082
+ * For an entity to be allowed as an upgrade source, it must be minable, may not have "not-upgradable" flag set and may not be {@link hidden | prototype:PrototypeBase::hidden}. Additionally, the source entity's mining result must not be an item product that is {@link hidden | prototype:ItemPrototype::hidden}. Mining results with no item products are allowed.
10083
+ *
10084
+ * For an entity to be allowed as an upgrade target, it must have least 1 item that builds it that isn't hidden.
10085
+ *
10086
+ * For two entities to be upgrades of each other, the two entities must have the same {@link fast replaceable group | prototype:EntityPrototype::fast_replaceable_group}, the same {@link collision box | prototype:EntityPrototype::collision_box} and the same {@link collision mask | prototype:EntityPrototype::collision_mask}. Additionally, {@link underground belts | prototype:UndergroundBeltPrototype} cannot be upgraded to {@link transport belts | prototype:TransportBeltPrototype} and vice versa.
10087
+ *
10088
+ * For an entity to be automatically upgraded to another entity without configuring the upgrade planner, the {@link next upgrade | prototype:EntityPrototype::next_upgrade} of the upgrade source entity must be set.
10074
10089
  */
10075
10090
  interface UpgradeItemPrototype extends SelectionToolPrototype {
10076
10091
  /**
package/dist/types.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/prototype-api.json
4
4
  // Definition source https://github.com/sguest/factorio-types
5
- // Factorio version 2.0.72
5
+ // Factorio version 2.0.73
6
6
  // API version 6
7
7
 
8
8
  declare namespace prototype {
@@ -3736,58 +3736,6 @@ interface DirectTriggerItem extends TriggerItem {
3736
3736
  filter_enabled?: boolean;
3737
3737
  type: 'direct';
3738
3738
  }
3739
- /**
3740
- * Usually specified by using {@link defines.direction | runtime:defines.direction}.
3741
- */
3742
- type Direction = /**
3743
- * North
3744
- */
3745
- 0 | /**
3746
- * NorthNorthEast
3747
- */
3748
- 1 | /**
3749
- * NorthEast
3750
- */
3751
- 2 | /**
3752
- * EastNorthEast
3753
- */
3754
- 3 | /**
3755
- * East
3756
- */
3757
- 4 | /**
3758
- * EastSouthEast
3759
- */
3760
- 5 | /**
3761
- * SouthEast
3762
- */
3763
- 6 | /**
3764
- * SouthSouthEast
3765
- */
3766
- 7 | /**
3767
- * South
3768
- */
3769
- 8 | /**
3770
- * SouthSouthWest
3771
- */
3772
- 9 | /**
3773
- * SouthWest
3774
- */
3775
- 10 | /**
3776
- * WestSouthWest
3777
- */
3778
- 11 | /**
3779
- * West
3780
- */
3781
- 12 | /**
3782
- * WestNorthWest
3783
- */
3784
- 13 | /**
3785
- * NorthWest
3786
- */
3787
- 14 | /**
3788
- * NorthNorthWest
3789
- */
3790
- 15;
3791
3739
  interface DirectionShift {
3792
3740
  east?: Vector;
3793
3741
  north?: Vector;
@@ -5157,6 +5105,9 @@ interface GigaCargoHatchDefinition {
5157
5105
  * Note that when any technology prototype changes (regardless of which mod it belongs to), the game re-applies all researched technology effects, including `"give-item"` modifiers. This means that players will receive the item again, even if they already received it previously. This can be undesirable.
5158
5106
  */
5159
5107
  interface GiveItemModifier extends BaseModifier {
5108
+ /**
5109
+ * Must be >= `1`.
5110
+ */
5160
5111
  count?: ItemCountType;
5161
5112
  item: ItemID;
5162
5113
  quality?: QualityID;
@@ -5269,7 +5220,7 @@ interface HeatConnection {
5269
5220
  /**
5270
5221
  * The "outward" direction of this heat connection. For a connection to succeed, the other heat connection must face the opposite direction (a south-facing connection needs a north-facing connection to succeed). A connection rotates with the entity.
5271
5222
  */
5272
- direction: Direction;
5223
+ direction: defines.direction;
5273
5224
  /**
5274
5225
  * The location of the heat pipe connection, relative to the center of the entity in the north-facing direction.
5275
5226
  */
@@ -6374,7 +6325,7 @@ interface MapLocation {
6374
6325
  /**
6375
6326
  * Direction this connection point will be facing to.
6376
6327
  */
6377
- direction: Direction;
6328
+ direction: defines.direction;
6378
6329
  /**
6379
6330
  * Position relative to entity's position where the connection point will be located at.
6380
6331
  */
@@ -7220,7 +7171,7 @@ interface PipeConnectionDefinition {
7220
7171
  *
7221
7172
  * Only loaded, and mandatory if `connection_type` is `"normal"` or `"underground"`.
7222
7173
  */
7223
- direction?: Direction;
7174
+ direction?: defines.direction;
7224
7175
  /**
7225
7176
  * Array of the {@link WorkingVisualisation::name | prototype:WorkingVisualisation::name} of working visualisations to enable when this pipe connection is present.
7226
7177
  *
@@ -8503,7 +8454,7 @@ interface RotatedAnimation extends AnimationParameters {
8503
8454
  *
8504
8455
  * The sequential animation instance is loaded equal to the entities direction within the `direction_count` setting.
8505
8456
  *
8506
- * Direction count to {@link Direction | prototype:Direction} (animation sequence number):
8457
+ * Direction count to {@link defines.direction | runtime:defines.direction} (animation sequence number):
8507
8458
  *
8508
8459
  * - `1`: North (1)
8509
8460
  *
@@ -10758,6 +10709,11 @@ interface TileBuildSound {
10758
10709
  medium?: Sound;
10759
10710
  small?: Sound;
10760
10711
  }
10712
+ /**
10713
+ * Defines restrictions on what tiles an entity can or must be built on.
10714
+ *
10715
+ * Note that once the entity has been placed, placing new tiles is not always restricted by these rules for performance reasons. In particular, for most entities these rules are only checked when placing tiles within the collision box of the entity. The exception to this are thrusters and asteroid collectors, for which the rules are always checked.
10716
+ */
10761
10717
  interface TileBuildabilityRule {
10762
10718
  area: SimpleBoundingBox;
10763
10719
  colliding_tiles?: CollisionMaskConnector;
package/index.d.ts CHANGED
@@ -3,15 +3,6 @@
3
3
  // Generated from JSON source https://lua-api.factorio.com/latest/runtime-api.json and https://lua-api.factorio.com/latest/prototype-api.json
4
4
  // Definition source https://github.com/sguest/factorio-types
5
5
 
6
- /// <reference path="./src/core.d.ts" />
7
- /// <reference path="./src/settings.d.ts" />
8
- /// <reference path="./src/serpent.d.ts" />
9
- /// <reference path="./dist/global.d.ts" />
10
- /// <reference path="./dist/classes.d.ts" />
11
- /// <reference path="./dist/concepts.d.ts" />
12
- /// <reference path="./dist/defines.d.ts" />
13
- /// <reference path="./dist/events.d.ts" />
14
- /// <reference path="./dist/prototypes.d.ts" />
15
- /// <reference path="./dist/types.d.ts" />
16
- /// <reference path="./dist/datacollection.d.ts" />
6
+ /// <reference path="./src/index.d.ts" />
7
+ /// <reference path="./dist/index.d.ts" />
17
8
  /// <reference types="lua-types/jit" />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "factorio-types",
3
- "version": "1.2.53",
3
+ "version": "1.2.55",
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",
@@ -23,11 +23,11 @@
23
23
  "src/**/*.d.ts",
24
24
  "dist/**/*.d.ts"
25
25
  ],
26
- "factorioVersion": "2.0.72",
26
+ "factorioVersion": "2.0.73",
27
27
  "dependencies": {
28
28
  "lua-types": "^2.13.1"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "typescript-to-lua": "^1.26.0"
32
32
  }
33
- }
33
+ }
package/src/core.d.ts CHANGED
@@ -8,17 +8,22 @@ declare namespace table {
8
8
  function compare(this: void, table1: object | [], table2: object | []): boolean;
9
9
  }
10
10
 
11
- declare const data: {
12
- raw: prototype.dataCollection,
11
+ interface DataType {
12
+ raw: prototype.dataCollection;
13
13
  extend(values: prototype.dataExtendType[]): void,
14
- };
14
+ }
15
+
16
+ declare const data: DataType;
15
17
 
16
18
  /**
17
19
  * Mapping of currently loaded mods to their version. Only exists at the data stage.
18
20
  */
19
21
  declare const mods: { [key: string] : string}
20
22
 
21
- declare const global: { [key: string]: any };
23
+ /**
24
+ * Mod-specific storage lookup that is persisted to save files https://lua-api.factorio.com/latest/auxiliary/storage.html
25
+ */
26
+ declare const storage: { [key: string]: any };
22
27
 
23
28
  declare function log(str: runtime.LocalisedString): void;
24
29
 
package/src/index.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ // Type definitions for Factorio modding API
2
+ // Factorio API reference https://lua-api.factorio.com/latest/index.html
3
+ // src mappings manually written to cover aspects not in the machine-readable API spec
4
+ // Definition source https://github.com/sguest/factorio-types
5
+
6
+ /// <reference path="./core.d.ts" />
7
+ /// <reference path="./settings.d.ts" />
8
+ /// <reference path="./serpent.d.ts" />
9
+ /// <reference path="./lualib/index.d.ts" />
@@ -0,0 +1,32 @@
1
+ // https://github.com/wube/factorio-data/blob/master/core/lualib/autoplace_utils.lua
2
+ declare module "autoplace_utils" {
3
+ export interface AutoplacePeakValue {
4
+ influence: number;
5
+ richness_influence: number;
6
+ min_influence: number;
7
+ temperature_optimal: number;
8
+ temperature_range: number;
9
+ temperature_max_range: number;
10
+ water_optimal: number;
11
+ water_range: number;
12
+ water_max_range: number;
13
+ }
14
+
15
+ export type RectangleSpecification = [[number, number], [number, number], number?];
16
+
17
+ /**
18
+ * Add a list of autoplace peaks based on rectangles to the table ret.
19
+ * Rectangles is a table of rectangle specifications:
20
+ * {{max_temp, max_water}, {min_temp, min_water}, influence}
21
+ * temperatures range from 35 to -25 (°C), water from 0 to 1.
22
+ * the peak resulting from each rectangle has a preset influence
23
+ * within the rectangle and goes to zero after 5°C or 0.1 water level outside
24
+ * of the rectangle.
25
+ * Influence is optional and has default value of default_influence or 1.
26
+ */
27
+ export function peaks(
28
+ this: void,
29
+ rectangles: RectangleSpecification[],
30
+ ret: AutoplacePeakValue[],
31
+ default_influence?: number): AutoplacePeakValue[];
32
+ }