Factorio.com|Forums|Wiki|Mod Portal|API Docs

# Factorio Runtime Docs Version 2.0.77

# LuaLogisticNetwork - Runtime Docs

## Class LuaLogisticNetwork

A single logistic network of a given force on a given surface.

## Members

get_item_count(item?, member?) | → int32 | Count given or all items in the network or given members.
Count given or all items in the network or given members.
get_contents(member?) | → array[ItemWithQualityCount] | Get item counts for the entire network, similar to how LuaInventory::get_contents does.
Get item counts for the entire network, similar to how LuaInventory::get_contents does.
remove_item(item, members?) | → uint32 | Remove items from the logistic network. [...]
Remove items from the logistic network. [...]
insert(item, members?) | → uint32 | Insert items into the logistic network. [...]
Insert items into the logistic network. [...]
find_cell_closest_to(position) | → LuaLogisticCell? | Find logistic cell closest to a given position.
Find logistic cell closest to a given position.
select_pickup_point{name=…, position?=…, include_buffers?=…, members?=…} | → LuaLogisticPoint? | Find the 'best' logistic point with this item ID and from the given position or from given chest type.
Find the 'best' logistic point with this item ID and from the given position or from given chest type.
select_drop_point{stack=…, members?=…} | → LuaLogisticPoint? | Find a logistic point to drop the specific item stack.
Find a logistic point to drop the specific item stack.
can_satisfy_request(item, count?, include_buffers?) | → boolean | Can the network satisfy a request for a given item and count.
Can the network satisfy a request for a given item and count.
get_supply_counts(item) | → LogisticsNetworkSupplyCounts | Get the amount of items of the given type indexed by the storage member.
Get the amount of items of the given type indexed by the storage member.
get_supply_points(item) | → LogisticsNetworkSupplyPoints | Gets the logistic points with of the given type indexed by the storage member.
Gets the logistic points with of the given type indexed by the storage member.
network_id | :: R uint32 | The unique logistic network ID.
The unique logistic network ID.
custom_name | :: RW string? | The custom logistic network name set by the player or by script, if any.
The custom logistic network name set by the player or by script, if any.
force | :: R LuaForce | The force this logistic network belongs to.
The force this logistic network belongs to.
available_logistic_robots | :: R uint32 | Number of logistic robots available for a job.
Number of logistic robots available for a job.
all_logistic_robots | :: R uint32 | The total number of logistic robots in the network (idle and active + in roboports).
The total number of logistic robots in the network (idle and active + in roboports).
available_construction_robots | :: R uint32 | Number of construction robots available for a job.
Number of construction robots available for a job.
all_construction_robots | :: R uint32 | The total number of construction robots in the network (idle and active + in roboports).
The total number of construction robots in the network (idle and active + in roboports).
robot_limit | :: R uint32 | Maximum number of robots the network can work with. [...]
Maximum number of robots the network can work with. [...]
cells | :: R array[LuaLogisticCell] | All cells in this network.
All cells in this network.
providers | :: R array[LuaEntity] | All entities that have logistic provider points in this network.
All entities that have logistic provider points in this network.
empty_providers | :: R array[LuaEntity] | All entities that have empty logistic provider points in this network.
All entities that have empty logistic provider points in this network.
requesters | :: R array[LuaEntity] | All entities that have logistic requester points in this network.
All entities that have logistic requester points in this network.
storages | :: R array[LuaEntity] | All entities that have logistic storage points in this network.
All entities that have logistic storage points in this network.
logistic_members | :: R array[LuaEntity] | All other entities that have logistic points in this network (inserters mostly).
All other entities that have logistic points in this network (inserters mostly).
provider_points | :: R array[LuaLogisticPoint] | All things that have provider points in this network.
All things that have provider points in this network.
passive_provider_points | :: R array[LuaLogisticPoint] | All passive provider points in this network.
All passive provider points in this network.
active_provider_points | :: R array[LuaLogisticPoint] | All active provider points in this network.
All active provider points in this network.
empty_provider_points | :: R array[LuaLogisticPoint] | All things that have empty provider points in this network.
All things that have empty provider points in this network.
requester_points | :: R array[LuaLogisticPoint] | All things that have requester points in this network.
All things that have requester points in this network.
storage_points | :: R array[LuaLogisticPoint] | All things that have storage points in this network.
All things that have storage points in this network.
robots | :: R array[LuaEntity] | All currently deployed robots in this logistic network.
All currently deployed robots in this logistic network.
construction_robots | :: R array[LuaEntity] | All currently deployed construction robots in this logistic network.
All currently deployed construction robots in this logistic network.
logistic_robots | :: R array[LuaEntity] | All currently deployed logistic robots in this logistic network.
All currently deployed logistic robots in this logistic network.
valid | :: R boolean | Is this object valid? [...]
Is this object valid? [...]
object_name | :: R string | The class name of this object. [...]
The class name of this object. [...]

## Methods

### get_item_count(item?, member?) → int32

Count given or all items in the network or given members.

#### Parameters

item | :: ItemWithQualityID? | Item name to count. If not given, gives counts of all items in the network.
Item name to count. If not given, gives counts of all items in the network.
member | :: `"storage"` or `"providers"`? | Logistic members to check. If not given, gives count in the entire network.
Logistic members to check. If not given, gives count in the entire network.

### get_contents(member?) → array[ItemWithQualityCount]

Get item counts for the entire network, similar to how LuaInventory::get_contents does.

#### Parameters

member | :: `"storage"` or `"providers"`? | Logistic members to check. If not given, gives item counts for the entire network.
Logistic members to check. If not given, gives item counts for the entire network.

#### Return values

→ array[ItemWithQualityCount] | List of all items in the network.

### remove_item(item, members?) → uint32

Remove items from the logistic network. This will actually remove the items from some logistic chests.

#### Parameters

item | :: ItemStackIdentification | What to remove.
What to remove.
members | :: `"active-provider"` or `"passive-provider"` or `"buffer"` or `"storage"`? | Which logistic members to remove from. If not specified, removes from the network in the usual order.
Which logistic members to remove from. If not specified, removes from the network in the usual order.

#### Return values

→ uint32 | Number of items removed.

### insert(item, members?) → uint32

Insert items into the logistic network. This will actually insert the items into some logistic chests.

#### Parameters

item | :: ItemStackIdentification | What to insert.
What to insert.
members | :: `"storage"` or `"storage-empty"` or `"storage-empty-slot"` or `"requester"`? | Which logistic members to insert the items to. `"storage-empty"` inserts into storage chests that are completely empty, `"storage-empty-slot"` inserts into storage chests that have an empty slot. If not specified, inserts items into the logistic network in the usual order.
Which logistic members to insert the items to. `"storage-empty"` inserts into storage chests that are completely empty, `"storage-empty-slot"` inserts into storage chests that have an empty slot. If not specified, inserts items into the logistic network in the usual order.

#### Return values

→ uint32 | Number of items actually inserted.

### find_cell_closest_to(position) → LuaLogisticCell?

Find logistic cell closest to a given position.

#### Parameters

position | :: MapPosition |

#### Return values

→ LuaLogisticCell? | `nil` if no cell was found.

### select_pickup_point{name=…, position?=…, include_buffers?=…, members?=…} → LuaLogisticPoint?

Find the 'best' logistic point with this item ID and from the given position or from given chest type.

#### Parameters

Table with the following fields:

name | :: ItemWithQualityID | Name of the item to pick up.
Name of the item to pick up.
position | :: MapPosition? | When given, it will find the storage 'best' storage point from this position.
When given, it will find the storage 'best' storage point from this position.
include_buffers | :: boolean? | Whether to consider buffer chests or not. Defaults to false. Only considered if selecting with position.
Whether to consider buffer chests or not. Defaults to false. Only considered if selecting with position.
members | :: `"active-provider"` or `"passive-provider"` or `"buffer"` or `"storage"`? | When given, it will find from only the specific type of member. If not specified, selects with normal priorities. Not considered if position is specified.
When given, it will find from only the specific type of member. If not specified, selects with normal priorities. Not considered if position is specified.

#### Return values

→ LuaLogisticPoint? | `nil` if no point was found.

### select_drop_point{stack=…, members?=…} → LuaLogisticPoint?

Find a logistic point to drop the specific item stack.

#### Parameters

Table with the following fields:

stack | :: ItemStackIdentification | Name of the item to drop off.
Name of the item to drop off.
members | :: `"storage"` or `"storage-empty"` or `"storage-empty-slot"` or `"requester"`? | When given, it will find from only the specific type of member. If not specified, selects with normal priorities.
When given, it will find from only the specific type of member. If not specified, selects with normal priorities.

#### Return values

→ LuaLogisticPoint? | `nil` if no point was found.

### can_satisfy_request(item, count?, include_buffers?) → boolean

Can the network satisfy a request for a given item and count.

#### Parameters

item | :: ItemWithQualityID | Item name to check.
Item name to check.
count | :: uint32? | Count to check. Defaults to 1.
Count to check. Defaults to 1.
include_buffers | :: boolean? | Should buffers be considered? Defaults to false.
Should buffers be considered? Defaults to false.

#### Return values

→ boolean | Whether the network can satisfy the request.

### get_supply_counts(item) → LogisticsNetworkSupplyCounts

Get the amount of items of the given type indexed by the storage member.

#### Parameters

item | :: ItemWithQualityID | Item name to check.
Item name to check.

### get_supply_points(item) → LogisticsNetworkSupplyPoints

Gets the logistic points with of the given type indexed by the storage member.

#### Parameters

item | :: ItemWithQualityID | Item name to check.
Item name to check.

## Attributes

### network_id :: Read uint32

The unique logistic network ID.

### custom_name :: Read|Write string?

The custom logistic network name set by the player or by script, if any.

### force :: Read LuaForce

The force this logistic network belongs to.

### available_logistic_robots :: Read uint32

Number of logistic robots available for a job.

### all_logistic_robots :: Read uint32

The total number of logistic robots in the network (idle and active + in roboports).

### available_construction_robots :: Read uint32

Number of construction robots available for a job.

### all_construction_robots :: Read uint32

The total number of construction robots in the network (idle and active + in roboports).

### robot_limit :: Read uint32

Maximum number of robots the network can work with. Currently only used for the personal roboport.

### cells :: Read array[LuaLogisticCell]

All cells in this network.

### providers :: Read array[LuaEntity]

All entities that have logistic provider points in this network.

### empty_providers :: Read array[LuaEntity]

All entities that have empty logistic provider points in this network.

### requesters :: Read array[LuaEntity]

All entities that have logistic requester points in this network.

### storages :: Read array[LuaEntity]

All entities that have logistic storage points in this network.

### logistic_members :: Read array[LuaEntity]

All other entities that have logistic points in this network (inserters mostly).

### provider_points :: Read array[LuaLogisticPoint]

All things that have provider points in this network.

### passive_provider_points :: Read array[LuaLogisticPoint]

All passive provider points in this network.

### active_provider_points :: Read array[LuaLogisticPoint]

All active provider points in this network.

### empty_provider_points :: Read array[LuaLogisticPoint]

All things that have empty provider points in this network.

### requester_points :: Read array[LuaLogisticPoint]

All things that have requester points in this network.

### storage_points :: Read array[LuaLogisticPoint]

All things that have storage points in this network.

### robots :: Read array[LuaEntity]

All currently deployed robots in this logistic network.

### construction_robots :: Read array[LuaEntity]

All currently deployed construction robots in this logistic network.

### logistic_robots :: Read array[LuaEntity]

All currently deployed logistic robots in this logistic network.

### valid :: Read boolean

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.

### object_name :: Read string

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.

Class used in

- LuaControl::opened
- LuaEntity::logistic_network
- LuaForce::find_logistic_network_by_position()
- LuaForce::logistic_networks
- LuaLogisticCell::logistic_network
- LuaLogisticPoint::logistic_network
- LuaSurface::find_logistic_network_by_position()
- LuaSurface::find_closest_logistic_network_by_position()
- LuaSurface::find_logistic_networks_by_construction_area()
- RegistrationTarget