factorio-types 0.0.16 → 0.0.20

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.
@@ -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.46
5
+ // Factorio version 1.1.51
6
6
  // API version 1
7
7
 
8
8
  /**
@@ -599,6 +599,7 @@ type CollisionMask = {[key in CollisionMaskLayer]: boolean}
599
599
 
600
600
  /**
601
601
  * A {@link string | string} specifying a collision mask layer.
602
+ *
602
603
  * Possible values for the string are:
603
604
  * - `"ground-tile"`
604
605
  * - `"water-tile"`
@@ -613,12 +614,14 @@ type CollisionMask = {[key in CollisionMaskLayer]: boolean}
613
614
  * - `"rail-layer"`
614
615
  * - `"transport-belt-layer"`
615
616
  * - `"not-setup"`
617
+ *
616
618
  * Additionally the values `"layer-13"` through `"layer-55"`. These layers are currently unused by the game but may change. If a mod is going to use one of the unused layers it's recommended to start at the higher layers because the base game will take from the lower ones.
617
619
  */
618
620
  type CollisionMaskLayer = 'ground-tile' | 'water-tile' | 'resource-layer' | 'doodad-layer' | 'floor-layer' | 'item-layer' | 'ghost-layer' | 'object-layer' | 'player-layer' | 'train-layer' | 'rail-layer' | 'transport-belt-layer' | 'not-setup' | 'layer-13' | 'layer-14' | 'layer-15' | 'layer-16' | 'layer-17' | 'layer-18' | 'layer-19' | 'layer-20' | 'layer-21' | 'layer-22' | 'layer-23' | 'layer-24' | 'layer-25' | 'layer-26' | 'layer-27' | 'layer-28' | 'layer-29' | 'layer-30' | 'layer-31' | 'layer-32' | 'layer-33' | 'layer-34' | 'layer-35' | 'layer-36' | 'layer-37' | 'layer-38' | 'layer-39' | 'layer-40' | 'layer-41' | 'layer-42' | 'layer-43' | 'layer-44' | 'layer-45' | 'layer-46' | 'layer-47' | 'layer-48' | 'layer-49' | 'layer-50' | 'layer-51' | 'layer-52' | 'layer-53' | 'layer-54' | 'layer-55'
619
621
 
620
622
  /**
621
623
  * A {@link CollisionMask | CollisionMask} but also includes any flags this mask has.
624
+ *
622
625
  * Flags such as:
623
626
  * - `"not-colliding-with-itself"`
624
627
  * - `"consider-tile-transitions"`
@@ -628,6 +631,7 @@ type CollisionMaskWithFlags = CollisionMask & {[key:string]: true}
628
631
 
629
632
  /**
630
633
  * Red, green, blue and alpha values, all in range [0, 1] or all in range [0, 255] if any value is > 1. All values here are optional. Color channels default to `0`, the alpha channel defaults to `1`.
634
+ *
631
635
  * Similar to {@link Position | Position}, Color allows the short-hand notation of passing an array of exactly 3 or 4 numbers. The game usually expects colors to be in pre-multiplied form (color channels are pre-multiplied by alpha).
632
636
  * @example
633
637
  * ```
@@ -991,7 +995,9 @@ interface EnemyEvolutionMapSettings {
991
995
 
992
996
  /**
993
997
  * Candidate chunks are given scores to determine which one of them should be expanded into. This score takes into account various settings noted below. The iteration is over a square region centered around the chunk for which the calculation is done, and includes the central chunk as well. Distances are calculated as {@link Manhattan distance | https://en.wikipedia.org/wiki/Taxicab_geometry}.
998
+ *
994
999
  * The pseudocode algorithm to determine a chunk's score is as follows:
1000
+ *
995
1001
  * ```
996
1002
  * player = 0
997
1003
  * for neighbour in all chunks within enemy_building_influence_radius from chunk:
@@ -1145,6 +1151,7 @@ interface EventData {
1145
1151
 
1146
1152
  /**
1147
1153
  * Used to filter out irrelevant event callbacks in a performant way.
1154
+ *
1148
1155
  * Available filters:
1149
1156
  * - {@link LuaEntityClonedEventFilter | LuaEntityClonedEventFilter}
1150
1157
  * - {@link LuaEntityDamagedEventFilter | LuaEntityDamagedEventFilter}
@@ -1599,11 +1606,15 @@ interface ItemStackLocation {
1599
1606
 
1600
1607
  /**
1601
1608
  * Localised strings are a way to support translation of in-game text. It is an array where the first element is the key and the remaining elements are parameters that will be substituted for placeholders in the template designated by the key.
1609
+ *
1602
1610
  * The key identifies the string template. For example, `"gui-alert-tooltip.attack"` (for the template `"__1__
1603
1611
  * objects are being damaged"`; see the file `data/core/locale/en.cfg`).
1604
- * 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 cannot be recursed deeper than 20 levels and cannot have more than 20 parameters.
1612
+ *
1613
+ * 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.
1614
+ *
1605
1615
  * 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.
1606
- * 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, or number which will be converted to its textual representation.
1616
+ *
1617
+ * 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 or boolean, which will be converted to their textual representation.
1607
1618
  * @example
1608
1619
  * In the English translation, this will print `"No ammo"`; in the Czech translation, it will print `"Bez munice"`:
1609
1620
  * ```
@@ -1651,6 +1662,18 @@ interface LogisticFilter {
1651
1662
  'name': string
1652
1663
  }
1653
1664
 
1665
+ /**
1666
+ * @param name - The item. `nil` clears the filter.
1667
+ */
1668
+ interface LogisticParameters {
1669
+ 'max'?: number
1670
+ 'min'?: number
1671
+ /**
1672
+ * The item. `nil` clears the filter.
1673
+ */
1674
+ 'name'?: string
1675
+ }
1676
+
1654
1677
  /**
1655
1678
  * @param count_max - Maximum amount of loot to drop.
1656
1679
  * @param count_min - Minimum amount of loot to drop.
@@ -1876,16 +1899,30 @@ type LuaSectorScannedEventFilter = LuaSectorScannedEventFilterGhostName | LuaSec
1876
1899
  */
1877
1900
  type LuaUpgradeCancelledEventFilter = LuaUpgradeCancelledEventFilterGhostName | LuaUpgradeCancelledEventFilterGhostType | LuaUpgradeCancelledEventFilterName | LuaUpgradeCancelledEventFilterType | DefaultLuaUpgradeCancelledEventFilter
1878
1901
 
1902
+ /**
1903
+ * All regular {@link MapSettings | MapSettings} plus an additional table that contains the {@link DifficultySettings | DifficultySettings}.
1904
+ * @param max_failed_behavior_count - If a behavior fails this many times, the enemy (or enemy group) is destroyed. This solves biters getting stuck within their own base.
1905
+ */
1906
+ interface MapAndDifficultySettings {
1907
+ 'difficulty_settings': DifficultySettings
1908
+ 'enemy_evolution': EnemyEvolutionMapSettings
1909
+ 'enemy_expansion': EnemyExpansionMapSettings
1910
+ /**
1911
+ * If a behavior fails this many times, the enemy (or enemy group) is destroyed. This solves biters getting stuck within their own base.
1912
+ */
1913
+ 'max_failed_behavior_count': number
1914
+ 'path_finder': PathFinderMapSettings
1915
+ 'pollution': PollutionMapSettings
1916
+ 'steering': SteeringMapSettings
1917
+ 'unit_group': UnitGroupMapSettings
1918
+ }
1919
+
1879
1920
  /**
1880
1921
  * The data that can be extracted from a map exchange string, as a plain table.
1881
- * @param map_settings - All the regular map settings plus an additional table called `difficulty_settings` that contains the [DifficultySettings](DifficultySettings).
1882
1922
  */
1883
1923
  interface MapExchangeStringData {
1884
1924
  'map_gen_settings': MapGenSettings
1885
- /**
1886
- * All the regular map settings plus an additional table called `difficulty_settings` that contains the {@link DifficultySettings | DifficultySettings}.
1887
- */
1888
- 'map_settings': MapSettings
1925
+ 'map_settings': MapAndDifficultySettings
1889
1926
  }
1890
1927
 
1891
1928
  /**
@@ -2003,7 +2040,9 @@ interface MapGenSettings {
2003
2040
 
2004
2041
  /**
2005
2042
  * A floating point number specifying an amount.
2043
+ *
2006
2044
  * For backwards compatibility, MapGenSizes can also be specified as one of the following strings, which will be converted to a number (when queried, a number will always be returned):
2045
+ *
2007
2046
  * - `"none"` - equivalent to `0`
2008
2047
  * - `"very-low"`, `"very-small"`, `"very-poor"` - equivalent to `1/2`
2009
2048
  * - `"low"`, `"small"`, `"poor"` - equivalent to `1/sqrt(2)`
@@ -2016,6 +2055,14 @@ interface MapGenSettings {
2016
2055
  */
2017
2056
  type MapGenSize = number | 'none' | 'very-low' | 'very-small' | 'very-poor' | 'low' | 'small' | 'poor' | 'normal' | 'medium' | 'regular' | 'high' | 'big' | 'good' | 'very-high' | 'very-big' | 'very-good'
2018
2057
 
2058
+ /**
2059
+ * Coordinates of an entity on a map. This uses the same format as {@link Position | Position}, meaning it can be specified either with or without explicit keys.
2060
+ */
2061
+ interface MapPosition {
2062
+ 'x': number
2063
+ 'y': number
2064
+ }
2065
+
2019
2066
  /**
2020
2067
  * Various game-related settings. Updating any of the attributes will immediately take effect in the game engine.
2021
2068
  * @param max_failed_behavior_count - If a behavior fails this many times, the enemy (or enemy group) is destroyed. This solves biters getting stuck within their own base.
@@ -2121,8 +2168,11 @@ interface ModuleEffects {
2121
2168
 
2122
2169
  /**
2123
2170
  * This is a set of flags given as a dictionary{@link [string | string} → {@link boolean | boolean}]. When a flag is set, it is present in the dictionary with the value `true`. Unset flags aren't present in the dictionary at all.
2171
+ *
2124
2172
  * To write to this, use an array{@link [string | string}] of the mouse buttons that should be possible to use with on button.
2173
+ *
2125
2174
  * When setting flags, the flag `"left-and-right"` can also be set which will set `"left"` and `"right"` true.
2175
+ *
2126
2176
  * Possible flags when reading are:
2127
2177
  * - `"left"`
2128
2178
  * - `"right"`
@@ -2194,7 +2244,7 @@ interface OldTileAndPosition {
2194
2244
  * @param direct_distance_to_consider_short_request - The maximum direct distance in tiles before a request is no longer considered short. Defaults to `100`.
2195
2245
  * @param enemy_with_different_destination_collision_penalty - A penalty that is applied for another unit that is too close and either not moving or has a different goal. Defaults to `30`.
2196
2246
  * @param extended_collision_penalty - The collision penalty for collisions in the extended bounding box but outside the entity's actual bounding box. Defaults to `3`.
2197
- * @param fwd2bwd_ratio - Determines whether forwards (`>1`), backwards (`<-1`), or symmetrical (`1`) search is preferred. Defaults to `5`.
2247
+ * @param fwd2bwd_ratio - The pathfinder performs a step of the backward search every `fwd2bwd_ratio`'th step. The minimum allowed value is `2`, which means symmetric search. The default value is `5`.
2198
2248
  * @param general_entity_collision_penalty - The general collision penalty with other units. Defaults to `10`.
2199
2249
  * @param general_entity_subsequent_collision_penalty - The collision penalty for positions that require the destruction of an entity to get to. Defaults to `3`.
2200
2250
  * @param goal_pressure_ratio - When looking at which node to check next, their heuristic value is multiplied by this ratio. The higher it is, the more the search is directed straight at the goal. Defaults to `2`.
@@ -2254,7 +2304,7 @@ interface PathFinderMapSettings {
2254
2304
  */
2255
2305
  'extended_collision_penalty': number
2256
2306
  /**
2257
- * Determines whether forwards (`>1`), backwards (`<-1`), or symmetrical (`1`) search is preferred. Defaults to `5`.
2307
+ * The pathfinder performs a step of the backward search every `fwd2bwd_ratio`'th step. The minimum allowed value is `2`, which means symmetric search. The default value is `5`.
2258
2308
  */
2259
2309
  'fwd2bwd_ratio': number
2260
2310
  /**
@@ -2405,18 +2455,6 @@ interface PathfinderWaypoint {
2405
2455
  'position': Position
2406
2456
  }
2407
2457
 
2408
- /**
2409
- * @param name - The item. `nil` clears the filter.
2410
- */
2411
- interface PersonalLogisticParameters {
2412
- 'max'?: number
2413
- 'min'?: number
2414
- /**
2415
- * The item. `nil` clears the filter.
2416
- */
2417
- 'name'?: string
2418
- }
2419
-
2420
2458
  /**
2421
2459
  * @param result - The tile prototype.
2422
2460
  */
@@ -2586,6 +2624,7 @@ interface ProgrammableSpeakerParameters {
2586
2624
 
2587
2625
  /**
2588
2626
  * The smooth orientation. It is a {@link float | float} in the range `[0, 1)` that covers a full circle, starting at the top and going clockwise. This means a value of `0` indicates "north", a value of `0.5` indicates "south".
2627
+ *
2589
2628
  * For example then, a value of `0.625` would indicate "south-west", and a value of `0.875` would indicate "north-west".
2590
2629
  */
2591
2630
  type RealOrientation = number
@@ -2602,6 +2641,7 @@ type RecipePrototypeFilter = RecipePrototypeFilterCategory | RecipePrototypeFilt
2602
2641
 
2603
2642
  /**
2604
2643
  * A value between 0 and 255 inclusive represented by one of the following named {@link string | string} or string version of the value (for example `"27"` and `"decals"` are both valid). Higher values are rendered on top of lower values.
2644
+ *
2605
2645
  * - `"water-tile"`: 15
2606
2646
  * - `"ground-tile"`: 25
2607
2647
  * - `"tile-transition"`: 26
@@ -2827,9 +2867,11 @@ interface SmokeSource {
2827
2867
 
2828
2868
  /**
2829
2869
  * A sound defined by a {@link string | string}. It can be either the name of a {@link sound prototype | https://wiki.factorio.com/Prototype/Sound} defined in the data stage or a path in the form `"type/name"`. The latter option can be sorted into three categories.
2870
+ *
2830
2871
  * The utility and ambient types each contain general use sound prototypes defined by the game itself.
2831
2872
  * - `"utility"` - Uses the {@link UtilitySounds | https://wiki.factorio.com/Prototype/UtilitySounds} prototype. Example: `"utility/wire_connect_pole"`
2832
2873
  * - `"ambient"` - Uses {@link AmbientSound | https://wiki.factorio.com/Prototype/AmbientSound} prototypes. Example: `"ambient/resource-deficiency"`
2874
+ *
2833
2875
  * The following types can be combined with any tile name as long as its prototype defines the
2834
2876
  * corresponding sound.
2835
2877
  * - `"tile-walking"` - Uses {@link Tile::walking_sound | https://wiki.factorio.com/Prototype/Tile#walking_sound}. Example: `"tile-walking/concrete"`
@@ -2837,6 +2879,7 @@ interface SmokeSource {
2837
2879
  * - `"tile-build-small"` - Uses {@link Tile::build_sound | https://wiki.factorio.com/Prototype/Tile#build_sound}. Example: `"tile-build-small/concrete"`
2838
2880
  * - `"tile-build-medium"` - Uses {@link Tile::build_sound | https://wiki.factorio.com/Prototype/Tile#build_sound}
2839
2881
  * - `"tile-build-large"` - Uses {@link Tile::build_sound | https://wiki.factorio.com/Prototype/Tile#build_sound}
2882
+ *
2840
2883
  * The following types can be combined with any entity name as long as its prototype defines the
2841
2884
  * corresponding sound.
2842
2885
  * - `"entity-build"` - Uses {@link Entity::build_sound | https://wiki.factorio.com/Prototype/Entity#build_sound}. Example: `"entity-build/wooden-chest"`
@@ -2879,6 +2922,7 @@ interface SpawnPointDefinition {
2879
2922
 
2880
2923
  /**
2881
2924
  * It is specified by {@link string | string}. It can be either the name of a {@link sprite prototype | https://wiki.factorio.com/Prototype/Sprite} defined in the data stage or a path in form "type/name".
2925
+ *
2882
2926
  * The supported types are:
2883
2927
  * - `"item"` - for example "item/iron-plate" is the icon sprite of iron plate
2884
2928
  * - `"entity"` - for example "entity/small-biter" is the icon sprite of the small biter
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.46
5
+ // Factorio version 1.1.51
6
6
  // API version 1
7
7
 
8
8
  declare namespace defines {
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.46
5
+ // Factorio version 1.1.51
6
6
  // API version 1
7
7
 
8
8
  /**
@@ -274,6 +274,7 @@ interface on_cutscene_cancelled extends event {
274
274
  }
275
275
  /**
276
276
  * Called when a cutscene is playing, each time it reaches a waypoint in that cutscene.
277
+ *
277
278
  * This refers to an index in the table previously passed to set_controller which started the cutscene.
278
279
  * @remarks
279
280
  * Due to implementation omission, waypoint_index is 0-based.
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.46
5
+ // Factorio version 1.1.51
6
6
  // API version 1
7
7
 
8
8
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "factorio-types",
3
- "version": "0.0.16",
3
+ "version": "0.0.20",
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",