Factorio Runtime Docs

Class LuaLogisticNetwork

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

Members

get_item_count(item?, member?)  → int

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

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

get_contents()  → dictionary[string → uint]

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?)  → uint

Remove items from the logistic network.

Remove items from the logistic network.

insert(item, members?)  → uint

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)  → dictionary[string → uint]

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)  → dictionary[string → array[LuaLogisticPoint]]

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.

help()  → string

All methods and properties that this object supports.

All methods and properties that this object supports.

force [R] :: LuaForce

The force this logistic network belongs to.

The force this logistic network belongs to.

available_logistic_robots [R] :: uint

Number of logistic robots available for a job.

Number of logistic robots available for a job.

all_logistic_robots [R] :: uint

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] :: uint

Number of construction robots available for a job.

Number of construction robots available for a job.

all_construction_robots [R] :: uint

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] :: uint

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 robots in this logistic network.

All robots in this logistic network.

construction_robots [R] :: array[LuaEntity]

All construction robots in this logistic network.

All construction robots in this logistic network.

logistic_robots [R] :: array[LuaEntity]

All logistic robots in this logistic network.

All 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?)  → int

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

Parameters

item :: string?

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 :: string?

Logistic members to check, must be either "storage" or "providers". If not given, gives count in the entire network.

Logistic members to check, must be either "storage" or "providers". If not given, gives count in the entire network.


get_contents()  → dictionary[string → uint]

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

Return values

→ dictionary[string → uint]

A mapping of item prototype names to the number available in the network.


remove_item(item, members?)  → uint

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 :: string?

Which logistic members to remove from. Must be "storage", "passive-provider", "buffer", or "active-provider". If not specified, removes from the network in the usual order.

Which logistic members to remove from. Must be "storage", "passive-provider", "buffer", or "active-provider". If not specified, removes from the network in the usual order.

Return values

→ uint

Number of items removed.


insert(item, members?)  → uint

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 :: string?

Which logistic members to insert the items to. Must be "storage", "storage-empty" (storage chests that are completely empty), "storage-empty-slot" (storage chests that have an empty slot), or "requester". If not specified, inserts items into the logistic network in the usual order.

Which logistic members to insert the items to. Must be "storage", "storage-empty" (storage chests that are completely empty), "storage-empty-slot" (storage chests that have an empty slot), or "requester". If not specified, inserts items into the logistic network in the usual order.

Return values

→ uint

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 :: string

Name of the item to select.

Name of the item to select.

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 :: string?

When given, it will find from only the specific type of member. Must be "storage", "passive-provider", "buffer" or "active-provider". 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. Must be "storage", "passive-provider", "buffer" or "active-provider". 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 select.

Name of the item to select.

members :: string?

When given, it will find from only the specific type of member. Must be "storage", "storage-empty", "storage-empty-slot" or "requester". If not specified, selects with normal priorities.

When given, it will find from only the specific type of member. Must be "storage", "storage-empty", "storage-empty-slot" or "requester". 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 :: string

Item name to check.

Item name to check.

count :: uint?

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)  → dictionary[string → uint]

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

Parameters

item :: string

Item name to check.

Item name to check.

Return values

→ dictionary[string → uint]

A mapping of member types ("storage", "passive-provider", "buffer", "active-provider") to the number available in the members.


get_supply_points(item)  → dictionary[string → array[LuaLogisticPoint]]

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

Parameters

item :: string

Item name to check.

Item name to check.

Return values

→ dictionary[string → array[LuaLogisticPoint]]

A mapping of member types ("storage", "passive-provider", "buffer", "active-provider") to an array of LuaLogisticPoint.


help()  → string

All methods and properties that this object supports.

Attributes

force :: LuaForce Read

The force this logistic network belongs to.


available_logistic_robots :: uint Read

Number of logistic robots available for a job.


all_logistic_robots :: uint Read

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


available_construction_robots :: uint Read

Number of construction robots available for a job.


all_construction_robots :: uint Read

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


robot_limit :: uint Read

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


cells :: array[LuaLogisticCell] Read

All cells in this network.


providers :: array[LuaEntity] Read

All entities that have logistic provider points in this network.


empty_providers :: array[LuaEntity] Read

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


requesters :: array[LuaEntity] Read

All entities that have logistic requester points in this network.


storages :: array[LuaEntity] Read

All entities that have logistic storage points in this network.


logistic_members :: array[LuaEntity] Read

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


provider_points :: array[LuaLogisticPoint] Read

All things that have provider points in this network.


passive_provider_points :: array[LuaLogisticPoint] Read

All passive provider points in this network.


active_provider_points :: array[LuaLogisticPoint] Read

All active provider points in this network.


empty_provider_points :: array[LuaLogisticPoint] Read

All things that have empty provider points in this network.


requester_points :: array[LuaLogisticPoint] Read

All things that have requester points in this network.


storage_points :: array[LuaLogisticPoint] Read

All things that have storage points in this network.


robots :: array[LuaEntity] Read

All robots in this logistic network.


construction_robots :: array[LuaEntity] Read

All construction robots in this logistic network.


logistic_robots :: array[LuaEntity] Read

All logistic robots in this logistic network.


valid :: boolean Read

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 :: string Read

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.

Classes

Events

Concepts

Defines

Builtin types

>|