typed-factorio 0.16.0 → 0.18.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1382,7 +1382,8 @@ interface LuaControl {
1382
1382
  *
1383
1383
  * {@link https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.force View documentation}
1384
1384
  */
1385
- force: ForceIdentification
1385
+ get force(): LuaForce
1386
+ set force(value: ForceIdentification)
1386
1387
  /**
1387
1388
  * The currently selected entity; `nil` if none. Assigning an entity will select it if selectable otherwise clears selection.
1388
1389
  *
@@ -1532,7 +1533,8 @@ interface LuaControl {
1532
1533
  *
1533
1534
  * {@link https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.cursor_ghost View documentation}
1534
1535
  */
1535
- cursor_ghost: ItemPrototypeIdentification
1536
+ get cursor_ghost(): LuaItemPrototype
1537
+ set cursor_ghost(value: ItemPrototypeIdentification)
1536
1538
  /**
1537
1539
  * `true` if the player is in a vehicle. Writing to this attribute puts the player in or out of a vehicle.
1538
1540
  *
@@ -2316,7 +2318,7 @@ interface LuaEntity extends LuaControl {
2316
2318
  * @param flag - The flag to test. See {@link EntityPrototypeFlags} for a list of flags.
2317
2319
  * @returns `true` if this entity has the given flag set.
2318
2320
  */
2319
- has_flag(flag: string): boolean
2321
+ has_flag(flag: keyof EntityPrototypeFlags): boolean
2320
2322
  /**
2321
2323
  * Same as {@link LuaEntity.has_flag LuaEntity::has_flag}, but targets the inner entity on a entity ghost.
2322
2324
  *
@@ -2327,7 +2329,7 @@ interface LuaEntity extends LuaControl {
2327
2329
  * @param flag - The flag to test. See {@link EntityPrototypeFlags} for a list of flags.
2328
2330
  * @returns `true` if the entity has the given flag set.
2329
2331
  */
2330
- ghost_has_flag(flag: string): boolean
2332
+ ghost_has_flag(flag: keyof EntityPrototypeFlags): boolean
2331
2333
  /**
2332
2334
  * Offer a thing on the market.
2333
2335
  *
@@ -3258,8 +3260,8 @@ interface LuaEntity extends LuaControl {
3258
3260
  is_registered_for_construction(): boolean
3259
3261
  /**
3260
3262
  * Is this entity registered for deconstruction with this force? If false, it means a construction robot has been
3261
- * dispatched to deconstruct it, or it is not marked for deconstruction. This is worst-case O(N) complexity where N
3262
- * is the current number of things in the deconstruct queue.
3263
+ * dispatched to deconstruct it, or it is not marked for deconstruction. The complexity is effectively O(1) - it
3264
+ * depends on the number of objects targeting this entity which should be small enough.
3263
3265
  *
3264
3266
  * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.is_registered_for_deconstruction View documentation}
3265
3267
  *
@@ -3317,6 +3319,14 @@ interface LuaEntity extends LuaControl {
3317
3319
  * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.disconnect_linked_belts View documentation}
3318
3320
  */
3319
3321
  disconnect_linked_belts(): void
3322
+ /**
3323
+ * Gets legs of given SpiderVehicle.
3324
+ *
3325
+ * *Can only be used if this is SpiderVehicle*
3326
+ *
3327
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_spider_legs View documentation}
3328
+ */
3329
+ get_spider_legs(): LuaEntity[]
3320
3330
  /**
3321
3331
  * Name of the entity prototype. E.g. "inserter" or "filter-inserter".
3322
3332
  *
@@ -3671,6 +3681,8 @@ interface LuaEntity extends LuaControl {
3671
3681
  * - When called on an underground transport belt, this is the other end of the underground belt connection, or `nil` if none.
3672
3682
  * - When called on a wall-connectable entity or reactor, this is a dictionary of all connections indexed by the
3673
3683
  * connection direction "north", "south", "east", and "west".
3684
+ * - When called on a cliff entity, this is a dictionary of all connections indexed by the connection direction
3685
+ * "north", "south", "east", and "west".
3674
3686
  *
3675
3687
  * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.neighbours View documentation}
3676
3688
  */
@@ -4400,7 +4412,8 @@ interface LuaEntity extends LuaControl {
4400
4412
  *
4401
4413
  * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.render_to_forces View documentation}
4402
4414
  */
4403
- render_to_forces: ForceIdentification[] | undefined
4415
+ get render_to_forces(): LuaForce[] | undefined
4416
+ set render_to_forces(value: ForceIdentification[] | undefined)
4404
4417
  /**
4405
4418
  * The rail target of this pump or `nil`.
4406
4419
  *
@@ -4551,11 +4564,18 @@ interface LuaEntity extends LuaControl {
4551
4564
  */
4552
4565
  trains_limit: uint
4553
4566
  /**
4554
- * If this entity is EntityWithForce
4567
+ * (deprecated by 1.1.51) If this entity is a MilitaryTarget. Returns same value as LuaEntity::is_military_target
4555
4568
  *
4556
4569
  * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.is_entity_with_force View documentation}
4557
4570
  */
4558
4571
  readonly is_entity_with_force: boolean
4572
+ /**
4573
+ * If this entity is a MilitaryTarget. Can be written to if
4574
+ * LuaEntityPrototype::allow_run_time_change_of_is_military_target returns true
4575
+ *
4576
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.is_military_target View documentation}
4577
+ */
4578
+ is_military_target: boolean
4559
4579
  /**
4560
4580
  * If this entity is EntityWithOwner
4561
4581
  *
@@ -4723,7 +4743,7 @@ interface BaseEntity extends LuaControl {
4723
4743
  * @param flag - The flag to test. See {@link EntityPrototypeFlags} for a list of flags.
4724
4744
  * @returns `true` if this entity has the given flag set.
4725
4745
  */
4726
- has_flag(flag: string): boolean
4746
+ has_flag(flag: keyof EntityPrototypeFlags): boolean
4727
4747
  /**
4728
4748
  * Connect two devices with a circuit wire or copper cable. Depending on which type of connection should be made,
4729
4749
  * there are different procedures:
@@ -5242,8 +5262,8 @@ interface BaseEntity extends LuaControl {
5242
5262
  is_registered_for_construction(): boolean
5243
5263
  /**
5244
5264
  * Is this entity registered for deconstruction with this force? If false, it means a construction robot has been
5245
- * dispatched to deconstruct it, or it is not marked for deconstruction. This is worst-case O(N) complexity where N
5246
- * is the current number of things in the deconstruct queue.
5265
+ * dispatched to deconstruct it, or it is not marked for deconstruction. The complexity is effectively O(1) - it
5266
+ * depends on the number of objects targeting this entity which should be small enough.
5247
5267
  *
5248
5268
  * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.is_registered_for_deconstruction View documentation}
5249
5269
  *
@@ -5447,6 +5467,8 @@ interface BaseEntity extends LuaControl {
5447
5467
  * - When called on an underground transport belt, this is the other end of the underground belt connection, or `nil` if none.
5448
5468
  * - When called on a wall-connectable entity or reactor, this is a dictionary of all connections indexed by the
5449
5469
  * connection direction "north", "south", "east", and "west".
5470
+ * - When called on a cliff entity, this is a dictionary of all connections indexed by the connection direction
5471
+ * "north", "south", "east", and "west".
5450
5472
  *
5451
5473
  * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.neighbours View documentation}
5452
5474
  */
@@ -5781,7 +5803,8 @@ interface BaseEntity extends LuaControl {
5781
5803
  *
5782
5804
  * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.render_to_forces View documentation}
5783
5805
  */
5784
- render_to_forces: ForceIdentification[] | undefined
5806
+ get render_to_forces(): LuaForce[] | undefined
5807
+ set render_to_forces(value: ForceIdentification[] | undefined)
5785
5808
  /**
5786
5809
  * Returns the id of the electric network that this entity is connected to or `nil`.
5787
5810
  *
@@ -5826,11 +5849,18 @@ interface BaseEntity extends LuaControl {
5826
5849
  */
5827
5850
  tags: Tags | undefined
5828
5851
  /**
5829
- * If this entity is EntityWithForce
5852
+ * (deprecated by 1.1.51) If this entity is a MilitaryTarget. Returns same value as LuaEntity::is_military_target
5830
5853
  *
5831
5854
  * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.is_entity_with_force View documentation}
5832
5855
  */
5833
5856
  readonly is_entity_with_force: boolean
5857
+ /**
5858
+ * If this entity is a MilitaryTarget. Can be written to if
5859
+ * LuaEntityPrototype::allow_run_time_change_of_is_military_target returns true
5860
+ *
5861
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.is_military_target View documentation}
5862
+ */
5863
+ is_military_target: boolean
5834
5864
  /**
5835
5865
  * If this entity is EntityWithOwner
5836
5866
  *
@@ -5990,7 +6020,7 @@ interface EntityGhostEntity extends BaseEntity {
5990
6020
  * @param flag - The flag to test. See {@link EntityPrototypeFlags} for a list of flags.
5991
6021
  * @returns `true` if the entity has the given flag set.
5992
6022
  */
5993
- ghost_has_flag(flag: string): boolean
6023
+ ghost_has_flag(flag: keyof EntityPrototypeFlags): boolean
5994
6024
  /**
5995
6025
  * The unit number of the entity contained in this ghost or nil if the entity doesn't have one.
5996
6026
  *
@@ -6687,6 +6717,14 @@ interface SpiderVehicleEntity extends BaseEntity {
6687
6717
  * @param position - The position the spidertron should move to.
6688
6718
  */
6689
6719
  add_autopilot_destination(position: MapPosition): void
6720
+ /**
6721
+ * Gets legs of given SpiderVehicle.
6722
+ *
6723
+ * *Can only be used if this is SpiderVehicle*
6724
+ *
6725
+ * {@link https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.get_spider_legs View documentation}
6726
+ */
6727
+ get_spider_legs(): LuaEntity[]
6690
6728
  /**
6691
6729
  * The torso orientation of this spider vehicle.
6692
6730
  *
@@ -7283,7 +7321,7 @@ interface LuaEntityPrototype {
7283
7321
  * @param flag - The flag to test. See {@link EntityPrototypeFlags} for a list of flags.
7284
7322
  * @returns `true` if this prototype has the given flag set.
7285
7323
  */
7286
- has_flag(flag: string): boolean
7324
+ has_flag(flag: keyof EntityPrototypeFlags): boolean
7287
7325
  /**
7288
7326
  * Gets the base size of the given inventory on this entity or `nil` if the given inventory doesn't exist.
7289
7327
  *
@@ -8170,6 +8208,12 @@ interface LuaEntityPrototype {
8170
8208
  * {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.timeout View documentation}
8171
8209
  */
8172
8210
  readonly timeout: uint
8211
+ /**
8212
+ * Collision mask entity must collide with to make landmine blowup
8213
+ *
8214
+ * {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.trigger_collision_mask View documentation}
8215
+ */
8216
+ readonly trigger_collision_mask: CollisionMask
8173
8217
  /**
8174
8218
  * The fluidbox prototypes for this entity.
8175
8219
  *
@@ -8470,6 +8514,35 @@ interface LuaEntityPrototype {
8470
8514
  * {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.inserter_stack_size_bonus View documentation}
8471
8515
  */
8472
8516
  readonly inserter_stack_size_bonus: double | undefined
8517
+ /**
8518
+ * True if this entity prototype should be included during tile collision checks with
8519
+ * {@link LuaTilePrototype.check_collision_with_entities LuaTilePrototype::check_collision_with_entities} enabled.
8520
+ *
8521
+ * {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.protected_from_tile_building View documentation}
8522
+ */
8523
+ readonly protected_from_tile_building: boolean
8524
+ /**
8525
+ * True if this is entity-with-owner
8526
+ *
8527
+ * {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.is_entity_with_owner View documentation}
8528
+ */
8529
+ readonly is_entity_with_owner: boolean
8530
+ /**
8531
+ * True if this entity-with-owner is military target
8532
+ *
8533
+ * *Can only be used if this is EntityWithOwnerPrototype*
8534
+ *
8535
+ * {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.is_military_target View documentation}
8536
+ */
8537
+ readonly is_military_target: boolean
8538
+ /**
8539
+ * True if this entity-with-owner's is_military_target can be changed run-time (on the entity, not on the prototype itself)
8540
+ *
8541
+ * *Can only be used if this is EntityWithOwnerPrototype*
8542
+ *
8543
+ * {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.allow_run_time_change_of_is_military_target View documentation}
8544
+ */
8545
+ readonly allow_run_time_change_of_is_military_target: boolean
8473
8546
  /**
8474
8547
  * Gets the current movement speed of this character, including effects from exoskeletons, tiles, stickers and shooting.
8475
8548
  *
@@ -8588,7 +8661,7 @@ interface BaseEntityPrototype {
8588
8661
  * @param flag - The flag to test. See {@link EntityPrototypeFlags} for a list of flags.
8589
8662
  * @returns `true` if this prototype has the given flag set.
8590
8663
  */
8591
- has_flag(flag: string): boolean
8664
+ has_flag(flag: keyof EntityPrototypeFlags): boolean
8592
8665
  /**
8593
8666
  * Gets the base size of the given inventory on this entity or `nil` if the given inventory doesn't exist.
8594
8667
  *
@@ -9475,6 +9548,12 @@ interface BaseEntityPrototype {
9475
9548
  * {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.timeout View documentation}
9476
9549
  */
9477
9550
  readonly timeout: uint
9551
+ /**
9552
+ * Collision mask entity must collide with to make landmine blowup
9553
+ *
9554
+ * {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.trigger_collision_mask View documentation}
9555
+ */
9556
+ readonly trigger_collision_mask: CollisionMask
9478
9557
  /**
9479
9558
  * The fluidbox prototypes for this entity.
9480
9559
  *
@@ -9713,6 +9792,19 @@ interface BaseEntityPrototype {
9713
9792
  * {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.inserter_stack_size_bonus View documentation}
9714
9793
  */
9715
9794
  readonly inserter_stack_size_bonus: double | undefined
9795
+ /**
9796
+ * True if this entity prototype should be included during tile collision checks with
9797
+ * {@link LuaTilePrototype.check_collision_with_entities LuaTilePrototype::check_collision_with_entities} enabled.
9798
+ *
9799
+ * {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.protected_from_tile_building View documentation}
9800
+ */
9801
+ readonly protected_from_tile_building: boolean
9802
+ /**
9803
+ * True if this is entity-with-owner
9804
+ *
9805
+ * {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.is_entity_with_owner View documentation}
9806
+ */
9807
+ readonly is_entity_with_owner: boolean
9716
9808
  /**
9717
9809
  * Is this object valid? This Lua object holds a reference to an object within the game engine. It is possible that
9718
9810
  * the game-engine object is removed whilst a mod still holds the corresponding Lua object. If that happens, the
@@ -9803,6 +9895,25 @@ interface TransportBeltEntityPrototype extends BaseEntityPrototype {
9803
9895
  readonly related_underground_belt: LuaEntityPrototype
9804
9896
  }
9805
9897
 
9898
+ interface EntityWithOwnerEntityPrototype extends BaseEntityPrototype {
9899
+ /**
9900
+ * True if this entity-with-owner is military target
9901
+ *
9902
+ * *Can only be used if this is EntityWithOwnerPrototype*
9903
+ *
9904
+ * {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.is_military_target View documentation}
9905
+ */
9906
+ readonly is_military_target: boolean
9907
+ /**
9908
+ * True if this entity-with-owner's is_military_target can be changed run-time (on the entity, not on the prototype itself)
9909
+ *
9910
+ * *Can only be used if this is EntityWithOwnerPrototype*
9911
+ *
9912
+ * {@link https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.allow_run_time_change_of_is_military_target View documentation}
9913
+ */
9914
+ readonly allow_run_time_change_of_is_military_target: boolean
9915
+ }
9916
+
9806
9917
  interface CharacterEntityPrototype extends BaseEntityPrototype {
9807
9918
  /**
9808
9919
  * Gets the current movement speed of this character, including effects from exoskeletons, tiles, stickers and shooting.
@@ -11701,7 +11812,8 @@ interface LuaForce {
11701
11812
  *
11702
11813
  * {@link https://lua-api.factorio.com/latest/LuaForce.html#LuaForce.research_queue View documentation}
11703
11814
  */
11704
- research_queue: TechnologyIdentification[] | undefined
11815
+ get research_queue(): LuaTechnology[] | undefined
11816
+ set research_queue(value: TechnologyIdentification[] | undefined)
11705
11817
  /**
11706
11818
  * Whether research is enabled for this force, see {@link LuaForce.enable_research LuaForce::enable_research} and
11707
11819
  * {@link LuaForce.disable_research LuaForce::disable_research}
@@ -15461,7 +15573,7 @@ interface LuaItemPrototype {
15461
15573
  * @param flag - The flag to test. See {@link ItemPrototypeFlags} for a list of flags.
15462
15574
  * @returns `true` if this prototype has the given flag set.
15463
15575
  */
15464
- has_flag(flag: string): boolean
15576
+ has_flag(flag: keyof ItemPrototypeFlags): boolean
15465
15577
  /**
15466
15578
  * Type of this ammo prototype or `nil` if this is not an ammo prototype.
15467
15579
  *
@@ -16000,7 +16112,7 @@ interface BaseItemPrototype {
16000
16112
  * @param flag - The flag to test. See {@link ItemPrototypeFlags} for a list of flags.
16001
16113
  * @returns `true` if this prototype has the given flag set.
16002
16114
  */
16003
- has_flag(flag: string): boolean
16115
+ has_flag(flag: keyof ItemPrototypeFlags): boolean
16004
16116
  /**
16005
16117
  * Type of this ammo prototype or `nil` if this is not an ammo prototype.
16006
16118
  *
@@ -23894,12 +24006,12 @@ interface LuaSurface {
23894
24006
  readonly condition: ForceCondition
23895
24007
  }): LuaEntity[]
23896
24008
  /**
23897
- * Find the enemy entity-with-force ({@link https://wiki.factorio.com/Military_units_and_structures military entity})
24009
+ * Find the enemy military target ({@link https://wiki.factorio.com/Military_units_and_structures military entity})
23898
24010
  * closest to the given position.
23899
24011
  *
23900
24012
  * {@link https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_nearest_enemy View documentation}
23901
24013
  *
23902
- * @returns The nearest enemy entity-with-force or `nil` if no enemy could be found within the given area.
24014
+ * @returns The nearest enemy military target or `nil` if no enemy could be found within the given area.
23903
24015
  */
23904
24016
  find_nearest_enemy(params: {
23905
24017
  /** Center of the search area. */
@@ -24656,7 +24768,7 @@ interface LuaSurface {
24656
24768
  */
24657
24769
  calculate_tile_properties(property_names: readonly string[], positions: readonly Position[]): Record<string, double[]>
24658
24770
  /**
24659
- * Returns all the entities with force on this chunk for the given force.
24771
+ * Returns all the military targets (entities with force) on this chunk for the given force.
24660
24772
  *
24661
24773
  * {@link https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.get_entities_with_force View documentation}
24662
24774
  *
@@ -3227,7 +3227,7 @@ interface TypeItemPrototypeFilter extends BaseItemPrototypeFilter {
3227
3227
  interface FlagItemPrototypeFilter extends BaseItemPrototypeFilter {
3228
3228
  readonly filter: "flag"
3229
3229
  /** One of the values in {@link ItemPrototypeFlags}. */
3230
- readonly flag: string
3230
+ readonly flag: keyof ItemPrototypeFlags
3231
3231
  }
3232
3232
 
3233
3233
  interface SubgroupItemPrototypeFilter extends BaseItemPrototypeFilter {
@@ -4079,7 +4079,7 @@ interface CollisionMaskEntityPrototypeFilter extends BaseEntityPrototypeFilter {
4079
4079
  interface FlagEntityPrototypeFilter extends BaseEntityPrototypeFilter {
4080
4080
  readonly filter: "flag"
4081
4081
  /** One of the values in {@link EntityPrototypeFlags}. */
4082
- readonly flag: string
4082
+ readonly flag: keyof EntityPrototypeFlags
4083
4083
  }
4084
4084
 
4085
4085
  interface BuildBaseEvolutionRequirementEntityPrototypeFilter extends BaseEntityPrototypeFilter {