LuaLogisticNetwork

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

class LuaLogisticNetwork - sort
get_item_count(item, member) → int Count given or all items in the network or given members.
get_contents() → dictionary[stringuint] Get item counts for the entire network.
remove_item(item, members) → uint Remove items from the logistic network.
insert(item, members) → uint Insert items into the logistic network.
find_cell_closest_to(position) → LuaLogisticCell 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.
select_drop_point{stack = …, members = …} → LuaLogisticPoint Find a logistic point to drop the specific item stack.
force :: LuaForce [R] The force this logistic network belongs to.
available_logistic_robots :: uint [R] Number of logistic robots available for a job.
all_logistic_robots :: uint [R] The total number of logistic robots in the network (idle and active + in roboports).
available_construction_robots :: uint [R] Number of construction robots available for a job.
all_construction_robots :: uint [R] The total number of construction robots in the network (idle and active + in roboports).
robot_limit :: uint [R] Maximum number of robots the network can work with.
cells :: array[LuaLogisticCell] [R] All cells in this network.
providers :: array[LuaEntity] [R] All entities that have logistic provider points in this network.
empty_providers :: array[LuaEntity] [R] All entities that have empty logistic provider points in this network.
requesters :: array[LuaEntity] [R] All entities that have logistic requester points in this network.
storages :: array[LuaEntity] [R] All entities that have logistic storage points in this network.
logistic_members :: array[LuaEntity] [R] All other entities that have logistic points in this network (inserters mostly).
provider_points :: array[LuaLogisticPoint] [R] All things that have provider points in this network.
passive_provider_points :: array[LuaLogisticPoint] [R] All passive provider points in this network.
active_provider_points :: array[LuaLogisticPoint] [R] All active provider points in this network.
empty_provider_points :: array[LuaLogisticPoint] [R] All things that have empty provider points in this network.
requester_points :: array[LuaLogisticPoint] [R] All things that have requester points in this network.
storage_points :: array[LuaLogisticPoint] [R] All things that have storage points in this network.
robots :: array[LuaEntity] [R] All robots in this logistic network.
construction_robots :: array[LuaEntity] [R] All construction robots in this logistic network.
logistic_robots :: array[LuaEntity] [R] All logistic robots in this logistic network.
valid :: boolean [R] Is this object valid?
object_name :: string [R] The class name of this object.
help() → string All methods and properties that this object supports.
get_item_count(item, member) → int

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

Parameters
item :: string (optional): Item name to count. If not given, gives counts of all items in the network.
member :: string (optional): Logistic members to check, must be either "storage" or "providers". If not given, gives count in the entire network.
get_contents() → dictionary[stringuint]

Get item counts for the entire network.

Return value
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.
members :: string (optional): 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 value
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.
members :: string (optional): 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 value
Number of items actually inserted.
find_cell_closest_to(position) → LuaLogisticCell

Find logistic cell closest to a given position.

Parameters
position :: Position
Return value
May be 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.
  • position :: Position (optional): When given, it will find the storage 'best' storage point from this position.
  • include_buffers :: boolean (optional): Whether to consider buffer chests or not. Defaults to false. Only considered if selecting with position.
  • members :: string (optional): 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 value
May be 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.
  • members :: string (optional): 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 value
May be nil if no point was found.
force :: LuaForce [Read-only]

The force this logistic network belongs to.

available_logistic_robots :: uint [Read-only]

Number of logistic robots available for a job.

all_logistic_robots :: uint [Read-only]

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

available_construction_robots :: uint [Read-only]

Number of construction robots available for a job.

all_construction_robots :: uint [Read-only]

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

robot_limit :: uint [Read-only]

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

cells :: array[LuaLogisticCell] [Read-only]

All cells in this network.

providers :: array[LuaEntity] [Read-only]

All entities that have logistic provider points in this network.

empty_providers :: array[LuaEntity] [Read-only]

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

requesters :: array[LuaEntity] [Read-only]

All entities that have logistic requester points in this network.

storages :: array[LuaEntity] [Read-only]

All entities that have logistic storage points in this network.

logistic_members :: array[LuaEntity] [Read-only]

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

provider_points :: array[LuaLogisticPoint] [Read-only]

All things that have provider points in this network.

passive_provider_points :: array[LuaLogisticPoint] [Read-only]

All passive provider points in this network.

active_provider_points :: array[LuaLogisticPoint] [Read-only]

All active provider points in this network.

empty_provider_points :: array[LuaLogisticPoint] [Read-only]

All things that have empty provider points in this network.

requester_points :: array[LuaLogisticPoint] [Read-only]

All things that have requester points in this network.

storage_points :: array[LuaLogisticPoint] [Read-only]

All things that have storage points in this network.

robots :: array[LuaEntity] [Read-only]

All robots in this logistic network.

construction_robots :: array[LuaEntity] [Read-only]

All construction robots in this logistic network.

logistic_robots :: array[LuaEntity] [Read-only]

All logistic robots in this logistic network.