factorio-types 0.0.45 → 0.0.47

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/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 1.1.100
5
+ // Factorio version 1.1.102
6
6
  // API version 4
7
7
 
8
8
  declare namespace prototype {
@@ -454,6 +454,67 @@ interface AnimationSheet extends AnimationParameters{
454
454
  variation_count: number
455
455
  }
456
456
 
457
+ /**
458
+ * @example
459
+ * ```
460
+ * -- array of animations
461
+ * animations =
462
+ * {
463
+ * {
464
+ * filename = "__base__/graphics/entity/explosion-gunshot/explosion-gunshot.png",
465
+ * draw_as_glow = true,
466
+ * priority = "extra-high",
467
+ * width = 34,
468
+ * height = 38,
469
+ * frame_count = 2,
470
+ * animation_speed = 1.5,
471
+ * shift = {0, 0}
472
+ * },
473
+ * {
474
+ * filename = "__base__/graphics/entity/explosion-gunshot/explosion-gunshot.png",
475
+ * draw_as_glow = true,
476
+ * priority = "extra-high",
477
+ * width = 34,
478
+ * height = 38,
479
+ * x = 34 * 2,
480
+ * frame_count = 2,
481
+ * animation_speed = 1.5,
482
+ * shift = {0, 0}
483
+ * },
484
+ * -- [...]
485
+ * }
486
+ * ```
487
+ *
488
+ * @example
489
+ * ```
490
+ * -- animation sheet using "sheet"
491
+ * pictures =
492
+ * {
493
+ * sheet =
494
+ * {
495
+ * filename = "__base__/graphics/entity/character/footprints.png",
496
+ * line_length = 2,
497
+ * frame_count = 2,
498
+ * width = 15,
499
+ * height = 11,
500
+ * shift = util.by_pixel(0.5, 0.5),
501
+ * variation_count = 8,
502
+ * hr_version =
503
+ * {
504
+ * filename = "__base__/graphics/entity/character/hr-footprints.png",
505
+ * line_length = 2,
506
+ * frame_count = 2,
507
+ * width = 30,
508
+ * height = 22,
509
+ * shift = util.by_pixel(0.25, 0.25),
510
+ * scale = 0.5,
511
+ * variation_count = 8
512
+ * }
513
+ * }
514
+ * }
515
+ * ```
516
+ *
517
+ */
457
518
  type AnimationVariations = {
458
519
 
459
520
  /**
@@ -467,6 +528,13 @@ type AnimationVariations = {
467
528
  sheets?: AnimationSheet[]
468
529
  } | Animation | Animation[]
469
530
 
531
+ /**
532
+ * A union of all prototypes. A specific prototype is loaded based on the value of the `type` key.
533
+ *
534
+ * See the {@link Prototypes page | prototype:prototypes} for more information.
535
+ */
536
+ type AnyPrototype = PrototypeBase | AmbientSound | AnimationPrototype | EditorControllerPrototype | FontPrototype | GodControllerPrototype | MapGenPresets | MapSettings | MouseCursor | SoundPrototype | SpectatorControllerPrototype | SpritePrototype | TileEffectDefinition | TipsAndTricksItemCategory | TriggerTargetType | WindSound
537
+
470
538
  interface AreaTriggerItem extends TriggerItem{
471
539
  collision_mode?: 'distance-from-collision-box' | 'distance-from-center',
472
540
  radius: number,
@@ -1054,7 +1122,7 @@ Only loaded if `icons` is not defined.
1054
1122
  icon_mipmaps?: IconMipMapType,
1055
1123
 
1056
1124
  /**
1057
- * The size of the square icon, in pixels, e.g. `32` for a 32px by 32px icon.
1125
+ * The size of the square icon, in pixels. E.g. `32` for a 32px by 32px icon.
1058
1126
 
1059
1127
  Only loaded if `icons` is not defined, or if `icon_size` is not specified for all instances of `icons`.
1060
1128
  */
@@ -1456,7 +1524,7 @@ Only loaded if `fuel_categories` is not defined.
1456
1524
  smoke?: SmokeSource[],
1457
1525
 
1458
1526
  /**
1459
- * This is mandatory if the energy source can be loaded as multiple energy source types.
1527
+ * This is only loaded, and mandatory if the energy source can be loaded as multiple energy source types.
1460
1528
  */
1461
1529
  type?: 'burner'
1462
1530
  }
@@ -1849,7 +1917,7 @@ type CollisionMaskLayer = 'ground-tile' | 'water-tile' | 'resource-layer' | 'doo
1849
1917
  /**
1850
1918
  * Table of red, green, blue, and alpha float values between 0 and 1. Alternatively, values can be from 0-255, they are interpreted as such if at least one value is `> 1`.
1851
1919
  *
1852
- * Color allows the short-hand notation of passing an array of exactly 3 or 4 numbers.
1920
+ * Color allows the short-hand notation of passing an array of exactly 3 or 4 numbers. The array items are r, g, b and optionally a, in that order.
1853
1921
  *
1854
1922
  * The game usually expects colors to be in pre-multiplied form (color channels are pre-multiplied by alpha).
1855
1923
  * @example
@@ -2247,6 +2315,33 @@ type DamageTypeFilters = {
2247
2315
  */
2248
2316
  type DamageTypeID = string
2249
2317
 
2318
+ /**
2319
+ * The data table is read by the game to load all prototypes.
2320
+ *
2321
+ * At the end of the prototype stage, the data table is loaded by the game engine and the format of the prototypes is validated. Any extra properties are ignored. See {@link Data Lifecycle | runtime:data-lifecycle} for more information.
2322
+ *
2323
+ * The data table and its properties are defined in Lua, so their source code can be viewed in {@link dataloader.lua | https://github.com/wube/factorio-data/blob/master/core/lualib/dataloader.lua}.
2324
+ */
2325
+ interface Data {
2326
+
2327
+ /**
2328
+ * The primary way to add prototypes to the data table.
2329
+ */
2330
+ extend: DataExtendMethod,
2331
+
2332
+ /**
2333
+ * Set by the game based on whether the demo or retail version is running. Should not be used by mods.
2334
+ */
2335
+ is_demo: boolean,
2336
+
2337
+ /**
2338
+ * A dictionary of prototype types to values that themselves are dictionaries of prototype names to specific prototypes.
2339
+
2340
+ This means that individual prototypes can be accessed with `local prototype = data.raw["prototype-type"]["internal-name"]`.
2341
+ */
2342
+ raw: {[key: string]: {[key: string]: AnyPrototype}}
2343
+ }
2344
+
2250
2345
  /**
2251
2346
  * The first member of the tuple states at which time of the day the LUT should be used. If the current game time is between two values defined in the color lookup that have different LUTs, the color is interpolated to create a smooth transition. (Sharp transition can be achieved by having the two values differing only by a small fraction.)
2252
2347
  *
@@ -2411,6 +2506,17 @@ interface DropDownStyleSpecification extends BaseStyleSpecification{
2411
2506
 
2412
2507
  /**
2413
2508
  * When applied to modules, the resulting effect is a sum of all module affects, multiplied through calculations: `(1 + sum module effects)` or, for productivity `(0 + sum)`.
2509
+ * @example
2510
+ * ```
2511
+ * effect =
2512
+ * {
2513
+ * productivity = {bonus = 0.04},
2514
+ * consumption = {bonus = 0.4},
2515
+ * pollution = {bonus = 0.05},
2516
+ * speed = {bonus = -0.05}
2517
+ * }
2518
+ * ```
2519
+ *
2414
2520
  */
2415
2521
  interface Effect {
2416
2522
 
@@ -2455,11 +2561,44 @@ type EffectTypeLimitation = /* Modules that increase or decrease the machine's s
2455
2561
  interface EffectValue {
2456
2562
 
2457
2563
  /**
2458
- * Precision is ignored beyond two decimals - 17.567 results in 17.56 etc.
2564
+ * Precision is ignored beyond two decimals - `0.567` results in `0.56` etc.
2459
2565
  */
2460
2566
  bonus?: number
2461
2567
  }
2462
2568
 
2569
+ /**
2570
+ * @example
2571
+ * ```
2572
+ * energy_source = -- energy source of oil pumpjack
2573
+ * {
2574
+ * type = "electric",
2575
+ * emissions_per_minute = 10,
2576
+ * usage_priority = "secondary-input"
2577
+ * }
2578
+ * ```
2579
+ *
2580
+ * @example
2581
+ * ```
2582
+ * energy_source = -- energy source of accumulator
2583
+ * {
2584
+ * type = "electric",
2585
+ * buffer_capacity = "5MJ",
2586
+ * usage_priority = "tertiary",
2587
+ * input_flow_limit = "300kW",
2588
+ * output_flow_limit = "300kW"
2589
+ * }
2590
+ * ```
2591
+ *
2592
+ * @example
2593
+ * ```
2594
+ * energy_source = -- energy source of steam engine
2595
+ * {
2596
+ * type = "electric",
2597
+ * usage_priority = "secondary-output"
2598
+ * }
2599
+ * ```
2600
+ *
2601
+ */
2463
2602
  interface ElectricEnergySource extends BaseEnergySource{
2464
2603
 
2465
2604
  /**
@@ -2483,7 +2622,7 @@ interface ElectricEnergySource extends BaseEnergySource{
2483
2622
  output_flow_limit?: Energy,
2484
2623
 
2485
2624
  /**
2486
- * This is mandatory if the energy source can be loaded as multiple energy source types.
2625
+ * This is only loaded, and mandatory if the energy source can be loaded as multiple energy source types.
2487
2626
  */
2488
2627
  type?: 'electric',
2489
2628
  usage_priority: ElectricUsagePriority
@@ -2749,7 +2888,7 @@ interface EnemyExpansionSettings {
2749
2888
  /**
2750
2889
  * Specifies an amount of electric energy in joules, or electric energy per time in watts.
2751
2890
  *
2752
- * Internally, the input in `Watt` or `Joule/second` is always converted into `Joule/tick` or `Joule/(1/60)second`, using the following formula: `Power in Joule/tick = Power in Watt / 60`. See {@link Power | https://wiki.factorio.com/Units#Power}.
2891
+ * Internally, the input in `Watt` or `Joule/second` is always converted into `Joule/tick`, where 1 second is equal to 60 ticks. This means it uses the following formula: `Power in Joule/tick = Power in Watt / 60`. See {@link Power | https://wiki.factorio.com/Units#Power}.
2753
2892
  *
2754
2893
  * Supported Multipliers:
2755
2894
  *
@@ -2772,6 +2911,9 @@ interface EnemyExpansionSettings {
2772
2911
  * ```
2773
2912
  * buffer_capacity = "5MJ"
2774
2913
  * input_flow_limit = "300W"
2914
+ * -- the following two lines result in the same power consumption:
2915
+ * energy_usage = "60W"
2916
+ * energy_usage = "1J" -- not recommended, Watt is convention for power
2775
2917
  * ```
2776
2918
  *
2777
2919
  */
@@ -2799,13 +2941,19 @@ type EntityID = string
2799
2941
 
2800
2942
  /**
2801
2943
  * An array containing the following values.
2944
+ *
2945
+ * If an entity is a {@link building | runtime:LuaEntityPrototype::is_building} and has the `"player-creation"` flag set, it is considered for multiple enemy/unit behaviors:
2946
+ *
2947
+ * - Autonomous enemy attacks (usually triggered by pollution) can only attack within chunks that contain at least one entity that is both a building and a player-creation.
2948
+ *
2949
+ * - Enemy expansion considers entities that are both buildings and player-creations as "enemy" entities that may block expansion.
2802
2950
  * @example
2803
2951
  * ```
2804
2952
  * flags = {"placeable-neutral", "player-creation"}
2805
2953
  * ```
2806
2954
  *
2807
2955
  */
2808
- type EntityPrototypeFlags = Array</* Can't be rotated before or after placing. */ 'not-rotatable' | /* Determines the default force when placing entities in the map editor and using the *AUTO* option for the force. */ 'placeable-neutral' | /* Determines the default force when placing entities in the map editor and using the *AUTO* option for the force. */ 'placeable-player' | /* Determines the default force when placing entities in the map editor and using the *AUTO* option for the force. */ 'placeable-enemy' | /* Refers to the fact that most entities are placed on an invisible 'grid' within the world, entities with this flag do not have to line up with this grid (like trees and land-mines). */ 'placeable-off-grid' | /* Makes it possible for the biter AI to target the entity as a distraction in distraction mode {@link by_anything | runtime:defines.distraction.by_anything}. Makes it possible to blueprint, deconstruct, and repair the entity (can be turned off again using the specific flags). Enables smoke to be created automatically when building the entity. If the entity does not have {@link EntityPrototype::map_color | prototype:EntityPrototype::map_color} set, this flag makes the entity appear on the map/minimap with the default color specified in the {@link UtilityConstants | prototype:UtilityConstants}. Entities that are {@link buildings | runtime:LuaEntityPrototype::is_building} and have this flag set are considered for multiple enemy/unit behaviors: [1] Autonomous enemy attacks (usually triggered by pollution) can only attack within chunks that contain at least one entity that is both a building and a player-creation. [2] Enemy expansion considers entities that are both buildings and player-creations as "enemy" entities that may block expansion. */ 'player-creation' | /* Uses 45 degree angle increments when selecting direction. */ 'building-direction-8-way' | /* Used to automatically detect the proper direction, if possible. Used by base with the pump, train stop, and train signal. */ 'filter-directions' | /* Fast replace will not apply when building while moving. */ 'fast-replaceable-no-build-while-moving' | /* This is used to specify that the entity breathes air, and so is affected by poison (currently {@link poison capsules | https://wiki.factorio.com/Poison_capsule} are the only source). */ 'breaths-air' | /* Used to specify that the entity can not be 'healed' by repair-packs (or construction robots with repair packs) */ 'not-repairable' | /* The entity does not get drawn on the map. */ 'not-on-map' | /* The entity can not be deconstructed. */ 'not-deconstructable' | /* The entity can not be used in blueprints. */ 'not-blueprintable' | /* Hides the entity from the bonus GUI (button above the map) and from the made in property of recipe tooltips. */ 'hidden' | /* Hides the alt-info of an entity in alt-mode, for example the recipe icon. */ 'hide-alt-info' | /* Do not fast replace over other entity types when building while moving. */ 'fast-replaceable-no-cross-type-while-moving' | 'no-gap-fill-while-building' | /* Do not apply fire stickers to the entity. */ 'not-flammable' | /* Prevents inserters and loaders from taking items from this entity. */ 'no-automated-item-removal' | /* Prevents inserters and loaders from inserting items into this entity. */ 'no-automated-item-insertion' | /* This flag does nothing when set in the data stage because it gets overridden by {@link EntityPrototype::allow_copy_paste | prototype:EntityPrototype::allow_copy_paste}. Thus, it must be set on the entity via that property. */ 'no-copy-paste' | /* Disallows selection of the entity even when a selection box is specified for other reasons. For example, selection boxes are used to determine the size of outlines to be shown when highlighting entities inside electric pole ranges. This flag does nothing when set in the data stage because it gets overridden by {@link EntityPrototype::selectable_in_game | prototype:EntityPrototype::selectable_in_game}. Thus, it must be set on the entity via that property. */ 'not-selectable-in-game' | /* The entity can't be selected by the {@link upgrade planner | https://wiki.factorio.com/Upgrade_planner}. */ 'not-upgradable' | /* The entity is not shown in the kill statistics. */ 'not-in-kill-statistics' | /* The entity is not shown in the made in property of recipe tooltips. */ 'not-in-made-in'>
2956
+ type EntityPrototypeFlags = Array</* Can't be rotated before or after placing. */ 'not-rotatable' | /* Determines the default force when placing entities in the map editor and using the *AUTO* option for the force. */ 'placeable-neutral' | /* Determines the default force when placing entities in the map editor and using the *AUTO* option for the force. */ 'placeable-player' | /* Determines the default force when placing entities in the map editor and using the *AUTO* option for the force. */ 'placeable-enemy' | /* Refers to the fact that most entities are placed on an invisible 'grid' within the world, entities with this flag do not have to line up with this grid (like trees and land-mines). */ 'placeable-off-grid' | /* Makes it possible for the biter AI to target the entity as a distraction in distraction mode {@link by_anything | runtime:defines.distraction.by_anything}. Makes it possible to blueprint, deconstruct, and repair the entity (can be turned off again using the specific flags). Enables smoke to be created automatically when building the entity. If the entity does not have {@link EntityPrototype::map_color | prototype:EntityPrototype::map_color} set, this flag makes the entity appear on the map/minimap with the default color specified in the {@link UtilityConstants | prototype:UtilityConstants}. */ 'player-creation' | /* Uses 45 degree angle increments when selecting direction. */ 'building-direction-8-way' | /* Used to automatically detect the proper direction, if possible. Used by base with the pump, train stop, and train signal. */ 'filter-directions' | /* Fast replace will not apply when building while moving. */ 'fast-replaceable-no-build-while-moving' | /* This is used to specify that the entity breathes air, and so is affected by poison (currently {@link poison capsules | https://wiki.factorio.com/Poison_capsule} are the only source). */ 'breaths-air' | /* Used to specify that the entity can not be 'healed' by repair-packs (or construction robots with repair packs) */ 'not-repairable' | /* The entity does not get drawn on the map. */ 'not-on-map' | /* The entity can not be deconstructed. */ 'not-deconstructable' | /* The entity can not be used in blueprints. */ 'not-blueprintable' | /* Hides the entity from the bonus GUI (button above the map) and from the made in property of recipe tooltips. */ 'hidden' | /* Hides the alt-info of an entity in alt-mode, for example the recipe icon. */ 'hide-alt-info' | /* Do not fast replace over other entity types when building while moving. */ 'fast-replaceable-no-cross-type-while-moving' | 'no-gap-fill-while-building' | /* Do not apply fire stickers to the entity. */ 'not-flammable' | /* Prevents inserters and loaders from taking items from this entity. */ 'no-automated-item-removal' | /* Prevents inserters and loaders from inserting items into this entity. */ 'no-automated-item-insertion' | /* This flag does nothing when set in the data stage because it gets overridden by {@link EntityPrototype::allow_copy_paste | prototype:EntityPrototype::allow_copy_paste}. Thus, it must be set on the entity via that property. */ 'no-copy-paste' | /* Disallows selection of the entity even when a selection box is specified for other reasons. For example, selection boxes are used to determine the size of outlines to be shown when highlighting entities inside electric pole ranges. This flag does nothing when set in the data stage because it gets overridden by {@link EntityPrototype::selectable_in_game | prototype:EntityPrototype::selectable_in_game}. Thus, it must be set on the entity via that property. */ 'not-selectable-in-game' | /* The entity can't be selected by the {@link upgrade planner | https://wiki.factorio.com/Upgrade_planner}. */ 'not-upgradable' | /* The entity is not shown in the kill statistics. */ 'not-in-kill-statistics' | /* The entity is not shown in the made in property of recipe tooltips. */ 'not-in-made-in'>
2809
2957
 
2810
2958
  /**
2811
2959
  * How far (in tiles) entities should be rendered outside the visible area of the screen.
@@ -2998,7 +3146,12 @@ interface FastReplaceTipTrigger {
2998
3146
  * - **mod path**: The format `__<mod-name>__` is placeholder for root of any other mod (mods/<mod-name>), and is accessible as long as the mod is active.
2999
3147
  * @example
3000
3148
  * ```
3001
- * filename = "__base__/graphics/entity/basic-transport-belt/basic-transport-belt.png"
3149
+ * filename = "__base__/graphics/entity/accumulator/accumulator.png"
3150
+ * ```
3151
+ *
3152
+ * @example
3153
+ * ```
3154
+ * filename = "__a-mod__/animations/assembler.png"
3002
3155
  * ```
3003
3156
  *
3004
3157
  */
@@ -3196,7 +3349,7 @@ type FluidID = string
3196
3349
  interface FluidIngredientPrototype {
3197
3350
 
3198
3351
  /**
3199
- * Can not be `< 0`.
3352
+ * Can not be `<= 0`.
3200
3353
  */
3201
3354
  amount: number,
3202
3355
 
@@ -3277,6 +3430,10 @@ If this FluidProductPrototype is used in a recipe, the `catalyst_amount` is calc
3277
3430
 
3278
3431
  /**
3279
3432
  * Value between 0 and 1, `0` for 0% chance and `1` for 100% chance.
3433
+
3434
+ The effect of probability is no product, or a linear distribution on [min, max]. For a recipe with probability `p`, amount_min `min`, and amount_max `max`, the Expected Value of this product can be expressed as `p * (0.5 * (max + min))`. This is what will be shown in a recipe tooltip. The effect of `catalyst_amount` on the product is not shown.
3435
+
3436
+ When `amount_min` and `amount_max` are not provided, `amount` applies as min and max. The Expected Value simplifies to `p * amount`, providing `0` product, or `amount` product, on recipe completion.
3280
3437
  */
3281
3438
  probability?: number,
3282
3439
 
@@ -3724,11 +3881,11 @@ interface IconData {
3724
3881
  icon_mipmaps?: IconMipMapType,
3725
3882
 
3726
3883
  /**
3727
- * The size of the square icon, in pixels, e.g. `32` for a 32px by 32px icon.
3884
+ * The size of the square icon, in pixels. E.g. `32` for a 32px by 32px icon.
3728
3885
 
3729
3886
  Mandatory if `icon_size` is not specified outside of `icons`.
3730
3887
  */
3731
- icon_size: SpriteSizeType,
3888
+ icon_size?: SpriteSizeType,
3732
3889
 
3733
3890
  /**
3734
3891
  * Defaults to `32/icon_size` for items and recipes, and `256/icon_size` for technologies.
@@ -3859,7 +4016,7 @@ type ItemGroupID = string
3859
4016
  type ItemID = string
3860
4017
 
3861
4018
  /**
3862
- * An item ingredient definition. It can be specified as a table with named or numbered keys, but not a mix of both.
4019
+ * An item ingredient definition. It can be specified as a table with named or numbered keys, but not a mix of both. If this is specified as a table with numbered keys then the first value is the item name and the second is the amount.
3863
4020
  * @example
3864
4021
  * ```
3865
4022
  * {type="item", name="steel-plate", amount=8}
@@ -3888,7 +4045,7 @@ If this fluid is used in a recipe, the `catalyst_amount` is calculated automatic
3888
4045
  ]
3889
4046
 
3890
4047
  /**
3891
- * An item product definition. It can be specified as a table with named or numbered keys, but not a mix of both.
4048
+ * An item product definition. It can be specified as a table with named or numbered keys, but not a mix of both. If this is specified as a table with numbered keys then the first value is the item name and the second is the amount.
3892
4049
  */
3893
4050
  type ItemProductPrototype = {
3894
4051
  amount?: number,
@@ -4292,7 +4449,7 @@ interface LoaderStructure {
4292
4449
  * ```
4293
4450
  *
4294
4451
  */
4295
- type LocalisedString = string | boolean | LocalisedString[]
4452
+ type LocalisedString = string | number | boolean | LocalisedString[]
4296
4453
 
4297
4454
  /**
4298
4455
  * The items generated when an {@link EntityWithHealthPrototype | prototype:EntityWithHealthPrototype} is killed.
@@ -4479,7 +4636,7 @@ interface MapGenSettings {
4479
4636
  peaceful_mode?: boolean,
4480
4637
 
4481
4638
  /**
4482
- * Map of property name (e.g. "elevation") to name of noise expression that will provide it. Entries may be omitted. A notable usage is changing autoplace behavior of an entity based on the preset, which cannot be read from a noise expression.
4639
+ * Map of property name (`"elevation"`, etc) to name of noise expression that will provide it. Entries may be omitted. A notable usage is changing autoplace behavior of an entity based on the preset, which cannot be read from a noise expression.
4483
4640
  */
4484
4641
  property_expression_names?: {[key: string]: string | boolean | number},
4485
4642
 
@@ -4720,6 +4877,17 @@ interface MiningDrillProductivityBonusModifier extends SimpleModifier{
4720
4877
  use_icon_overlay_constant?: boolean
4721
4878
  }
4722
4879
 
4880
+ /**
4881
+ * The user-set value of a startup {@link mod setting | https://wiki.factorio.com/Tutorial:Mod_settings}.
4882
+ */
4883
+ interface ModSetting {
4884
+
4885
+ /**
4886
+ * The value of the mod setting. The type depends on the kind of setting.
4887
+ */
4888
+ value: number | boolean | string | Color
4889
+ }
4890
+
4723
4891
  /**
4724
4892
  * The effect that is applied when a {@link TechnologyPrototype | prototype:TechnologyPrototype} is researched.
4725
4893
  *
@@ -4727,6 +4895,28 @@ interface MiningDrillProductivityBonusModifier extends SimpleModifier{
4727
4895
  */
4728
4896
  type Modifier = /* Loaded when the `type` is `"inserter-stack-size-bonus"`. */ InserterStackSizeBonusModifier | /* Loaded when the `type` is `"stack-inserter-capacity-bonus"`. */ StackInserterCapacityBonusModifier | /* Loaded when the `type` is `"laboratory-speed"`. */ LaboratorySpeedModifier | /* Loaded when the `type` is `"laboratory-productivity"`. */ LaboratoryProductivityModifier | /* Loaded when the `type` is `"maximum-following-robots-count"`. */ MaximumFollowingRobotsCountModifier | /* Loaded when the `type` is `"worker-robot-speed"`. */ WorkerRobotSpeedModifier | /* Loaded when the `type` is `"worker-robot-storage"`. */ WorkerRobotStorageModifier | /* Loaded when the `type` is `"worker-robot-battery"`. */ WorkerRobotBatteryModifier | /* Loaded when the `type` is `"follower-robot-lifetime"`. */ FollowerRobotLifetimeModifier | /* Loaded when the `type` is `"ghost-time-to-live"`. */ GhostTimeToLiveModifier | /* Loaded when the `type` is `"deconstruction-time-to-live"`. */ DeconstructionTimeToLiveModifier | /* Loaded when the `type` is `"turret-attack"`. */ TurretAttackModifier | /* Loaded when the `type` is `"ammo-damage"`. */ AmmoDamageModifier | /* Loaded when the `type` is `"artillery-range"`. */ ArtilleryRangeModifier | /* Loaded when the `type` is `"give-item"`. */ GiveItemModifier | /* Loaded when the `type` is `"gun-speed"`. */ GunSpeedModifier | /* Loaded when the `type` is `"unlock-recipe"`. */ UnlockRecipeModifier | /* Loaded when the `type` is `"character-crafting-speed"`. */ CharacterCraftingSpeedModifier | /* Loaded when the `type` is `"character-mining-speed"`. */ CharacterMiningSpeedModifier | /* Loaded when the `type` is `"character-running-speed"`. */ CharacterRunningSpeedModifier | /* Loaded when the `type` is `"character-build-distance"`. */ CharacterBuildDistanceModifier | /* Loaded when the `type` is `"character-item-drop-distance"`. */ CharacterItemDropDistanceModifier | /* Loaded when the `type` is `"character-reach-distance"`. */ CharacterReachDistanceModifier | /* Loaded when the `type` is `"character-resource-reach-distance"`. */ CharacterResourceReachDistanceModifier | /* Loaded when the `type` is `"character-item-pickup-distance"`. */ CharacterItemPickupDistanceModifier | /* Loaded when the `type` is `"character-loot-pickup-distance"`. */ CharacterLootPickupDistanceModifier | /* Loaded when the `type` is `"character-inventory-slots-bonus"`. */ CharacterInventorySlotsBonusModifier | /* Loaded when the `type` is `"character-health-bonus"`. */ CharacterHealthBonusModifier | /* Loaded when the `type` is `"character-logistic-requests"`. */ CharacterLogisticRequestsModifier | /* Loaded when the `type` is `"character-logistic-trash-slots"`. */ CharacterLogisticTrashSlotsModifier | /* Loaded when the `type` is `"max-failed-attempts-per-tick-per-construction-queue"`. */ MaxFailedAttemptsPerTickPerConstructionQueueModifier | /* Loaded when the `type` is `"max-successful-attempts-per-tick-per-construction-queue"`. */ MaxSuccessfulAttemptsPerTickPerConstructionQueueModifier | /* Loaded when the `type` is `"mining-drill-productivity-bonus"`. */ MiningDrillProductivityBonusModifier | /* Loaded when the `type` is `"train-braking-force-bonus"`. */ TrainBrakingForceBonusModifier | /* Loaded when the `type` is `"zoom-to-world-enabled"`. */ ZoomToWorldEnabledModifier | /* Loaded when the `type` is `"zoom-to-world-ghost-building-enabled"`. */ ZoomToWorldGhostBuildingEnabledModifier | /* Loaded when the `type` is `"zoom-to-world-blueprint-enabled"`. */ ZoomToWorldBlueprintEnabledModifier | /* Loaded when the `type` is `"zoom-to-world-deconstruction-planner-enabled"`. */ ZoomToWorldDeconstructionPlannerEnabledModifier | /* Loaded when the `type` is `"zoom-to-world-upgrade-planner-enabled"`. */ ZoomToWorldUpgradePlannerEnabledModifier | /* Loaded when the `type` is `"zoom-to-world-selection-tool-enabled"`. */ ZoomToWorldSelectionToolEnabledModifier | /* Loaded when the `type` is `"nothing"`. */ NothingModifier
4729
4897
 
4898
+ /**
4899
+ * A dictionary of mod names to mod versions of all active mods. It can be used to adjust mod functionality based on the presence of other mods.
4900
+ * @example
4901
+ * ```
4902
+ * -- executes pineapple only when the pizza mod is active
4903
+ * if mods["pizza"] then
4904
+ * pineapple()
4905
+ * end
4906
+ * ```
4907
+ *
4908
+ * @example
4909
+ * ```
4910
+ * -- when the only active mod is the space-age mod with version 1.2.0
4911
+ * -- then this logs
4912
+ * for name, version in pairs(mods) do
4913
+ * log(name .. " version " .. version) -- => space-age version 1.2.0
4914
+ * end
4915
+ * ```
4916
+ *
4917
+ */
4918
+ type Mods = {[key: string]: string}
4919
+
4730
4920
  /**
4731
4921
  * The name of a {@link ModuleCategory | prototype:ModuleCategory}.
4732
4922
  * @example
@@ -4829,6 +5019,8 @@ interface NoiseArrayConstruction {
4829
5019
  * {@link noise.define_noise_function | https://github.com/wube/factorio-data/blob/master/core/lualib/noise.lua#L272} allows noise expressions to be defined using a shorthand that's a subset of Lua (see the example for details).
4830
5020
  *
4831
5021
  * See {@link here | https://togos.github.io/togos-example-noise-programs/} for a tutorial on authoring noise expressions.
5022
+ *
5023
+ * The most frequently used noise functions are loaded via {@link NoiseFunctionApplication | prototype:NoiseFunctionApplication}.
4832
5024
  * @example
4833
5025
  * ```
4834
5026
  * -- "noise" library required beforehand
@@ -5587,6 +5779,10 @@ type Order = string
5587
5779
 
5588
5780
  interface OrientedCliffPrototype {
5589
5781
  collision_bounding_box: BoundingBox,
5782
+
5783
+ /**
5784
+ * Unused.
5785
+ */
5590
5786
  fill_volume: number,
5591
5787
  pictures: SpriteVariations
5592
5788
  }
@@ -6005,7 +6201,7 @@ When used without `projectile_creation_parameters`, this sets the turret's rotat
6005
6201
  projectile_orientation_offset?: number,
6006
6202
 
6007
6203
  /**
6008
- * Used to show bullet shells/casings being ejected from the gun, e.g. {@link artillery shell casings | https://factorio.com/blog/post/fff-345}.
6204
+ * Used to show bullet shells/casings being ejected from the gun, see {@link artillery shell casings | https://factorio.com/blog/post/fff-345}.
6009
6205
  */
6010
6206
  shell_particle?: CircularParticleCreationSpecification,
6011
6207
  type: 'projectile'
@@ -6373,7 +6569,7 @@ Can be set to an empty table to create a recipe that produces nothing. Duplicate
6373
6569
  results: ProductPrototype[],
6374
6570
 
6375
6571
  /**
6376
- * Whether the recipe name should have the product amount in front of it, e.g. "2x Transport belt"
6572
+ * Whether the recipe name should have the product amount in front of it. E.g. "2x Transport belt"
6377
6573
  */
6378
6574
  show_amount_in_title?: boolean,
6379
6575
 
@@ -6838,6 +7034,23 @@ interface SetTileTriggerEffectItem extends TriggerEffectItem{
6838
7034
  type: 'set-tile'
6839
7035
  }
6840
7036
 
7037
+ /**
7038
+ * A struct that provides access to the user-set values of startup {@link mod settings | https://wiki.factorio.com/Tutorial:Mod_settings}.
7039
+ * @example
7040
+ * ```
7041
+ * -- Accessing the value of a mod setting
7042
+ * local val = settings.startup["my-mod-setting-name"].value
7043
+ * ```
7044
+ *
7045
+ */
7046
+ interface Settings {
7047
+
7048
+ /**
7049
+ * All startup mod settings, indexed by the name of the setting.
7050
+ */
7051
+ startup: {[key: string]: ModSetting}
7052
+ }
7053
+
6841
7054
  interface ShiftAnimationWaypoints {
6842
7055
  east: Vector[],
6843
7056
  north: Vector[],
@@ -7113,7 +7326,7 @@ type SoundType = 'game-effect' | 'gui-effect' | 'ambient' | 'environment' | 'wal
7113
7326
  /**
7114
7327
  * The definition of a evolution and probability weights for a {@link spawnable unit | prototype:UnitSpawnDefinition} for a {@link EnemySpawnerPrototype | prototype:EnemySpawnerPrototype}.
7115
7328
  *
7116
- * It can be specified as a table with named or numbered keys, but not a mix of both.
7329
+ * It can be specified as a table with named or numbered keys, but not a mix of both. If this is specified as a table with numbered keys then the first value is the evolution factor and the second is the spawn weight.
7117
7330
  */
7118
7331
  type SpawnPoint = {
7119
7332
  evolution_factor: number,
@@ -7303,6 +7516,7 @@ interface SpotNoiseArguments {
7303
7516
  * When there is more than one sprite or {@link Animation | prototype:Animation} frame with the same source file and dimensions/position in the game, they all share the same memory.
7304
7517
  * @example
7305
7518
  * ```
7519
+ * -- simple sprite
7306
7520
  * picture_set_enemy =
7307
7521
  * {
7308
7522
  * filename = "__base__/graphics/entity/land-mine/land-mine-set-enemy.png",
@@ -7312,6 +7526,99 @@ interface SpotNoiseArguments {
7312
7526
  * }
7313
7527
  * ```
7314
7528
  *
7529
+ * @example
7530
+ * ```
7531
+ * -- sprite with hr version
7532
+ * picture =
7533
+ * {
7534
+ * filename = "__base__/graphics/entity/wooden-chest/wooden-chest.png",
7535
+ * priority = "extra-high",
7536
+ * width = 32,
7537
+ * height = 36,
7538
+ * shift = util.by_pixel(0.5, -2),
7539
+ * hr_version =
7540
+ * {
7541
+ * filename = "__base__/graphics/entity/wooden-chest/hr-wooden-chest.png",
7542
+ * priority = "extra-high",
7543
+ * width = 62,
7544
+ * height = 72,
7545
+ * shift = util.by_pixel(0.5, -2),
7546
+ * scale = 0.5
7547
+ * }
7548
+ * }
7549
+ * ```
7550
+ *
7551
+ * @example
7552
+ * ```
7553
+ * -- sprite with layers
7554
+ * picture =
7555
+ * {
7556
+ * layers =
7557
+ * {
7558
+ * {
7559
+ * filename = "__base__/graphics/entity/wooden-chest/wooden-chest.png",
7560
+ * priority = "extra-high",
7561
+ * width = 32,
7562
+ * height = 36,
7563
+ * shift = util.by_pixel(0.5, -2)
7564
+ * },
7565
+ * {
7566
+ * filename = "__base__/graphics/entity/wooden-chest/wooden-chest-shadow.png",
7567
+ * priority = "extra-high",
7568
+ * width = 52,
7569
+ * height = 20,
7570
+ * shift = util.by_pixel(10, 6.5),
7571
+ * draw_as_shadow = true
7572
+ * }
7573
+ * }
7574
+ * }
7575
+ * ```
7576
+ *
7577
+ * @example
7578
+ * ```
7579
+ * -- sprite with layers and hr version
7580
+ * picture =
7581
+ * {
7582
+ * layers =
7583
+ * {
7584
+ * {
7585
+ * filename = "__base__/graphics/entity/wooden-chest/wooden-chest.png",
7586
+ * priority = "extra-high",
7587
+ * width = 32,
7588
+ * height = 36,
7589
+ * shift = util.by_pixel(0.5, -2),
7590
+ * hr_version =
7591
+ * {
7592
+ * filename = "__base__/graphics/entity/wooden-chest/hr-wooden-chest.png",
7593
+ * priority = "extra-high",
7594
+ * width = 62,
7595
+ * height = 72,
7596
+ * shift = util.by_pixel(0.5, -2),
7597
+ * scale = 0.5
7598
+ * }
7599
+ * },
7600
+ * {
7601
+ * filename = "__base__/graphics/entity/wooden-chest/wooden-chest-shadow.png",
7602
+ * priority = "extra-high",
7603
+ * width = 52,
7604
+ * height = 20,
7605
+ * shift = util.by_pixel(10, 6.5),
7606
+ * draw_as_shadow = true,
7607
+ * hr_version =
7608
+ * {
7609
+ * filename = "__base__/graphics/entity/wooden-chest/hr-wooden-chest-shadow.png",
7610
+ * priority = "extra-high",
7611
+ * width = 104,
7612
+ * height = 40,
7613
+ * shift = util.by_pixel(10, 6.5),
7614
+ * draw_as_shadow = true,
7615
+ * scale = 0.5
7616
+ * }
7617
+ * }
7618
+ * }
7619
+ * }
7620
+ * ```
7621
+ *
7315
7622
  */
7316
7623
  interface Sprite extends SpriteParameters{
7317
7624
 
@@ -7625,19 +7932,36 @@ type SpriteSizeType = number
7625
7932
  /**
7626
7933
  * @example
7627
7934
  * ```
7935
+ * -- array of sprites
7628
7936
  * pictures =
7629
7937
  * {
7938
+ * { size = 64, filename = "__base__/graphics/icons/coal.png", scale = 0.25, mipmap_count = 4 },
7939
+ * { size = 64, filename = "__base__/graphics/icons/coal-1.png", scale = 0.25, mipmap_count = 4 },
7940
+ * { size = 64, filename = "__base__/graphics/icons/coal-2.png", scale = 0.25, mipmap_count = 4 },
7941
+ * { size = 64, filename = "__base__/graphics/icons/coal-3.png", scale = 0.25, mipmap_count = 4 }
7942
+ * }
7943
+ * ```
7944
+ *
7945
+ * @example
7946
+ * ```
7947
+ * -- sprite sheet using "sheet"
7948
+ * connection_patches_connected =
7949
+ * {
7950
+ * sheet =
7630
7951
  * {
7631
- * filename = "__base__/graphics/entity/decorative/green-carpet-grass/green-carpet-grass-01.png",
7632
- * width = 105,
7633
- * height = 73
7634
- * },
7635
- * {
7636
- * filename = "__base__/graphics/entity/decorative/green-carpet-grass/green-carpet-grass-02.png",
7637
- * width = 185,
7638
- * height = 164
7639
- * },
7640
- * [...]
7952
+ * filename = "__base__/graphics/entity/nuclear-reactor/reactor-connect-patches.png",
7953
+ * width = 32,
7954
+ * height = 32,
7955
+ * variation_count = 12,
7956
+ * hr_version =
7957
+ * {
7958
+ * filename = "__base__/graphics/entity/nuclear-reactor/hr-reactor-connect-patches.png",
7959
+ * width = 64,
7960
+ * height = 64,
7961
+ * variation_count = 12,
7962
+ * scale = 0.5
7963
+ * }
7964
+ * }
7641
7965
  * }
7642
7966
  * ```
7643
7967
  *
@@ -7882,7 +8206,7 @@ interface TechnologyData {
7882
8206
  hidden?: boolean,
7883
8207
 
7884
8208
  /**
7885
- * Controls whether the technology cost ignores the tech cost multiplier set in the {@link DifficultySettings | runtime:DifficultySettings}, e.g. `4` for the default expensive difficulty.
8209
+ * Controls whether the technology cost ignores the tech cost multiplier set in the {@link DifficultySettings | runtime:DifficultySettings}. E.g. `4` for the default expensive difficulty.
7886
8210
  */
7887
8211
  ignore_tech_cost_multiplier?: boolean,
7888
8212
 
@@ -8687,7 +9011,7 @@ interface UnitGroupSettings {
8687
9011
  }
8688
9012
 
8689
9013
  /**
8690
- * It can be specified as a table with named or numbered keys, but not a mix of both.
9014
+ * It can be specified as a table with named or numbered keys, but not a mix of both. If this is specified as a table with numbered keys then the first value is the unit and the second is the spawn points.
8691
9015
  */
8692
9016
  type UnitSpawnDefinition = {
8693
9017
 
@@ -8774,6 +9098,9 @@ type Vector = {
8774
9098
  number
8775
9099
  ]
8776
9100
 
9101
+ /**
9102
+ * If this is specified as a three-element array then the array items are x, y and z, in that order.
9103
+ */
8777
9104
  type Vector3D = {
8778
9105
  x: number,
8779
9106
  y: number,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "factorio-types",
3
- "version": "0.0.45",
3
+ "version": "0.0.47",
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",
@@ -24,5 +24,5 @@
24
24
  "index.d.ts",
25
25
  "dist/**/*.d.ts"
26
26
  ],
27
- "factorioVersion": "1.1.100"
27
+ "factorioVersion": "1.1.102"
28
28
  }