factorio-types 1.2.43 → 1.2.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/classes.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  // Factorio API reference https://lua-api.factorio.com/latest/index.html
3
3
  // Generated from JSON source https://lua-api.factorio.com/latest/runtime-api.json
4
4
  // Definition source https://github.com/sguest/factorio-types
5
- // Factorio version 2.0.60
5
+ // Factorio version 2.0.61
6
6
  // API version 6
7
7
 
8
8
  declare namespace runtime {
@@ -2751,6 +2751,24 @@ interface LuaBootstrap {
2751
2751
  script.on_event(defines.events.on_built_entity,
2752
2752
  function(event) game.print("Gotta go fast!") end,
2753
2753
  {{filter = "name", name = "fast-inserter"}})
2754
+ ```
2755
+ */
2756
+ on_event(this: void, event: defines.events.on_post_segmented_unit_died, handler: ((this: void, arg0: runtime.on_post_segmented_unit_died) => any) | nil, filters?: EventFilter): void;
2757
+ /**
2758
+ * Register a handler to run on the specified event(s). Each mod can only register once for every event, as any additional registration will overwrite the previous one. This holds true even if different filters are used for subsequent registrations.
2759
+ * @param event The event(s) or custom-input to invoke the handler on.
2760
+ * @param handler The handler for this event. Passing `nil` will unregister it.
2761
+ * @param filters The filters for this event. Can only be used when registering for individual events.
2762
+ * @example ```
2763
+ -- Register for the on_tick event to print the current tick to console each tick
2764
+ script.on_event(defines.events.on_tick,
2765
+ function(event) game.print(event.tick) end)
2766
+ ```
2767
+ * @example ```
2768
+ -- Register for the on_built_entity event, limiting it to only be received when a `"fast-inserter"` is built
2769
+ script.on_event(defines.events.on_built_entity,
2770
+ function(event) game.print("Gotta go fast!") end,
2771
+ {{filter = "name", name = "fast-inserter"}})
2754
2772
  ```
2755
2773
  */
2756
2774
  on_event(this: void, event: defines.events.on_pre_build, handler: ((this: void, arg0: runtime.on_pre_build) => any) | nil, filters?: EventFilter): void;
@@ -3489,6 +3507,60 @@ interface LuaBootstrap {
3489
3507
  script.on_event(defines.events.on_built_entity,
3490
3508
  function(event) game.print("Gotta go fast!") end,
3491
3509
  {{filter = "name", name = "fast-inserter"}})
3510
+ ```
3511
+ */
3512
+ on_event(this: void, event: defines.events.on_segmented_unit_created, handler: ((this: void, arg0: runtime.on_segmented_unit_created) => any) | nil, filters?: EventFilter): void;
3513
+ /**
3514
+ * Register a handler to run on the specified event(s). Each mod can only register once for every event, as any additional registration will overwrite the previous one. This holds true even if different filters are used for subsequent registrations.
3515
+ * @param event The event(s) or custom-input to invoke the handler on.
3516
+ * @param handler The handler for this event. Passing `nil` will unregister it.
3517
+ * @param filters The filters for this event. Can only be used when registering for individual events.
3518
+ * @example ```
3519
+ -- Register for the on_tick event to print the current tick to console each tick
3520
+ script.on_event(defines.events.on_tick,
3521
+ function(event) game.print(event.tick) end)
3522
+ ```
3523
+ * @example ```
3524
+ -- Register for the on_built_entity event, limiting it to only be received when a `"fast-inserter"` is built
3525
+ script.on_event(defines.events.on_built_entity,
3526
+ function(event) game.print("Gotta go fast!") end,
3527
+ {{filter = "name", name = "fast-inserter"}})
3528
+ ```
3529
+ */
3530
+ on_event(this: void, event: defines.events.on_segmented_unit_damaged, handler: ((this: void, arg0: runtime.on_segmented_unit_damaged) => any) | nil, filters?: EventFilter): void;
3531
+ /**
3532
+ * Register a handler to run on the specified event(s). Each mod can only register once for every event, as any additional registration will overwrite the previous one. This holds true even if different filters are used for subsequent registrations.
3533
+ * @param event The event(s) or custom-input to invoke the handler on.
3534
+ * @param handler The handler for this event. Passing `nil` will unregister it.
3535
+ * @param filters The filters for this event. Can only be used when registering for individual events.
3536
+ * @example ```
3537
+ -- Register for the on_tick event to print the current tick to console each tick
3538
+ script.on_event(defines.events.on_tick,
3539
+ function(event) game.print(event.tick) end)
3540
+ ```
3541
+ * @example ```
3542
+ -- Register for the on_built_entity event, limiting it to only be received when a `"fast-inserter"` is built
3543
+ script.on_event(defines.events.on_built_entity,
3544
+ function(event) game.print("Gotta go fast!") end,
3545
+ {{filter = "name", name = "fast-inserter"}})
3546
+ ```
3547
+ */
3548
+ on_event(this: void, event: defines.events.on_segmented_unit_died, handler: ((this: void, arg0: runtime.on_segmented_unit_died) => any) | nil, filters?: EventFilter): void;
3549
+ /**
3550
+ * Register a handler to run on the specified event(s). Each mod can only register once for every event, as any additional registration will overwrite the previous one. This holds true even if different filters are used for subsequent registrations.
3551
+ * @param event The event(s) or custom-input to invoke the handler on.
3552
+ * @param handler The handler for this event. Passing `nil` will unregister it.
3553
+ * @param filters The filters for this event. Can only be used when registering for individual events.
3554
+ * @example ```
3555
+ -- Register for the on_tick event to print the current tick to console each tick
3556
+ script.on_event(defines.events.on_tick,
3557
+ function(event) game.print(event.tick) end)
3558
+ ```
3559
+ * @example ```
3560
+ -- Register for the on_built_entity event, limiting it to only be received when a `"fast-inserter"` is built
3561
+ script.on_event(defines.events.on_built_entity,
3562
+ function(event) game.print("Gotta go fast!") end,
3563
+ {{filter = "name", name = "fast-inserter"}})
3492
3564
  ```
3493
3565
  */
3494
3566
  on_event(this: void, event: defines.events.on_selected_entity_changed, handler: ((this: void, arg0: runtime.on_selected_entity_changed) => any) | nil, filters?: EventFilter): void;
@@ -3795,6 +3867,42 @@ interface LuaBootstrap {
3795
3867
  script.on_event(defines.events.on_built_entity,
3796
3868
  function(event) game.print("Gotta go fast!") end,
3797
3869
  {{filter = "name", name = "fast-inserter"}})
3870
+ ```
3871
+ */
3872
+ on_event(this: void, event: defines.events.on_territory_created, handler: ((this: void, arg0: runtime.on_territory_created) => any) | nil, filters?: EventFilter): void;
3873
+ /**
3874
+ * Register a handler to run on the specified event(s). Each mod can only register once for every event, as any additional registration will overwrite the previous one. This holds true even if different filters are used for subsequent registrations.
3875
+ * @param event The event(s) or custom-input to invoke the handler on.
3876
+ * @param handler The handler for this event. Passing `nil` will unregister it.
3877
+ * @param filters The filters for this event. Can only be used when registering for individual events.
3878
+ * @example ```
3879
+ -- Register for the on_tick event to print the current tick to console each tick
3880
+ script.on_event(defines.events.on_tick,
3881
+ function(event) game.print(event.tick) end)
3882
+ ```
3883
+ * @example ```
3884
+ -- Register for the on_built_entity event, limiting it to only be received when a `"fast-inserter"` is built
3885
+ script.on_event(defines.events.on_built_entity,
3886
+ function(event) game.print("Gotta go fast!") end,
3887
+ {{filter = "name", name = "fast-inserter"}})
3888
+ ```
3889
+ */
3890
+ on_event(this: void, event: defines.events.on_territory_destroyed, handler: ((this: void, arg0: runtime.on_territory_destroyed) => any) | nil, filters?: EventFilter): void;
3891
+ /**
3892
+ * Register a handler to run on the specified event(s). Each mod can only register once for every event, as any additional registration will overwrite the previous one. This holds true even if different filters are used for subsequent registrations.
3893
+ * @param event The event(s) or custom-input to invoke the handler on.
3894
+ * @param handler The handler for this event. Passing `nil` will unregister it.
3895
+ * @param filters The filters for this event. Can only be used when registering for individual events.
3896
+ * @example ```
3897
+ -- Register for the on_tick event to print the current tick to console each tick
3898
+ script.on_event(defines.events.on_tick,
3899
+ function(event) game.print(event.tick) end)
3900
+ ```
3901
+ * @example ```
3902
+ -- Register for the on_built_entity event, limiting it to only be received when a `"fast-inserter"` is built
3903
+ script.on_event(defines.events.on_built_entity,
3904
+ function(event) game.print("Gotta go fast!") end,
3905
+ {{filter = "name", name = "fast-inserter"}})
3798
3906
  ```
3799
3907
  */
3800
3908
  on_event(this: void, event: defines.events.on_tick, handler: ((this: void, arg0: runtime.on_tick) => any) | nil, filters?: EventFilter): void;
@@ -3813,6 +3921,60 @@ interface LuaBootstrap {
3813
3921
  script.on_event(defines.events.on_built_entity,
3814
3922
  function(event) game.print("Gotta go fast!") end,
3815
3923
  {{filter = "name", name = "fast-inserter"}})
3924
+ ```
3925
+ */
3926
+ on_event(this: void, event: defines.events.on_tower_mined_plant, handler: ((this: void, arg0: runtime.on_tower_mined_plant) => any) | nil, filters?: EventFilter): void;
3927
+ /**
3928
+ * Register a handler to run on the specified event(s). Each mod can only register once for every event, as any additional registration will overwrite the previous one. This holds true even if different filters are used for subsequent registrations.
3929
+ * @param event The event(s) or custom-input to invoke the handler on.
3930
+ * @param handler The handler for this event. Passing `nil` will unregister it.
3931
+ * @param filters The filters for this event. Can only be used when registering for individual events.
3932
+ * @example ```
3933
+ -- Register for the on_tick event to print the current tick to console each tick
3934
+ script.on_event(defines.events.on_tick,
3935
+ function(event) game.print(event.tick) end)
3936
+ ```
3937
+ * @example ```
3938
+ -- Register for the on_built_entity event, limiting it to only be received when a `"fast-inserter"` is built
3939
+ script.on_event(defines.events.on_built_entity,
3940
+ function(event) game.print("Gotta go fast!") end,
3941
+ {{filter = "name", name = "fast-inserter"}})
3942
+ ```
3943
+ */
3944
+ on_event(this: void, event: defines.events.on_tower_planted_seed, handler: ((this: void, arg0: runtime.on_tower_planted_seed) => any) | nil, filters?: EventFilter): void;
3945
+ /**
3946
+ * Register a handler to run on the specified event(s). Each mod can only register once for every event, as any additional registration will overwrite the previous one. This holds true even if different filters are used for subsequent registrations.
3947
+ * @param event The event(s) or custom-input to invoke the handler on.
3948
+ * @param handler The handler for this event. Passing `nil` will unregister it.
3949
+ * @param filters The filters for this event. Can only be used when registering for individual events.
3950
+ * @example ```
3951
+ -- Register for the on_tick event to print the current tick to console each tick
3952
+ script.on_event(defines.events.on_tick,
3953
+ function(event) game.print(event.tick) end)
3954
+ ```
3955
+ * @example ```
3956
+ -- Register for the on_built_entity event, limiting it to only be received when a `"fast-inserter"` is built
3957
+ script.on_event(defines.events.on_built_entity,
3958
+ function(event) game.print("Gotta go fast!") end,
3959
+ {{filter = "name", name = "fast-inserter"}})
3960
+ ```
3961
+ */
3962
+ on_event(this: void, event: defines.events.on_tower_pre_mined_plant, handler: ((this: void, arg0: runtime.on_tower_pre_mined_plant) => any) | nil, filters?: EventFilter): void;
3963
+ /**
3964
+ * Register a handler to run on the specified event(s). Each mod can only register once for every event, as any additional registration will overwrite the previous one. This holds true even if different filters are used for subsequent registrations.
3965
+ * @param event The event(s) or custom-input to invoke the handler on.
3966
+ * @param handler The handler for this event. Passing `nil` will unregister it.
3967
+ * @param filters The filters for this event. Can only be used when registering for individual events.
3968
+ * @example ```
3969
+ -- Register for the on_tick event to print the current tick to console each tick
3970
+ script.on_event(defines.events.on_tick,
3971
+ function(event) game.print(event.tick) end)
3972
+ ```
3973
+ * @example ```
3974
+ -- Register for the on_built_entity event, limiting it to only be received when a `"fast-inserter"` is built
3975
+ script.on_event(defines.events.on_built_entity,
3976
+ function(event) game.print("Gotta go fast!") end,
3977
+ {{filter = "name", name = "fast-inserter"}})
3816
3978
  ```
3817
3979
  */
3818
3980
  on_event(this: void, event: defines.events.on_train_changed_state, handler: ((this: void, arg0: runtime.on_train_changed_state) => any) | nil, filters?: EventFilter): void;
@@ -4065,6 +4227,24 @@ interface LuaBootstrap {
4065
4227
  script.on_event(defines.events.on_built_entity,
4066
4228
  function(event) game.print("Gotta go fast!") end,
4067
4229
  {{filter = "name", name = "fast-inserter"}})
4230
+ ```
4231
+ */
4232
+ on_event(this: void, event: defines.events.script_raised_destroy_segmented_unit, handler: ((this: void, arg0: runtime.script_raised_destroy_segmented_unit) => any) | nil, filters?: EventFilter): void;
4233
+ /**
4234
+ * Register a handler to run on the specified event(s). Each mod can only register once for every event, as any additional registration will overwrite the previous one. This holds true even if different filters are used for subsequent registrations.
4235
+ * @param event The event(s) or custom-input to invoke the handler on.
4236
+ * @param handler The handler for this event. Passing `nil` will unregister it.
4237
+ * @param filters The filters for this event. Can only be used when registering for individual events.
4238
+ * @example ```
4239
+ -- Register for the on_tick event to print the current tick to console each tick
4240
+ script.on_event(defines.events.on_tick,
4241
+ function(event) game.print(event.tick) end)
4242
+ ```
4243
+ * @example ```
4244
+ -- Register for the on_built_entity event, limiting it to only be received when a `"fast-inserter"` is built
4245
+ script.on_event(defines.events.on_built_entity,
4246
+ function(event) game.print("Gotta go fast!") end,
4247
+ {{filter = "name", name = "fast-inserter"}})
4068
4248
  ```
4069
4249
  */
4070
4250
  on_event(this: void, event: defines.events.script_raised_revive, handler: ((this: void, arg0: runtime.script_raised_revive) => any) | nil, filters?: EventFilter): void;
@@ -4245,6 +4425,12 @@ interface LuaBootstrap {
4245
4425
  raise_script_destroy(this: void, table: {
4246
4426
  entity: LuaEntity;
4247
4427
  }): void;
4428
+ /**
4429
+ * @param table.segmented_unit The segmented unit that was destroyed.
4430
+ */
4431
+ raise_script_destroy_segmented_unit(this: void, table: {
4432
+ segmented_unit: LuaSegmentedUnit;
4433
+ }): void;
4248
4434
  /**
4249
4435
  * @param table.entity The entity that was revived.
4250
4436
  * @param table.tags The tags associated with this entity, if any.
@@ -4882,6 +5068,17 @@ interface LuaControl {
4882
5068
  * @returns `true` if at least a part of the given items could be inserted into this inventory.
4883
5069
  */
4884
5070
  can_insert(this: void, items: ItemStackIdentification): boolean;
5071
+ /**
5072
+ * Checks if this character or player can build the given entity at the given location on the surface the character or player is on.
5073
+ * @param table.name Name of the entity that would be built.
5074
+ * @param table.position Where the entity would be placed.
5075
+ * @param table.direction Direction the entity would be facing. Defaults to `north`.
5076
+ */
5077
+ can_place_entity(this: void, table: {
5078
+ name: EntityID;
5079
+ position: MapPosition;
5080
+ direction?: defines.direction;
5081
+ }): boolean;
4885
5082
  /**
4886
5083
  * Can a given entity be opened or accessed?
4887
5084
  */
@@ -5749,12 +5946,21 @@ interface LuaEntity extends LuaControl {
5749
5946
  ```
5750
5947
  */
5751
5948
  add_market_item(this: void, offer: Offer): void;
5949
+ /**
5950
+ * Upgrades this entity in place if it's marked to be upgraded.
5951
+ * @returns [0] - The first upgraded entity - `nil` if this entity is not marked for upgrade.
5952
+ * @returns [1] - The second upgraded entity - `nil` if this entity is not marked for upgrade.
5953
+ */
5954
+ apply_upgrade(this: void): LuaMultiReturn<[
5955
+ LuaEntity | null,
5956
+ LuaEntity | null
5957
+ ]>;
5752
5958
  /**
5753
5959
  * Whether the entity can be destroyed
5754
5960
  */
5755
5961
  can_be_destroyed(this: void): boolean;
5756
5962
  /**
5757
- * The same as {@link LuaInventory::can_set_filter | runtime:LuaInventory::can_set_filter} but also works for ghosts.
5963
+ * The same as {@link LuaInventory::can_set_filter | runtime:LuaInventory::can_set_filter} but also works for ghosts where the inventory is not available through {@link LuaControl::get_inventory | runtime:LuaControl::get_inventory}.
5758
5964
  * @param index The item stack index
5759
5965
  * @param filter The item filter
5760
5966
  */
@@ -5805,8 +6011,6 @@ interface LuaEntity extends LuaControl {
5805
6011
  * Connects current linked belt with another one.
5806
6012
  *
5807
6013
  * Neighbours have to be of different type. If given linked belt is connected to something else it will be disconnected first. If provided neighbour is connected to something else it will also be disconnected first. Automatically updates neighbour to be connected back to this one.
5808
- *
5809
- * Can also be used on entity ghost if it contains linked-belt.
5810
6014
  * @param neighbour Another linked belt or entity ghost containing linked belt to connect or nil to disconnect
5811
6015
  */
5812
6016
  connect_linked_belts(this: void, neighbour?: LuaEntity): void;
@@ -5820,7 +6024,7 @@ interface LuaEntity extends LuaControl {
5820
6024
  * @param by_player If provided, the copying is done 'as' this player and {@link on_entity_settings_pasted | runtime:on_entity_settings_pasted} is triggered.
5821
6025
  * @returns Any items removed from this entity as a result of copying the settings.
5822
6026
  */
5823
- copy_settings(this: void, entity: LuaEntity, by_player?: PlayerIdentification): ItemWithQualityCounts[];
6027
+ copy_settings(this: void, entity: LuaEntity, by_player?: PlayerIdentification): ItemWithQualityCounts;
5824
6028
  /**
5825
6029
  * Creates the same smoke that is created when you place a building by hand.
5826
6030
  *
@@ -5879,8 +6083,6 @@ interface LuaEntity extends LuaControl {
5879
6083
  die(this: void, force?: ForceID, cause?: LuaEntity): boolean;
5880
6084
  /**
5881
6085
  * Disconnects linked belt from its neighbour.
5882
- *
5883
- * Can also be used on entity ghost if it contains linked-belt
5884
6086
  */
5885
6087
  disconnect_linked_belts(this: void): void;
5886
6088
  /**
@@ -6040,11 +6242,11 @@ interface LuaEntity extends LuaControl {
6040
6242
  */
6041
6243
  get_infinity_pipe_filter(this: void): InfinityPipeFilter | null;
6042
6244
  /**
6043
- * The same as {@link LuaInventory::get_bar | runtime:LuaInventory::get_bar} but also works for ghosts.
6245
+ * The same as {@link LuaInventory::get_bar | runtime:LuaInventory::get_bar} but also works for ghosts where the inventory is not available through {@link LuaControl::get_inventory | runtime:LuaControl::get_inventory}.
6044
6246
  */
6045
6247
  get_inventory_bar(this: void, inventory_index: defines.inventory): uint;
6046
6248
  /**
6047
- * The same as {@link LuaInventory::get_filter | runtime:LuaInventory::get_filter} but also works for ghosts.
6249
+ * The same as {@link LuaInventory::get_filter | runtime:LuaInventory::get_filter} but also works for ghosts where the inventory is not available through {@link LuaControl::get_inventory | runtime:LuaControl::get_inventory}.
6048
6250
  * @param index The item stack index
6049
6251
  * @returns The current filter or `nil` if none.
6050
6252
  */
@@ -6258,11 +6460,11 @@ interface LuaEntity extends LuaControl {
6258
6460
  */
6259
6461
  insert_fluid(this: void, fluid: Fluid): double;
6260
6462
  /**
6261
- * The same as {@link LuaInventory::supports_bar | runtime:LuaInventory::supports_bar} but also works for ghosts.
6463
+ * The same as {@link LuaInventory::supports_bar | runtime:LuaInventory::supports_bar} but also works for ghosts where the inventory is not available through {@link LuaControl::get_inventory | runtime:LuaControl::get_inventory}.
6262
6464
  */
6263
6465
  inventory_supports_bar(this: void, inventory_index: defines.inventory): boolean;
6264
6466
  /**
6265
- * The same as {@link LuaInventory::supports_filters | runtime:LuaInventory::supports_filters} but also works for ghosts.
6467
+ * The same as {@link LuaInventory::supports_filters | runtime:LuaInventory::supports_filters} but also works for ghosts where the inventory is not available through {@link LuaControl::get_inventory | runtime:LuaControl::get_inventory}.
6266
6468
  */
6267
6469
  inventory_supports_filters(this: void, inventory_index: defines.inventory): boolean;
6268
6470
  /**
@@ -6282,7 +6484,7 @@ interface LuaEntity extends LuaControl {
6282
6484
  */
6283
6485
  is_crafting(this: void): boolean;
6284
6486
  /**
6285
- * The same as {@link LuaInventory::is_filtered | runtime:LuaInventory::is_filtered} but also works for ghosts.
6487
+ * The same as {@link LuaInventory::is_filtered | runtime:LuaInventory::is_filtered} but also works for ghosts where the inventory is not available through {@link LuaControl::get_inventory | runtime:LuaControl::get_inventory}.
6286
6488
  */
6287
6489
  is_inventory_filtered(this: void, inventory_index: defines.inventory): boolean;
6288
6490
  /**
@@ -6368,6 +6570,15 @@ interface LuaEntity extends LuaControl {
6368
6570
  * @returns Whether the request is valid. The sound may or may not be played depending on polyphony settings.
6369
6571
  */
6370
6572
  play_note(this: void, instrument: uint, note: uint, stop_playing_sounds?: boolean): boolean;
6573
+ /**
6574
+ * Registers the given tree in this agricultral tower.
6575
+ *
6576
+ * If the tree is not within range of the tower it will not be registered.
6577
+ *
6578
+ * If the tree is already registered with a tower it will not be registered.
6579
+ * @returns If the tree was registered.
6580
+ */
6581
+ register_tree(this: void, tree: LuaEntity): boolean;
6371
6582
  /**
6372
6583
  * Release the unit from the spawner which spawned it. This allows the spawner to continue spawning additional units.
6373
6584
  */
@@ -6476,12 +6687,12 @@ interface LuaEntity extends LuaControl {
6476
6687
  */
6477
6688
  set_infinity_pipe_filter(this: void, filter: InfinityPipeFilter | nil): void;
6478
6689
  /**
6479
- * The same as {@link LuaInventory::set_bar | runtime:LuaInventory::set_bar} but also works for ghosts.
6690
+ * The same as {@link LuaInventory::set_bar | runtime:LuaInventory::set_bar} but also works for ghosts where the inventory is not available through {@link LuaControl::get_inventory | runtime:LuaControl::get_inventory}.
6480
6691
  * @param bar The new limit. Omitting this parameter or passing `nil` will clear the limit.
6481
6692
  */
6482
6693
  set_inventory_bar(this: void, inventory_index: defines.inventory, bar?: uint): void;
6483
6694
  /**
6484
- * The same as {@link LuaInventory::set_filter | runtime:LuaInventory::set_filter} but also works for ghosts.
6695
+ * The same as {@link LuaInventory::set_filter | runtime:LuaInventory::set_filter} but also works for ghosts where the inventory is not available through {@link LuaControl::get_inventory | runtime:LuaControl::get_inventory}.
6485
6696
  * @param index The item stack index.
6486
6697
  * @param filter The new filter. `nil` erases any existing filter.
6487
6698
  * @returns If the filter was allowed to be set.
@@ -6511,7 +6722,7 @@ interface LuaEntity extends LuaControl {
6511
6722
  * @param quality The quality. If not provided `normal` is used.
6512
6723
  * @returns Any items removed from this entity as a result of setting the recipe.
6513
6724
  */
6514
- set_recipe(this: void, recipe?: RecipeID, quality?: QualityID): ItemWithQualityCounts[];
6725
+ set_recipe(this: void, recipe?: RecipeID, quality?: QualityID): ItemWithQualityCounts;
6515
6726
  /**
6516
6727
  * Revives a ghost silently, so the revival makes no sound and no smoke is created.
6517
6728
  * @param table.raise_revive If true, and an entity ghost; {@link script_raised_revive | runtime:script_raised_revive} will be called. Else if true, and a tile ghost; {@link script_raised_set_tiles | runtime:script_raised_set_tiles} will be called.
@@ -6522,7 +6733,7 @@ interface LuaEntity extends LuaControl {
6522
6733
  silent_revive(this: void, table: {
6523
6734
  raise_revive?: boolean;
6524
6735
  }): LuaMultiReturn<[
6525
- ItemWithQualityCounts[],
6736
+ ItemWithQualityCounts,
6526
6737
  LuaEntity | null,
6527
6738
  LuaEntity | null
6528
6739
  ]>;
@@ -6651,14 +6862,12 @@ interface LuaEntity extends LuaControl {
6651
6862
  };
6652
6863
  /**
6653
6864
  * Gives what is the current shape of a transport-belt.
6654
- *
6655
- * Can also be used on entity ghost if it contains transport-belt.
6656
6865
  */
6657
6866
  readonly belt_shape: 'straight' | 'left' | 'right';
6658
6867
  /**
6659
6868
  * Whether this underground belt goes into or out of the ground.
6660
6869
  */
6661
- readonly belt_to_ground_type: 'input' | 'output';
6870
+ readonly belt_to_ground_type: BeltConnectionType;
6662
6871
  bonus_damage_modifiers: TriggerModifierData;
6663
6872
  /**
6664
6873
  * The bonus mining progress for this mining drill. Read yields a number in range [0, mining_target.prototype.mineable_properties.mining_time]. `nil` if this isn't a mining drill.
@@ -6948,7 +7157,7 @@ interface LuaEntity extends LuaControl {
6948
7157
  */
6949
7158
  readonly ghost_localised_name: LocalisedString;
6950
7159
  /**
6951
- * Name of the entity or tile contained in this ghost
7160
+ * Name of the entity or tile contained in this ghost.
6952
7161
  */
6953
7162
  readonly ghost_name: string;
6954
7163
  /**
@@ -7029,7 +7238,7 @@ interface LuaEntity extends LuaControl {
7029
7238
  /**
7030
7239
  * The spoil priority for this inserter.
7031
7240
  */
7032
- inserter_spoil_priority: 'fresh_first' | 'none' | 'spoiled_first';
7241
+ inserter_spoil_priority: SpoilPriority;
7033
7242
  /**
7034
7243
  * Sets the stack size limit on this inserter.
7035
7244
  *
@@ -7073,7 +7282,7 @@ interface LuaEntity extends LuaControl {
7073
7282
  /**
7074
7283
  * Items this ghost will request when revived or items this item request proxy is requesting.
7075
7284
  */
7076
- readonly item_requests: ItemWithQualityCounts[];
7285
+ readonly item_requests: ItemWithQualityCounts;
7077
7286
  /**
7078
7287
  * The number of units killed by this turret, artillery turret, or artillery wagon.
7079
7288
  */
@@ -7094,8 +7303,6 @@ interface LuaEntity extends LuaControl {
7094
7303
  /**
7095
7304
  * Neighbour to which this linked belt is connected to, if any.
7096
7305
  *
7097
- * Can also be used on entity ghost if it contains linked-belt.
7098
- *
7099
7306
  * May return entity ghost which contains linked belt to which connection is made.
7100
7307
  */
7101
7308
  readonly linked_belt_neighbour?: LuaEntity;
@@ -7103,10 +7310,8 @@ interface LuaEntity extends LuaControl {
7103
7310
  * Type of linked belt. Changing type will also flip direction so the belt is out of the same side.
7104
7311
  *
7105
7312
  * Can only be changed when linked belt is disconnected (has no neighbour set).
7106
- *
7107
- * Can also be used on entity ghost if it contains linked-belt.
7108
7313
  */
7109
- linked_belt_type: 'input' | 'output';
7314
+ linked_belt_type: BeltConnectionType;
7110
7315
  /**
7111
7316
  * The belt stack size override for this loader. Set to `0` to disable. Writing this value requires {@link LoaderPrototype::adjustable_belt_stack_size | prototype:LoaderPrototype::adjustable_belt_stack_size} to be `true`.
7112
7317
  */
@@ -7118,11 +7323,11 @@ interface LuaEntity extends LuaControl {
7118
7323
  /**
7119
7324
  * The filter mode for this loader. `nil` if this loader does not support filters.
7120
7325
  */
7121
- loader_filter_mode?: 'none' | 'whitelist' | 'blacklist';
7326
+ loader_filter_mode?: PrototypeFilterMode;
7122
7327
  /**
7123
7328
  * Whether this loader gets items from or puts item into a container.
7124
7329
  */
7125
- loader_type: 'input' | 'output';
7330
+ loader_type: BeltConnectionType;
7126
7331
  readonly localised_description: LocalisedString;
7127
7332
  /**
7128
7333
  * Localised name of the entity.
@@ -7283,6 +7488,10 @@ interface LuaEntity extends LuaControl {
7283
7488
  * The rail target of this pump, if any.
7284
7489
  */
7285
7490
  readonly pump_rail_target?: LuaEntity;
7491
+ /**
7492
+ * The amount of fluid moved by this offshore pump or normal pump in the last tick.
7493
+ */
7494
+ readonly pumped_last_tick: double;
7286
7495
  /**
7287
7496
  * The quality of this entity.
7288
7497
  *
@@ -7379,6 +7588,10 @@ interface LuaEntity extends LuaControl {
7379
7588
  * The secondary selection box of this entity or `nil` if it doesn't have one. This only exists for curved rails, and is automatically determined by the game.
7380
7589
  */
7381
7590
  readonly secondary_selection_box?: BoundingBox;
7591
+ /**
7592
+ * The segmented unit object that the segment entity is a part of.
7593
+ */
7594
+ readonly segmented_unit?: LuaSegmentedUnit;
7382
7595
  /**
7383
7596
  * Index of the currently selected weapon slot of this character, car, or spidertron. `nil` if this entity doesn't have guns.
7384
7597
  */
@@ -7671,7 +7884,7 @@ interface LuaEntityPrototype extends LuaPrototypeBase {
7671
7884
  */
7672
7885
  get_mining_drill_radius(this: void, quality?: QualityID): double | null;
7673
7886
  /**
7674
- * The pumping speed of this offshore or normal pump.
7887
+ * The pumping speed of this offshore pump or normal pump.
7675
7888
  */
7676
7889
  get_pumping_speed(this: void, quality?: QualityID): double;
7677
7890
  /**
@@ -7696,6 +7909,7 @@ interface LuaEntityPrototype extends LuaPrototypeBase {
7696
7909
  * A table of pollutions amounts that has to be absorbed by the unit's spawner before the unit will leave the spawner and attack the source of the pollution, indexed by the name of each absorbed pollution type.
7697
7910
  */
7698
7911
  readonly absorptions_to_join_attack?: Record<string, float>;
7912
+ readonly acceleration_rate: double;
7699
7913
  readonly accepted_seeds?: string[];
7700
7914
  /**
7701
7915
  * The active energy usage of this rocket silo or combinator prototype.
@@ -7793,6 +8007,7 @@ interface LuaEntityPrototype extends LuaPrototypeBase {
7793
8007
  * The attack result of this entity, if any.
7794
8008
  */
7795
8009
  readonly attack_result?: TriggerItem[];
8010
+ readonly attacking_speed?: double;
7796
8011
  readonly auto_setup_collision_box: boolean;
7797
8012
  /**
7798
8013
  * The amount of ammo that inserters automatically insert into this ammo-turret or artillery-turret.
@@ -8031,6 +8246,8 @@ interface LuaEntityPrototype extends LuaPrototypeBase {
8031
8246
  * The engine starting speed for this rocket silo rocket prototype.
8032
8247
  */
8033
8248
  readonly engine_starting_speed?: double;
8249
+ readonly enraged_duration?: MapTick;
8250
+ readonly enraged_speed: double;
8034
8251
  readonly enter_vehicle_distance?: double;
8035
8252
  /**
8036
8253
  * Whether this explosion has a beam.
@@ -8193,6 +8410,7 @@ interface LuaEntityPrototype extends LuaPrototypeBase {
8193
8410
  * Weight limit of the inventory if inventory_type is `"with_weight_limit"`.
8194
8411
  */
8195
8412
  readonly inventory_weight_limit?: Weight;
8413
+ readonly investigating_speed?: double;
8196
8414
  /**
8197
8415
  *
8198
8416
  * These are the objects that are considered buildings:
@@ -8265,7 +8483,7 @@ interface LuaEntityPrototype extends LuaPrototypeBase {
8265
8483
  /**
8266
8484
  * Items that when placed will produce this entity, if any. Construction bots will choose the first item in the list to build this entity.
8267
8485
  */
8268
- readonly items_to_place_this?: ItemWithCount[];
8486
+ readonly items_to_place_this?: ItemToPlace[];
8269
8487
  readonly joint_distance?: double;
8270
8488
  /**
8271
8489
  * The item prototype names that are the inputs of this lab prototype.
@@ -8454,6 +8672,8 @@ interface LuaEntityPrototype extends LuaPrototypeBase {
8454
8672
  readonly object_name: string;
8455
8673
  readonly overkill_fraction?: float;
8456
8674
  readonly passive_energy_usage?: double;
8675
+ readonly patrolling_speed?: double;
8676
+ readonly patrolling_turn_radius?: double;
8457
8677
  readonly per_lane_filters?: boolean;
8458
8678
  readonly perceived_performance?: PerceivedPerformance;
8459
8679
  /**
@@ -8465,7 +8685,7 @@ interface LuaEntityPrototype extends LuaPrototypeBase {
8465
8685
  */
8466
8686
  readonly protected_from_tile_building: boolean;
8467
8687
  /**
8468
- * The pumping speed of this offshore or normal pump. This property is deprecated in favor of {@link LuaEntityPrototype::get_pumping_speed | runtime:LuaEntityPrototype::get_pumping_speed} and should not be used.
8688
+ * The pumping speed of this offshore pump or normal pump. This property is deprecated in favor of {@link LuaEntityPrototype::get_pumping_speed | runtime:LuaEntityPrototype::get_pumping_speed} and should not be used.
8469
8689
  */
8470
8690
  readonly pumping_speed?: double;
8471
8691
  readonly quality_affects_mining_radius?: boolean;
@@ -8520,6 +8740,10 @@ interface LuaEntityPrototype extends LuaPrototypeBase {
8520
8740
  * The result units and spawn points with weight and evolution factor for a biter spawner entity.
8521
8741
  */
8522
8742
  readonly result_units?: UnitSpawnDefinition[];
8743
+ /**
8744
+ * The revenge attack parameters for this entity, if any. These attack parameters are used in addition to {@link LuaEntityPrototype::attack_parameters | runtime:LuaEntityPrototype::attack_parameters} if the entity is attacking a target that has previously dealt damage to the entity.
8745
+ */
8746
+ readonly revenge_attack_parameters?: AttackParameters;
8523
8747
  readonly rewire_neighbours_when_destroying: boolean;
8524
8748
  /**
8525
8749
  * The rising speed for this rocket silo rocket prototype.
@@ -8561,6 +8785,7 @@ interface LuaEntityPrototype extends LuaPrototypeBase {
8561
8785
  * The secondary bounding box used for collision checking, if any. This is only used in rails and rail remnants.
8562
8786
  */
8563
8787
  readonly secondary_collision_box?: BoundingBox;
8788
+ readonly segment_engine?: SegmentEngineSpecification;
8564
8789
  /**
8565
8790
  * Is this entity selectable?
8566
8791
  */
@@ -8633,10 +8858,16 @@ interface LuaEntityPrototype extends LuaPrototypeBase {
8633
8858
  * The terrain friction modifier for this vehicle.
8634
8859
  */
8635
8860
  readonly terrain_friction_modifier?: float;
8861
+ readonly territory_radius?: uint;
8636
8862
  readonly tether_size?: float;
8863
+ readonly ticks_per_scan?: uint;
8637
8864
  readonly ticks_to_keep_aiming_direction?: uint;
8638
8865
  readonly ticks_to_keep_gun?: uint;
8639
8866
  readonly ticks_to_stay_in_combat?: uint;
8867
+ /**
8868
+ * The tile buildability rules of this entity prototype.
8869
+ */
8870
+ readonly tile_buildability_rules?: TileBuildabilityRule[];
8640
8871
  /**
8641
8872
  * 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)
8642
8873
  */
@@ -8675,6 +8906,8 @@ interface LuaEntityPrototype extends LuaPrototypeBase {
8675
8906
  * The values in the dictionary are meaningless and exists just to allow the dictionary type for easy lookup.
8676
8907
  */
8677
8908
  readonly trigger_target_mask: Record<string, boolean>;
8909
+ readonly turn_radius?: double;
8910
+ readonly turn_smoothing?: double;
8678
8911
  /**
8679
8912
  * The range of this turret.
8680
8913
  */
@@ -8685,6 +8918,14 @@ interface LuaEntityPrototype extends LuaPrototypeBase {
8685
8918
  readonly turret_rotation_speed?: float;
8686
8919
  readonly two_direction_only?: boolean;
8687
8920
  readonly unpowered_arm_speed_scale?: float;
8921
+ /**
8922
+ * The trigger effects to run every tick when on cooldown.
8923
+ */
8924
+ readonly update_effects?: TriggerEffectWithCooldown[];
8925
+ /**
8926
+ * The trigger effects to run every tick when on cooldown while the owning {@link LuaSegmentedUnit | runtime:LuaSegmentedUnit} is enraged.
8927
+ */
8928
+ readonly update_effects_while_enraged?: TriggerEffectWithCooldown[];
8688
8929
  /**
8689
8930
  * Whether this logistic container prototype uses exact mode
8690
8931
  */
@@ -8927,13 +9168,13 @@ interface LuaEquipmentGrid {
8927
9168
  position?: EquipmentPosition;
8928
9169
  equipment?: LuaEquipment;
8929
9170
  by_player?: PlayerIdentification;
8930
- }): ItemWithCount | null;
9171
+ }): ItemWithQualityCount | null;
8931
9172
  /**
8932
9173
  * Remove all equipment from the grid.
8933
9174
  * @param by_player If provided, the action is done 'as' this player and {@link on_player_removed_equipment | runtime:on_player_removed_equipment} is triggered.
8934
9175
  * @returns List of the equipment that has been removed.
8935
9176
  */
8936
- take_all(this: void, by_player?: PlayerIdentification): ItemWithQualityCounts[];
9177
+ take_all(this: void, by_player?: PlayerIdentification): ItemWithQualityCounts;
8937
9178
  /**
8938
9179
  * The total energy stored in all batteries in the equipment grid.
8939
9180
  */
@@ -9381,7 +9622,7 @@ interface LuaFluidBoxPrototype {
9381
9622
  /**
9382
9623
  * The production type.
9383
9624
  */
9384
- readonly production_type: 'input' | 'input-output' | 'output' | 'none';
9625
+ readonly production_type: ProductionType;
9385
9626
  /**
9386
9627
  * The render layer.
9387
9628
  */
@@ -9615,6 +9856,15 @@ interface LuaForce {
9615
9856
  * Is `other` force in this force's cease fire list?
9616
9857
  */
9617
9858
  get_cease_fire(this: void, other: ForceID): boolean;
9859
+ /**
9860
+ * Gets the raw chart data for a given chunk as a binary string.
9861
+ *
9862
+ * The pixel data is returned in RGB565 format (2 bytes per pixel).
9863
+ *
9864
+ * Returns `nil` if the chunk has not been charted for this force.
9865
+ * @returns The raw pixel data.
9866
+ */
9867
+ get_chunk_chart(this: void, surface: SurfaceIdentification, position: ChunkPosition): string | null;
9618
9868
  /**
9619
9869
  * The entity build statistics for this force (built and mined) for the given surface.
9620
9870
  */
@@ -9968,7 +10218,7 @@ interface LuaForce {
9968
10218
  /**
9969
10219
  * All of the items that have been launched in rockets.
9970
10220
  */
9971
- readonly items_launched: ItemWithQualityCounts[];
10221
+ readonly items_launched: ItemWithQualityCounts;
9972
10222
  laboratory_productivity_bonus: double;
9973
10223
  laboratory_speed_modifier: double;
9974
10224
  /**
@@ -11992,9 +12242,9 @@ interface LuaHelpers {
11992
12242
  *
11993
12243
  * This must be enabled per-instance with `--enable-lua-udp`.
11994
12244
  *
11995
- * Udp socket when enabled requests 256KB of receive buffer from the operating system. If there is more data than this between two subsequent calls of this method, data will be lost. That also applies to periods when the game is paused or is being saved as in those case the game update is not happening.
12245
+ * UDP socket when enabled requests 256KB of receive buffer from the operating system. If there is more data than this between two subsequent calls of this method, data will be lost. That also applies to periods when the game is paused or is being saved as in those case the game update is not happening.
11996
12246
  *
11997
- * Note: lua event is not raised immediately as the udp packet needs to be introduced into game state by means of input actions. Please keep incoming traffic as small as possible as in case of multiplayer game with many players, all this data will have to go through the multiplayer server and be distributed to all clients.
12247
+ * Note: lua event is not raised immediately as the UDP packet needs to be introduced into game state by means of input actions. Please keep incoming traffic as small as possible as in case of multiplayer game with many players, all this data will have to go through the multiplayer server and be distributed to all clients.
11998
12248
  *
11999
12249
  * Not available in settings and prototype stages.
12000
12250
  * @param for_player If given, packets will only be read from this `player_index`. Providing `0` will only read from the server if present.
@@ -12130,7 +12380,7 @@ interface LuaInventory {
12130
12380
  * Get counts of all items in this inventory.
12131
12381
  * @returns List of all items in the inventory.
12132
12382
  */
12133
- get_contents(this: void): ItemWithQualityCounts[];
12383
+ get_contents(this: void): ItemWithQualityCounts;
12134
12384
  /**
12135
12385
  * Gets the filter for the given item stack index.
12136
12386
  * @param index The item stack index
@@ -12539,7 +12789,7 @@ interface LuaItemCommon {
12539
12789
  /**
12540
12790
  * List of raw materials required to build this blueprint.
12541
12791
  */
12542
- readonly cost_to_build: ItemWithQualityCounts[];
12792
+ readonly cost_to_build: ItemWithQualityCounts;
12543
12793
  /**
12544
12794
  * The custom description this item-with-tags. This is shown over the normal item description if this is set to a non-empty value.
12545
12795
  */
@@ -12803,7 +13053,7 @@ interface LuaItemPrototype extends LuaPrototypeBase {
12803
13053
  /**
12804
13054
  * The filter mode used by this item with inventory.
12805
13055
  */
12806
- readonly filter_mode?: 'none' | 'whitelist' | 'blacklist';
13056
+ readonly filter_mode?: PrototypeFilterMode;
12807
13057
  /**
12808
13058
  * The flags for this item prototype.
12809
13059
  */
@@ -13198,7 +13448,7 @@ interface LuaLogisticCell {
13198
13448
  */
13199
13449
  readonly logistics_connection_distance: float;
13200
13450
  /**
13201
- * `true` if this is a mobile cell. In vanilla, only the logistic cell created by a character's personal roboport is mobile.
13451
+ * `true` if this is a mobile cell. The logistic cell created by roboport equipment considered is mobile.
13202
13452
  */
13203
13453
  readonly mobile: boolean;
13204
13454
  /**
@@ -13282,9 +13532,10 @@ interface LuaLogisticNetwork {
13282
13532
  find_cell_closest_to(this: void, position: MapPosition): LuaLogisticCell | null;
13283
13533
  /**
13284
13534
  * Get item counts for the entire network, similar to how {@link LuaInventory::get_contents | runtime:LuaInventory::get_contents} does.
13535
+ * @param member Logistic members to check. If not given, gives item counts for the entire network.
13285
13536
  * @returns List of all items in the network.
13286
13537
  */
13287
- get_contents(this: void): ItemWithQualityCounts[];
13538
+ get_contents(this: void, member?: 'storage' | 'providers'): ItemWithQualityCounts;
13288
13539
  /**
13289
13540
  * Count given or all items in the network or given members.
13290
13541
  * @param item Item name to count. If not given, gives counts of all items in the network.
@@ -13507,11 +13758,11 @@ interface LuaLogisticPoint {
13507
13758
  /**
13508
13759
  * Items targeted to be dropped off into this logistic point by robots.
13509
13760
  */
13510
- readonly targeted_items_deliver: ItemWithQualityCounts[];
13761
+ readonly targeted_items_deliver: ItemWithQualityCounts;
13511
13762
  /**
13512
13763
  * Items targeted to be picked up from this logistic point by robots.
13513
13764
  */
13514
- readonly targeted_items_pickup: ItemWithQualityCounts[];
13765
+ readonly targeted_items_pickup: ItemWithQualityCounts;
13515
13766
  /**
13516
13767
  * Whether this logistic point is set to trash unrequested items.
13517
13768
  */
@@ -14007,17 +14258,6 @@ interface LuaPlayer extends LuaControl {
14007
14258
  terrain_building_size?: uint;
14008
14259
  skip_fog_of_war?: boolean;
14009
14260
  }): boolean;
14010
- /**
14011
- * Checks if this player can build the given entity at the given location on the surface the player is on.
14012
- * @param table.name Name of the entity to check.
14013
- * @param table.position Where the entity would be placed.
14014
- * @param table.direction Direction the entity would be placed. Defaults to `north`.
14015
- */
14016
- can_place_entity(this: void, table: {
14017
- name: EntityID;
14018
- position: MapPosition;
14019
- direction?: defines.direction;
14020
- }): boolean;
14021
14261
  /**
14022
14262
  * Clear the chat console.
14023
14263
  */
@@ -14350,6 +14590,12 @@ interface LuaPlayer extends LuaControl {
14350
14590
  * @param prototype_name Prototype name of the custom shortcut.
14351
14591
  */
14352
14592
  set_shortcut_toggled(this: void, prototype_name: string, toggled: boolean): void;
14593
+ /**
14594
+ * Sets the zoom limits for a specific controller type. To reset a controller's zoom limits to default, pass an empty table for `zoom_limits`.
14595
+ * @param controller_type The type of the controller to set the zoom limits for.
14596
+ * @param zoom_limits The new zoom limits. See {@link LuaPlayer::zoom_limits | runtime:LuaPlayer::zoom_limits} for usage information.
14597
+ */
14598
+ set_zoom_limits(this: void, controller_type: defines.controllers, zoom_limits: ZoomLimits): void;
14353
14599
  /**
14354
14600
  * Starts selection with selection tool from the specified position. Does nothing if the player's cursor is not a selection tool.
14355
14601
  * @param position The position to start selection from.
@@ -14594,11 +14840,13 @@ interface LuaPlayer extends LuaControl {
14594
14840
  */
14595
14841
  zoom: double;
14596
14842
  /**
14597
- * The current player controller's zoom limits.
14843
+ * The player's current controller's zoom limits.
14598
14844
  *
14599
14845
  * Reading this field creates a copy, so modifying the returned table's fields directly will not alter the player's zoom limits. To change the zoom limits for the player's current controller, set the entire field to the desired {@link ZoomLimits | runtime:ZoomLimits} table.
14600
14846
  *
14601
- * Zoom limits may or may not reset to default any time the player controller changes. Use the {@link defines.events.on_player_controller_changed | runtime:defines.events.on_player_controller_changed} event to respond to and correct the new controller's zoom limits.
14847
+ * Zoom limits are defined and remembered per controller type. If you set the zoom limits of the character controller, then every time the player uses the character controller, it will remember and use the zoom limits previously set. However, other controller types will not use the character controller zoom limits; each controller type must have its zoom limits defined separately.
14848
+ *
14849
+ * To set the zoom limits of ANY controller type, not just the currently active one, use {@link LuaPlayer::set_zoom_limits | runtime:LuaPlayer::set_zoom_limits}.
14602
14850
  * @example ```
14603
14851
  -- Lets the player zoom in to 4x the standard zoom level. (3x is the default for most controllers.)
14604
14852
  -- Increases the player zoom out level so that they can view approximately 800 tiles across.
@@ -15105,7 +15353,7 @@ interface LuaQualityPrototype extends LuaPrototypeBase {
15105
15353
  readonly lab_module_slots_bonus: ItemStackIndex;
15106
15354
  readonly lab_research_speed_multiplier: double;
15107
15355
  /**
15108
- * Level basically specifies the stat-increasing value of this quality level
15356
+ * Level basically specifies the stat-increasing value of this quality level.
15109
15357
  */
15110
15358
  readonly level: uint;
15111
15359
  readonly logistic_cell_charging_energy_multiplier: double;
@@ -15118,7 +15366,7 @@ interface LuaQualityPrototype extends LuaPrototypeBase {
15118
15366
  */
15119
15367
  readonly next: LuaQualityPrototype;
15120
15368
  /**
15121
- * The probability multiplier of getting the next level of quality
15369
+ * The probability multiplier of getting the next level of quality.
15122
15370
  */
15123
15371
  readonly next_probability: double;
15124
15372
  /**
@@ -15534,6 +15782,7 @@ interface LuaRecipePrototype extends LuaPrototypeBase {
15534
15782
  * Is the recipe hidden from player crafting? The recipe will still show up for selection in machines.
15535
15783
  */
15536
15784
  readonly hidden_from_player_crafting: boolean;
15785
+ readonly hide_from_bonus_gui: boolean;
15537
15786
  readonly hide_from_flow_stats: boolean;
15538
15787
  readonly hide_from_player_crafting: boolean;
15539
15788
  /**
@@ -15809,7 +16058,7 @@ interface LuaRecord {
15809
16058
  /**
15810
16059
  * List of raw materials required to build this blueprint.
15811
16060
  */
15812
- readonly cost_to_build: ItemWithQualityCounts[];
16061
+ readonly cost_to_build: ItemWithQualityCounts;
15813
16062
  /**
15814
16063
  * The default icons for a blueprint blueprint.
15815
16064
  */
@@ -16724,6 +16973,212 @@ interface LuaSchedule {
16724
16973
  */
16725
16974
  readonly valid: boolean;
16726
16975
  }
16976
+ /**
16977
+ * An individual segment of a {@link LuaSegmentedUnit | runtime:LuaSegmentedUnit}. If the segment exists in a generated chunk, you can access the entity representation using {@link LuaSegment::entity | runtime:LuaSegment::entity}.
16978
+ */
16979
+ interface LuaSegment {
16980
+ /**
16981
+ * The actual entity representation of the segment if it exists. A segment's entity will be automatically destroyed if the segment moves into chunks that have not yet been fully generated or onto "out-of-map" tiles. Conversely, if a segment moves into a chunk that is fully generated and onto a non-"out-of-map" tile, then its entity will be created if it doesn't exist yet.
16982
+ */
16983
+ readonly entity?: LuaEntity;
16984
+ /**
16985
+ * 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.
16986
+ */
16987
+ readonly object_name: string;
16988
+ /**
16989
+ * The relative orientation of the segment if one has been assigned. An orientation may not be assigned if the unit's number of body nodes is fewer than {@link LuaSegmentedUnit::max_body_nodes | runtime:LuaSegmentedUnit::max_body_nodes}.
16990
+ *
16991
+ * If {@link LuaSegment::entity | runtime:LuaSegment::entity} is non-nil, this returns that entity's {@link LuaEntity::orientation | runtime:LuaEntity::orientation}. If the entity is `nil`, then reading this field calculates the entity's would-be position if it existed. This can be expensive to compute, so avoid reading this field too often unless it is really necessary.
16992
+ */
16993
+ readonly orientation?: RealOrientation;
16994
+ /**
16995
+ * The position of the segment if one has been assigned. A position may not be assigned if the unit's number of body nodes is fewer than {@link LuaSegmentedUnit::max_body_nodes | runtime:LuaSegmentedUnit::max_body_nodes}.
16996
+ *
16997
+ * This position may be in an un-generated chunk. Use {@link LuaSurface::is_chunk_generated | runtime:LuaSurface::is_chunk_generated} to check before attempting to access the chunk.
16998
+ *
16999
+ * If {@link LuaSegment::entity | runtime:LuaSegment::entity} is non-nil, this returns that entity's {@link LuaEntity::position | runtime:LuaEntity::position}. If the entity is `nil`, then reading this field calculates the entity's would-be position if it existed. This can be expensive to compute, so avoid reading this field too often unless it is really necessary.
17000
+ */
17001
+ readonly position?: MapPosition;
17002
+ /**
17003
+ * The prototype for the entity representation of the segment.
17004
+ */
17005
+ readonly prototype: LuaEntityPrototype;
17006
+ /**
17007
+ * The segmented unit that owns the segment.
17008
+ */
17009
+ readonly unit: LuaSegmentedUnit;
17010
+ /**
17011
+ * Is this object valid? This Lua object holds a reference to an object within the game engine. It is possible that the game-engine object is removed whilst a mod still holds the corresponding Lua object. If that happens, the object becomes invalid, i.e. this attribute will be `false`. Mods are advised to check for object validity if any change to the game state might have occurred between the creation of the Lua object and its access.
17012
+ */
17013
+ readonly valid: boolean;
17014
+ }
17015
+ /**
17016
+ * A surface-level object composed of one {@link SegmentedUnitPrototype | prototype:SegmentedUnitPrototype} followed by up to 63 {@link SegmentPrototype | prototype:SegmentPrototype}s.
17017
+ *
17018
+ * This object is not an entity, and can exist on chunks that do not exist. Instead, the individual segments that compose its body will be destroyed as the unit's body crosses into un-generated or void terrain, and will be re-created when the body crosses into generated, non-void terrain.
17019
+ *
17020
+ * Use {@link LuaSurface::get_segmented_units | runtime:LuaSurface::get_segmented_units} to iterate over all units on a surface, {@link LuaTerritory::get_segmented_units | runtime:LuaTerritory::get_segmented_units} to iterate over all units that guard a territory, or {@link LuaEntity::segmented_unit | runtime:LuaEntity::segmented_unit} to get the unit that controls any given segment entity.
17021
+ */
17022
+ interface LuaSegmentedUnit {
17023
+ /**
17024
+ * Clones this unit.
17025
+ * @param table.position The destination position of the head segment. The rest of the body nodes will be copied relative to this.
17026
+ * @param table.surface The destination surface. If different from this unit's surface, then the clone will not copy the original unit's territory.
17027
+ * @param table.force The new unit's force.
17028
+ * @param table.territory The territory that the clone should guard. Must be on the same surface as the destination surface.
17029
+ * @returns The cloned unit or `nil` if the unit cannot be cloned.
17030
+ */
17031
+ clone(this: void, table: {
17032
+ position: MapPosition;
17033
+ surface?: LuaSurface;
17034
+ force?: ForceID;
17035
+ territory?: LuaTerritory;
17036
+ }): LuaSegmentedUnit | null;
17037
+ /**
17038
+ * Damages the unit.
17039
+ * @param damage The amount of damage to be done.
17040
+ * @param force The force that is doing the damage.
17041
+ * @param type The type of damage being done. Defaults to `"impact"`.
17042
+ * @param source The entity that is directly dealing the damage. This is the projectile, flame, sticker, grenade, laster beam, etc. Must be on the same surface as the entity being damaged.
17043
+ * @param cause The entity that originally triggered the events that led to this damage being dealt. This can be the player character, turret, unit, etc. that pulled the trigger. Does not need to be on the same surface as the segmented unit being damaged.
17044
+ * @returns The total damage actually applied after resistances.
17045
+ */
17046
+ damage(this: void, damage: float, force: ForceID, type?: DamageTypeID, source?: LuaEntity, cause?: LuaEntity): float;
17047
+ /**
17048
+ * Destroys the segmented unit.
17049
+ * @param table.raise_destroy If `true`, {@link script_raised_destroy_segmented_unit | runtime:script_raised_destroy_segmented_unit} will be called. Defaults to `false`.
17050
+ */
17051
+ destroy(this: void, table: {
17052
+ raise_destroy?: boolean;
17053
+ }): void;
17054
+ /**
17055
+ * Immediately kills the unit.
17056
+ *
17057
+ * Unlike {@link LuaSegmentedUnit::destroy | runtime:LuaSegmentedUnit::destroy}, `die` will trigger the {@link on_segmented_unit_died | runtime:on_segmented_unit_died} event and the unit's individual segments will produce a corpse and drop loot if they have any, and if the segment entities exist at the moment of death (are not in non-generated chunks or out-of-map tiles).
17058
+ * @param force The force to attribute the kill to. Defaults to the `"neutral"` force.
17059
+ * @param cause The cause to attribute the kill to.
17060
+ * @param damage_type The final damage type that caused the unit to die.
17061
+ */
17062
+ die(this: void, force?: ForceID, cause?: LuaEntity, damage_type?: DamageTypeID): void;
17063
+ /**
17064
+ * Gets the state of the unit's AI.
17065
+ *
17066
+ * This method returns a copy of the internal AI state. Modifying the returned table will not affect the unit's AI.
17067
+ */
17068
+ get_ai_state(this: void): SegmentedUnitAIState;
17069
+ /**
17070
+ * Gets the nodes that define the shape of the unit's body from front to back. Segments are moved along the path these nodes create.
17071
+ *
17072
+ * The returned array will always contain at least 1 position, but will not contain more than {@link LuaSegmentedUnit::max_body_nodes | runtime:LuaSegmentedUnit::max_body_nodes}.
17073
+ *
17074
+ * The returned table is a copy of the unit's actual body nodes.
17075
+ */
17076
+ get_body_nodes(this: void): MapPosition[];
17077
+ /**
17078
+ * Moves the unit forward by a fixed distance according to its natural movement patterns and AI configuration. This movement occurs in addition to the unit's current speed, but affects neither {@link LuaSegmentedUnit::speed | runtime:LuaSegmentedUnit::speed} nor {@link LuaSegmentedUnit::acceleration | runtime:LuaSegmentedUnit::acceleration}.
17079
+ * @param distance The distance in tiles to move the segmented unit forward.
17080
+ */
17081
+ move_forward(this: void, distance: double): void;
17082
+ /**
17083
+ * Sets the segmented unit's AI.
17084
+ * @param state The new AI state. A copy of this table used, so you can read or write to this table after calling this function without being affected by or affecting the unit's AI.
17085
+ */
17086
+ set_ai_state(this: void, state: SegmentedUnitAIState): void;
17087
+ /**
17088
+ * Overwrites the segmented unit's body nodes, which are a series of points that make up the general shape of the unit. Segments are moved along the path these nodes create. For best results, adjacent nodes should be approximately 1.0 tile apart from each other.
17089
+ *
17090
+ * This array must contain at least 1 position. Positions at indexes greater than {@link LuaSegmentedUnit::max_body_nodes | runtime:LuaSegmentedUnit::max_body_nodes} will be ignored.
17091
+ *
17092
+ * Segment entities may be created, destroyed, or moved as a result of setting this field's value. Any segment entities that have a {@link TriggerEffectWithCooldown | prototype:TriggerEffectWithCooldown}s will reduce that effect's distance cooldown. However, any effects that go off cooldown as a result will not trigger until the next game update.
17093
+ * @param nodes The new positions that make up the segmented unit's body nodes. Must not be empty.
17094
+ */
17095
+ set_body_nodes(this: void, nodes: MapPosition[]): void;
17096
+ /**
17097
+ * The rate at which {@link LuaSegmentedUnit::speed | runtime:LuaSegmentedUnit::speed} is changing over time, in tiles per tick per tick.
17098
+ *
17099
+ * This value represents unit's most recent change in speed. If its speed is not changing, the acceleration value will be 0. If it is gaining speed, the value will be positive. If it is losing speed, the value will be negative.
17100
+ */
17101
+ readonly acceleration: double;
17102
+ /**
17103
+ * The current activity mode of the unit. Setting this field can cause the segmented unit to "wake up" or force it into a lower activity mode, but not permanently. Segmented units will generally try to update their activity mode so that they are fully active whenever they are potentially being observed by players, minimally active when relevant to gameplay but not likely observed, and asleep when not relevant to gameplay.
17104
+ *
17105
+ * Will never be lower than {@link LuaSegmentedUnit::minimum_activity_mode | runtime:LuaSegmentedUnit::minimum_activity_mode}.
17106
+ */
17107
+ activity_mode: defines.segmented_unit_activity_mode;
17108
+ /**
17109
+ * The force that the unit belongs to. Changing this also changes the force of all segment entities.
17110
+ *
17111
+ * Always returns a {@link LuaForce | runtime:LuaForce}, but may be assigned to any {@link ForceID | runtime:ForceID} type.
17112
+ */
17113
+ readonly force: LuaForce;
17114
+ /**
17115
+ * The force that the unit belongs to. Changing this also changes the force of all segment entities.
17116
+ *
17117
+ * Always returns a {@link LuaForce | runtime:LuaForce}, but may be assigned to any {@link ForceID | runtime:ForceID} type.
17118
+ * @customName force
17119
+ */
17120
+ force_write: ForceID;
17121
+ /**
17122
+ * The current health of the unit. Health is automatically clamped to be between `0` and {@link LuaSegmentedUnit::max_health | runtime:LuaSegmentedUnit::max_health}.
17123
+ */
17124
+ health: float;
17125
+ /**
17126
+ * The ratio of {@link LuaSegmentedUnit::health | runtime:LuaSegmentedUnit::health} to {@link LuaSegmentedUnit::max_health | runtime:LuaSegmentedUnit::max_health}. Values are clamped between `0` (no health) and `1` (full health) inclusive.
17127
+ */
17128
+ health_ratio: float;
17129
+ /**
17130
+ * The maximum length of {@link LuaSegmentedUnit::get_body_nodes | runtime:LuaSegmentedUnit::get_body_nodes}.
17131
+ */
17132
+ readonly max_body_nodes: uint;
17133
+ /**
17134
+ * The maximum health of the unit.
17135
+ */
17136
+ readonly max_health: float;
17137
+ /**
17138
+ * The lowest-level activity mode that the unit is allowed to be in. Set this field to prevent the segmented unit from falling asleep or entering minimal mode. Set this field to `nil` or {@link asleep | runtime:defines.segmented_unit_activity_mode} to reset this to the default and allow the engine to use whatever activity mode is appropriate.
17139
+ *
17140
+ * Performance note: it is NOT recommended to force many segmented units to be fully active or minimally active simultaneously, as they can significantly impact performance depending on how they are configured. When using this feature, remember to reset this field to allow irrelevant units to go back to sleep.
17141
+ */
17142
+ minimum_activity_mode: defines.segmented_unit_activity_mode;
17143
+ /**
17144
+ * 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.
17145
+ */
17146
+ readonly object_name: string;
17147
+ /**
17148
+ * The prototype of the `segmented-unit` entity that defines the traits and behaviors of the unit.
17149
+ */
17150
+ readonly prototype: LuaEntityPrototype;
17151
+ /**
17152
+ * The segments that compose the unit.
17153
+ */
17154
+ readonly segments: LuaSegment[];
17155
+ /**
17156
+ * The current instantaneous speed in tiles per map tick. Must always be greater than or equal to 0; segmented units are currently incapable of naturally moving in reverse.
17157
+ *
17158
+ * When setting this value, note that unless the unit's AI is similarly overridden by a script, the unit's speed will continuously accelerate or decelerate to match {@link LuaSegmentedUnit::target_speed | runtime:LuaSegmentedUnit::target_speed}.
17159
+ */
17160
+ speed: double;
17161
+ /**
17162
+ * The surface on which the unit is located.
17163
+ */
17164
+ readonly surface: LuaSurface;
17165
+ /**
17166
+ * The speed in tiles per tick that the unit is currently attempting to reach, as determined by its AI. Must always be greater than or equal to 0.
17167
+ */
17168
+ readonly target_speed: double;
17169
+ /**
17170
+ * The territory that the unit is protecting.
17171
+ */
17172
+ territory?: LuaTerritory;
17173
+ /**
17174
+ * A unique number identifying this unit for the lifetime of the save. These are allocated sequentially and not re-used (until overflow). These numbers are allocated from the same pool as {@link LuaEntity::unit_number | runtime:LuaEntity::unit_number}, so segmented unit numbers are unique among all segmented units and all entities with owners.
17175
+ */
17176
+ readonly unit_number: uint64;
17177
+ /**
17178
+ * Is this object valid? This Lua object holds a reference to an object within the game engine. It is possible that the game-engine object is removed whilst a mod still holds the corresponding Lua object. If that happens, the object becomes invalid, i.e. this attribute will be `false`. Mods are advised to check for object validity if any change to the game state might have occurred between the creation of the Lua object and its access.
17179
+ */
17180
+ readonly valid: boolean;
17181
+ }
16727
17182
  /**
16728
17183
  * Control behavior for selector combinators.
16729
17184
  */
@@ -17518,6 +17973,13 @@ interface LuaSurface {
17518
17973
  * Clears all pollution on this surface.
17519
17974
  */
17520
17975
  clear_pollution(this: void): void;
17976
+ /**
17977
+ * Removes the chunk from the territory it is associated with (if any) and allows the map generator to potentially generate a new territory for the chunk in the future. To prevent the game from generating a new territory for the chunk, use {@link LuaSurface::set_chunk_territory | runtime:LuaSurface::set_chunk_territory} to set the chunk's territory to `nil`.
17978
+ *
17979
+ * Territories that do not contain at least one generated chunk as a result of calling this method will be automatically deleted.
17980
+ * @param positions The chunk positions. The chunks at these positions does not need to exist.
17981
+ */
17982
+ clear_territory_for_chunks(this: void, positions: ChunkPosition[]): void;
17521
17983
  /**
17522
17984
  * Clones the given area.
17523
17985
  *
@@ -17690,6 +18152,21 @@ interface LuaSurface {
17690
18152
  vertical_speed: float;
17691
18153
  frame_speed: float;
17692
18154
  }): void;
18155
+ /**
18156
+ * Create a segmented unit on the surface. This differs from creating an entity with type `"segmented-unit"` in that this method can create the entity in non-generated chunks and with any arbitrary body shape and pre-assigned to a territory.
18157
+ * @returns The created segmented unit or `nil` if the creation failed or the unit was destroyed during creation.
18158
+ */
18159
+ create_segmented_unit(this: void, table: LuaSurfaceCreateSegmentedUnitParams): LuaSegmentedUnit | null;
18160
+ /**
18161
+ * Create a territory on the surface.
18162
+ * @param table.chunks The chunks to assign to the new territory. Must contain at least one generated chunk. Any chunks already assigned to existing territories will be removed from those territories. Any territories left with no generated chunks will be deleted from the surface as a result.
18163
+ * @param table.patrol_path The path that patrolling units will follow. If `nil` or empty, one will be generated for the new territory based on `chunks`.
18164
+ * @returns The created territory or `nil` if the creation failed or the territory was destroyed during creation.
18165
+ */
18166
+ create_territory(this: void, table: {
18167
+ chunks: ChunkPosition[];
18168
+ patrol_path?: MapPosition[];
18169
+ }): LuaTerritory | null;
17693
18170
  /**
17694
18171
  * @param table.name The smoke prototype name to create.
17695
18172
  * @param table.position Where to create the smoke.
@@ -18037,10 +18514,23 @@ interface LuaSurface {
18037
18514
  * Gets the script positions that match the given name or if no name is given all positions are returned.
18038
18515
  */
18039
18516
  get_script_positions(this: void, name?: string): ScriptPosition[];
18517
+ /**
18518
+ * Get all segmented units that exist on the surface.
18519
+ */
18520
+ get_segmented_units(this: void): LuaSegmentedUnit[];
18040
18521
  /**
18041
18522
  * Gets the starting area radius of this surface.
18042
18523
  */
18043
18524
  get_starting_area_radius(this: void): double;
18525
+ /**
18526
+ * Get all territories on the surface.
18527
+ */
18528
+ get_territories(this: void): LuaTerritory[];
18529
+ /**
18530
+ * Get the territory that the given chunk is assigned to. If the chunk is not part of any territory or the territory for the chunk has not yet been generated, then this returns `nil`.
18531
+ * @param position The chunk's position. The chunk at this position does not need to exist.
18532
+ */
18533
+ get_territory_for_chunk(this: void, position: ChunkPosition): LuaTerritory | null;
18044
18534
  /**
18045
18535
  * Get the tile at a given position. An alternative call signature for this method is passing it a single {@link TilePosition | runtime:TilePosition}.
18046
18536
  *
@@ -18191,6 +18681,18 @@ interface LuaSurface {
18191
18681
  * @param value The wanted value of the property.
18192
18682
  */
18193
18683
  set_property(this: void, property: SurfacePropertyID, value: double): void;
18684
+ /**
18685
+ * Removes the given chunks from their current territories and adds them to the given territory if provided.
18686
+ *
18687
+ * This does not affect the {@link LuaTerritory::get_patrol_path | runtime:LuaTerritory::get_patrol_path}. It is your responsibility to update the patrol path if needed.
18688
+ *
18689
+ * It's recommended that territory chunks are connected to each other, but this is not required.
18690
+ *
18691
+ * Territories that do not contain at least one generated chunk as a result of calling this method will be automatically deleted.
18692
+ * @param positions The chunk positions. The chunks at these positions do not need to exist in order to be assigned to a territory.
18693
+ * @param territory The territory to associate the chunks with. If not `nil`, the territory must belong to this same surface or else an error will be produced. If `nil`, then the chunks get removed from the territory it is currently associated with and will prevent the map generator from automatically re-generate a new territory for the chunk in the future.
18694
+ */
18695
+ set_territory_for_chunks(this: void, positions: ChunkPosition[], territory?: LuaTerritory): void;
18194
18696
  /**
18195
18697
  * Set tiles at specified locations. Can automatically correct the edges around modified tiles.
18196
18698
  *
@@ -18497,6 +18999,10 @@ interface BaseLuaSurfaceCreateEntityParams {
18497
18999
  * If true; {@link defines.events.script_raised_built | runtime:defines.events.script_raised_built} will be fired on successful entity creation. Defaults to `false`.
18498
19000
  */
18499
19001
  'raise_built'?: boolean;
19002
+ /**
19003
+ * If true, plants created will register in any in-range agricultural towers.
19004
+ */
19005
+ 'register_plant'?: boolean;
18500
19006
  /**
18501
19007
  * If false the exact position given is used to instead of snapping to the normal entity grid. This only applies if the entity normally snaps to the grid.
18502
19008
  */
@@ -18675,7 +19181,7 @@ interface LuaSurfaceCreateEntityParamsHighlightBox extends BaseLuaSurfaceCreateE
18675
19181
  */
18676
19182
  interface LuaSurfaceCreateEntityParamsInserter extends BaseLuaSurfaceCreateEntityParams {
18677
19183
  'conditions': InserterCircuitConditions;
18678
- 'filters'?: InserterItemFilter[];
19184
+ 'filters'?: BlueprintItemFilter[];
18679
19185
  }
18680
19186
  /**
18681
19187
  *
@@ -18724,22 +19230,22 @@ interface LuaSurfaceCreateEntityParamsLamp extends BaseLuaSurfaceCreateEntityPar
18724
19230
  * Applies to variant case `loader`
18725
19231
  */
18726
19232
  interface LuaSurfaceCreateEntityParamsLoader extends BaseLuaSurfaceCreateEntityParams {
18727
- 'filters'?: InventoryFilter[];
19233
+ 'filters'?: SlotFilter[];
18728
19234
  /**
18729
19235
  * Defaults to `"input"`.
18730
19236
  */
18731
- 'type'?: 'output' | 'input';
19237
+ 'type'?: BeltConnectionType;
18732
19238
  }
18733
19239
  /**
18734
19240
  *
18735
19241
  * Applies to variant case `loader-1x1`
18736
19242
  */
18737
19243
  interface LuaSurfaceCreateEntityParamsLoader1x1 extends BaseLuaSurfaceCreateEntityParams {
18738
- 'filters'?: InventoryFilter[];
19244
+ 'filters'?: SlotFilter[];
18739
19245
  /**
18740
19246
  * Defaults to `"input"`.
18741
19247
  */
18742
- 'type'?: 'output' | 'input';
19248
+ 'type'?: BeltConnectionType;
18743
19249
  }
18744
19250
  /**
18745
19251
  *
@@ -18756,7 +19262,7 @@ interface LuaSurfaceCreateEntityParamsLocomotive extends BaseLuaSurfaceCreateEnt
18756
19262
  * Applies to variant case `logistic-container`
18757
19263
  */
18758
19264
  interface LuaSurfaceCreateEntityParamsLogisticContainer extends BaseLuaSurfaceCreateEntityParams {
18759
- 'request_filters'?: InventoryFilter[];
19265
+ 'request_filters'?: SlotFilter[];
18760
19266
  }
18761
19267
  /**
18762
19268
  *
@@ -18915,7 +19421,54 @@ interface LuaSurfaceCreateEntityParamsUndergroundBelt extends BaseLuaSurfaceCrea
18915
19421
  /**
18916
19422
  * Defaults to `"input"`.
18917
19423
  */
18918
- 'type'?: 'output' | 'input';
19424
+ 'type'?: BeltConnectionType;
19425
+ }
19426
+ type LuaSurfaceCreateSegmentedUnitParams = BaseLuaSurfaceCreateSegmentedUnitParams | LuaSurfaceCreateSegmentedUnitParamsBodyNodes | LuaSurfaceCreateSegmentedUnitParamsPositionAndDirection;
19427
+ interface BaseLuaSurfaceCreateSegmentedUnitParams {
19428
+ /**
19429
+ * Force of the segmented unit. Defaults to `enemy`.
19430
+ */
19431
+ 'force'?: ForceID;
19432
+ /**
19433
+ * The segmented-unit prototype name to create. Must be of type `"segmented-unit"`.
19434
+ */
19435
+ 'name': EntityID;
19436
+ /**
19437
+ * Quality of the entity to be created. Defaults to `normal`.
19438
+ */
19439
+ 'quality'?: QualityID;
19440
+ /**
19441
+ * The territory that the segmented unit is assigned to. If `nil`, the segmented unit will patrol around its spawn location. Must be located on this same surface.
19442
+ */
19443
+ 'territory'?: LuaTerritory;
19444
+ }
19445
+ /**
19446
+ *
19447
+ * Applies to variant case `body-nodes`
19448
+ */
19449
+ interface LuaSurfaceCreateSegmentedUnitParamsBodyNodes extends BaseLuaSurfaceCreateSegmentedUnitParams {
19450
+ /**
19451
+ * The body nodes that define the shape of the body. The array must contain at least one value and should have no more than {@link SegmentEngineSpecification::max_body_nodes | prototype:SegmentEngineSpecification::max_body_nodes}. The nodes should be about 1 tile apart from each other, but it is not strictly required.
19452
+ */
19453
+ 'body_nodes': MapPosition[];
19454
+ }
19455
+ /**
19456
+ *
19457
+ * Applies to variant case `position-and-direction`
19458
+ */
19459
+ interface LuaSurfaceCreateSegmentedUnitParamsPositionAndDirection extends BaseLuaSurfaceCreateSegmentedUnitParams {
19460
+ /**
19461
+ * The initial orientation of the head. Defaults to `defines.direction.north`.
19462
+ */
19463
+ 'direction'?: defines.direction;
19464
+ /**
19465
+ * If `true`, will create the segmented unit so that the entire body is stretches in a straight line behind the head. If `false`, then only the head segment will be created and the remainder of the body segments will be created over time as the head moves forward. Defaults to `false`.
19466
+ */
19467
+ 'extended'?: boolean;
19468
+ /**
19469
+ * The head position.
19470
+ */
19471
+ 'position': MapPosition;
18919
19472
  }
18920
19473
  /**
18921
19474
  * Prototype of a surface property.
@@ -19125,6 +19678,72 @@ interface LuaTechnologyPrototype extends LuaPrototypeBase {
19125
19678
  */
19126
19679
  readonly visible_when_disabled: boolean;
19127
19680
  }
19681
+ /**
19682
+ * A set of chunks on a single {@link LuaSurface | runtime:LuaSurface} that can be guarded by one or more {@link LuaSegmentedUnit | runtime:LuaSegmentedUnit}s.
19683
+ *
19684
+ * A territory is owned by the surface for which it was created. It comprises any number of disconnected or connected chunks. A chunk can only be owned by at most one territory. A territory's chunks may or may not be generated.
19685
+ *
19686
+ * Territories may be patrolled by any number of {@link LuaSegmentedUnit | runtime:LuaSegmentedUnit}s. A territory with no units will not appear on player's maps.
19687
+ *
19688
+ * Territories may define a patrol path that {@link LuaSegmentedUnit | runtime:LuaSegmentedUnit}s will follow. If no such path is defined, then units will wander randomly throughout the territory chunks. If a territory contains no patrol path and no chunks, then units will behave as if they are assigned to any territory.
19689
+ *
19690
+ * The game will automatically destroy any territory that does not have at least one chunk that is generated or requested to be generated. This is to prevent bloat when chunks are deleted. This can happen as a result of any operation that modifies a territory's chunks, including but not limited to {@link LuaSurface::delete_chunk | runtime:LuaSurface::delete_chunk}, {@link LuaSurface::set_territory_for_chunks | runtime:LuaSurface::set_territory_for_chunks}, and {@link LuaSurface::clear_territory_for_chunks | runtime:LuaSurface::clear_territory_for_chunks}.
19691
+ */
19692
+ interface LuaTerritory {
19693
+ /**
19694
+ * Immediately destroys the territory, along with any segmented units guarding it. All associated chunks are cleared from the territory system, allowing the map generator to potentially generate new territories for these chunks in the future.
19695
+ *
19696
+ * This {@link LuaTerritory | runtime:LuaTerritory} is no longer valid after calling this.
19697
+ */
19698
+ destroy(this: void): void;
19699
+ /**
19700
+ * Gets all chunks that are a part of the territory.
19701
+ *
19702
+ * Chunks may or may not be generated; use {@link LuaSurface::is_chunk_generated | runtime:LuaSurface::is_chunk_generated} to check a chunk's state before accessing it.
19703
+ */
19704
+ get_chunks(this: void): ChunkPositionAndArea[];
19705
+ /**
19706
+ * Get the path that the territory's units follow when patrolling the territory. Will not be empty.
19707
+ *
19708
+ * It is common that the territory's patrol path is fully contained within the territory's chunks, but it is not strictly necessary.
19709
+ */
19710
+ get_patrol_path(this: void): MapPosition[];
19711
+ /**
19712
+ * Gets the {@link LuaSegmentedUnit | runtime:LuaSegmentedUnit}s that guard this territory.
19713
+ */
19714
+ get_segmented_units(this: void): LuaSegmentedUnit[];
19715
+ /**
19716
+ * Regenerates the patrol path for the territory according to the game's default territory generation algorithm and overwrites the territory's current patrol path.
19717
+ */
19718
+ regenerate_patrol_path(this: void): void;
19719
+ /**
19720
+ * Regenerates any segmented units that were created when the territory was generated by the map generator. If the territory was created or modified by a script, and the surface's map generator is configured to create segmented units with territories, then this function will create the segmented units that would have been created along with the script-modified or script-created territory. If the surface's map generator is not configured to create segmented units at all, then no segmented units will be created.
19721
+ *
19722
+ * Note: this does not destroy or replace existing units guarding the territory, and existing units will not prevent the generation of new units. Calling this repeatedly on a territory that generates a segmented unit will simply repeatedly add new segmented units to the map, all guarding this territory.
19723
+ */
19724
+ regenerate_segmented_units(this: void): void;
19725
+ /**
19726
+ * Overwrite the territory patrol path for units that guard the territory.
19727
+ *
19728
+ * It is recommended that the territory's patrol path be fully contained within the territory's chunks, but it is not strictly necessary.
19729
+ *
19730
+ * To let the territory system generate a patrol path, use {@link LuaTerritory::regenerate_patrol_path | runtime:LuaTerritory::regenerate_patrol_path}.
19731
+ * @param patrol_path The new patrol path for the territory. Must not be empty.
19732
+ */
19733
+ set_patrol_path(this: void, patrol_path: MapPosition[]): void;
19734
+ /**
19735
+ * 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.
19736
+ */
19737
+ readonly object_name: string;
19738
+ /**
19739
+ * The surface on which this territory is located.
19740
+ */
19741
+ readonly surface: LuaSurface;
19742
+ /**
19743
+ * Is this object valid? This Lua object holds a reference to an object within the game engine. It is possible that the game-engine object is removed whilst a mod still holds the corresponding Lua object. If that happens, the object becomes invalid, i.e. this attribute will be `false`. Mods are advised to check for object validity if any change to the game state might have occurred between the creation of the Lua object and its access.
19744
+ */
19745
+ readonly valid: boolean;
19746
+ }
19128
19747
  /**
19129
19748
  * A single "square" on the map.
19130
19749
  */
@@ -19255,7 +19874,7 @@ interface LuaTilePrototype extends LuaPrototypeBase {
19255
19874
  /**
19256
19875
  * Items that when placed will produce this tile, if any. Construction bots will choose the first item in the list to build this tile.
19257
19876
  */
19258
- readonly items_to_place_this?: ItemWithCount[];
19877
+ readonly items_to_place_this?: ItemToPlace[];
19259
19878
  readonly layer: uint;
19260
19879
  readonly map_color: Color;
19261
19880
  readonly max_health: float;
@@ -19316,7 +19935,7 @@ interface LuaTrain {
19316
19935
  * Get a mapping of the train's inventory.
19317
19936
  * @returns List of all items in the train.
19318
19937
  */
19319
- get_contents(this: void): ItemWithQualityCounts[];
19938
+ get_contents(this: void): ItemWithQualityCounts;
19320
19939
  /**
19321
19940
  * Gets a mapping of the train's fluid inventory.
19322
19941
  * @returns The counts, indexed by fluid names.
@@ -19667,7 +20286,7 @@ interface LuaTransportLine {
19667
20286
  * Get counts of all items on this line, similar to how {@link LuaInventory::get_contents | runtime:LuaInventory::get_contents} does.
19668
20287
  * @returns List of all items on this line.
19669
20288
  */
19670
- get_contents(this: void): ItemWithQualityCounts[];
20289
+ get_contents(this: void): ItemWithQualityCounts;
19671
20290
  /**
19672
20291
  * Get detailed information of items on this line, such as their position.
19673
20292
  */