Some issues/requests for the logistic network interface

Post Reply
Outsider
Fast Inserter
Fast Inserter
Posts: 115
Joined: Sat Jan 10, 2015 12:23 am
Contact:

Some issues/requests for the logistic network interface

Post by Outsider »

First of all thanks for the awesome interface! there's alot of potential for cool things with the new logistic network/cell interface, unfortunately i ran into some issues and things that imho could be improved.

Issues :

The first issue i have encountered so far is that it seems to be counting the player inventory as logistic provider, so far i have found it being counted among the "empty_providers, requesters" list of a logistic network, i'm not sure if this is intended or not, but for now i am getting around it by checking the entity type and making sure it's a "logistics-container".

The second issue is that entities don't seem have a "logistic_network, logistic_cell" assigned to them, is this value only specific to roboports? it only seems to work with them.

Methods :

Lua/LogisticNetwork -> get_item_count

This method takes a logistic member set as one of it's parameters, but this is only limited to ""storage" and "providers" can this be expanded to look more like "storage, active-provider, passive-provider, requester" that way we can filter it based on each available logistic-container type.

Lua/LogisticNetwork -> get_contents
This function doesn't take any parameters right now, which is the way all inventor get_contents functions are, but it'd be great if it can also be filtered using logistic member set, same as the get_item_count function above.
Advanced Logistics System - Provides a detailed view of your logistics network and the items within it

User avatar
DaCyclops
Long Handed Inserter
Long Handed Inserter
Posts: 85
Joined: Mon Aug 25, 2014 12:37 am
Contact:

Re: Some issues/requests for the logistic network interface

Post by DaCyclops »

LuaLogisticNetwork.get_contents is basically a huge dump of the ENTIRE network, so its basically acting like the entire network is a giant chest. That being said it might be use to add in a switch for "in providers and storage", "in storage only" or "in providers only". So its possible to check if the Storage has items before the Providers (similar to how Logistics Robots will take from a Storage before a Provider.)




I don't believe entities have a "logistic_network" or "logistic_cell" unless they interact with a network or provide a cell. Which basically limits it to stuff like Logistic Chests, Roboports, players (see below) and the such. If you are trying to find the network for other entitys, both LuaForce and LuaSurface define a find_logistic_network_by_position method, which takes a posistion and either a Surface (for LuaForce) or Force (for LuaSurface) to find if the provided posistion is in Logistics Network coverage. And you could always chain LuaLogisticNetwork.find_cell_closest_to method to find the exact closest cell.
If your passing an entity as ent, you can run simple command of the following should return the covering Logistics Network or Nil.

Code: Select all

logisticsNetwork = ent.force.find_logistic_network_by_posistion(ent.posistion, ent.surface)
As for the player... He does count as a logistics point. Its how all the player logistics upgrades work. If you mouse over the roboport your under, Your player will be outlined. (If you want a funny view, on a latency-hiding multiplayer server, do it and move around. The outline will lag behind your movement :P)
I am betting if you had items in the players Logistic Trash slots he wouldnt appear counted in the empty_providers but rather the providers (as an active provider, if it shows the difference). Same if the player has all his requested items or a full inventory, he should appear in full_or_satisfied_requesters as well.

LuaLogisticNetwork.get_item_count is specifically asking for Logistic Network Accessible Items. So having it see requesters would not make sense, as a requesters storage is NOT part of the network. I believe this method is designed so you can remove "requested but not picked up" items compared to a normal get_item_count.

Outsider
Fast Inserter
Fast Inserter
Posts: 115
Joined: Sat Jan 10, 2015 12:23 am
Contact:

Re: Some issues/requests for the logistic network interface

Post by Outsider »

DaCyclops wrote:LuaLogisticNetwork.get_contents is basically a huge dump of the ENTIRE network, so its basically acting like the entire network is a giant chest. That being said it might be use to add in a switch for "in providers and storage", "in storage only" or "in providers only". So its possible to check if the Storage has items before the Providers (similar to how Logistics Robots will take from a Storage before a Provider.)
yes it'd be great if we can get filtering options on that function, i am more interested in filtering based on the containers type for my purposes tho :)

DaCyclops wrote:I don't believe entities have a "logistic_network" or "logistic_cell" unless they interact with a network or provide a cell. Which basically limits it to stuff like Logistic Chests, Roboports, players (see below) and the such. If you are trying to find the network for other entitys, both LuaForce and LuaSurface define a find_logistic_network_by_position method, which takes a posistion and either a Surface (for LuaForce) or Force (for LuaSurface) to find if the provided posistion is in Logistics Network coverage. And you could always chain LuaLogisticNetwork.find_cell_closest_to method to find the exact closest cell.
If your passing an entity as ent, you can run simple command of the following should return the covering Logistics Network or Nil.

Code: Select all

logisticsNetwork = ent.force.find_logistic_network_by_posistion(ent.posistion, ent.surface)
i'm aware of these functions and already use them in my code to check if an entity is within a logistic network, was just pointing out that the "logistic_network" and "logistic_cell" seem to be only working for "Roboports" i tested it on several other entities and none of them have these values assigned including "logistic containers", which isn't a big deal really.. also it does make sense that only "Roboports" would have a "logistic_cell", it'd be nice tho to have the "logistic_network" value assigned to all the other entites, since it's probably slightly faster than a function call.

EDIT : this seem to have been fixed/adjusted in 0.12.7 -- The LuaEntity::logistic_network now returns also primary logistic network of other entities than roboport. (Inserter, Character, logistic chests)
DaCyclops wrote:As for the player... He does count as a logistics point. Its how all the player logistics upgrades work. If you mouse over the roboport your under, Your player will be outlined. (If you want a funny view, on a latency-hiding multiplayer server, do it and move around. The outline will lag behind your movement :P)
I am betting if you had items in the players Logistic Trash slots he wouldnt appear counted in the empty_providers but rather the providers (as an active provider, if it shows the difference). Same if the player has all his requested items or a full inventory, he should appear in full_or_satisfied_requesters as well.
internally this is true, but personally i think there is no reason to include the player "logistic enabled" inventory in the list of providers in the api, we already have access to it in other places, and this would only probably confuse people.
DaCyclops wrote:LuaLogisticNetwork.get_item_count is specifically asking for Logistic Network Accessible Items. So having it see requesters would not make sense, as a requesters storage is NOT part of the network. I believe this method is designed so you can remove "requested but not picked up" items compared to a normal get_item_count.
requesters are still part of the logistic network and they hold items, so i don't see why they wouldn't be included as a filter here, again i'm looking at this in terms of the code i am writing so it might not make sense to you right away, and including it wouldn't cause any issues but rather offer more flexibility to the Api.
Advanced Logistics System - Provides a detailed view of your logistics network and the items within it

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Some issues/requests for the logistic network interface

Post by Rseding91 »

Outsider wrote:yes it'd be great if we can get filtering options on that function, i am more interested in filtering based on the containers type for my purposes tho :)
I'll see about adding the functionality to the get_contents method. It shouldn't take much.
Outsider wrote:internally this is true, but personally i think there is no reason to include the player "logistic enabled" inventory in the list of providers in the api, we already have access to it in other places, and this would only probably confuse people.
This is how the logistic network works - the player is part of the network - that won't be changed. Other stuff can be part of the network as well not just logistic containers - anything with a logistic connection (currently only containers and the player). However, more stuff is planned in the future. it's a logistic network not a "list of logistic containers in network" :)
Outsider wrote:requesters are still part of the logistic network and they hold items, so i don't see why they wouldn't be included as a filter here, again i'm looking at this in terms of the code i am writing so it might not make sense to you right away, and including it wouldn't cause any issues but rather offer more flexibility to the Api.
I'll look at this one however if I remember correctly requesters are part of the network but counts in them are not tracked when they're satisfied and as such aren't part of the counting methods. You could easily iterate them and get the counts using the existing API.
If you want to get ahold of me I'm almost always on Discord.

curiosity
Filter Inserter
Filter Inserter
Posts: 325
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: Some issues/requests for the logistic network interface

Post by curiosity »

This has been implemented exactly as described. The thread can be moved to implemented requests.

Post Reply

Return to “Implemented mod requests”