[.14.21] luaEntity.logistic_network Bug or Doc Expansion

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

[.14.21] luaEntity.logistic_network Bug or Doc Expansion

Post by Nexela »

From the api-docs

logistic_network :: LuaLogisticNetwork [Read-only]
The logistic network this entity is a part of.

Currently this only returns the network if the entity is "connected" to the network I.e roboports/logistic chests or inserters(etc) that are "connected" to the network

I was under the assumption that it worked like surface.find_logistic_network_by_position(position, force). and it would return the network the "any_entity" is in.

If this is intended behavior the doc should be expanded "Only works on entities connected to the network"
Also if this is intended behavior can we get a entity.find_logistic_network :)

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

Re: [.14.21] luaEntity.logistic_network Bug or Doc Expansion

Post by Rseding91 »

The logistic network this entity is a part of.
It already is documented - that's what it's saying.

It doesn't say "The logistic network this entity would be part of it it tried to find a network at the given position for the entities force".

That's also why the "find network by position" exists.
If you want to get ahold of me I'm almost always on Discord.

BenSeidel
Filter Inserter
Filter Inserter
Posts: 588
Joined: Tue Jun 28, 2016 1:44 am
Contact:

Re: [.14.21] luaEntity.logistic_network Bug or Doc Expansion

Post by BenSeidel »

Ha, I just assumed that an inserter arm was never part of a network as I could only ever get it to work with roboports and logistics chests, as they are both logistics network items.

To get the network connection for an inserter / other entity I have always used the get_control_behavior method. I find it interesting that the logistic_network method is really just a helper method to check if the get_control_behavior returns null.

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

Re: [.14.21] luaEntity.logistic_network Bug or Doc Expansion

Post by Rseding91 »

An inserter can have a control behavior without a logistic network connection.

If you don't check the "Connect to logistic network" checkbox then it has no logistic network.
If you want to get ahold of me I'm almost always on Discord.

BenSeidel
Filter Inserter
Filter Inserter
Posts: 588
Joined: Tue Jun 28, 2016 1:44 am
Contact:

Re: [.14.21] luaEntity.logistic_network Bug or Doc Expansion

Post by BenSeidel »

Rseding91 wrote:An inserter can have a control behavior without a logistic network connection.

If you don't check the "Connect to logistic network" checkbox then it has no logistic network.
Yeah, I that from the OP. Doesn't come across like that from the docs though. I was just pointing out my ASSUMPTION that the function only applied to the logistics network items for the reasons stated before.

User avatar
Mylon
Filter Inserter
Filter Inserter
Posts: 525
Joined: Sun Oct 23, 2016 11:42 pm
Contact:

Re: [.14.21] luaEntity.logistic_network Bug or Doc Expansion

Post by Mylon »

How about making it clear that find_logistic_network_by_position() only counts the actual logistic area, and not the construction area. Since logistic networks and construction networks are so tightly bound together in game (only coming from roboports) I mistakenly thought I could use this function to compare one entity inside the construction range to one outside, but both are nil.

posila
Factorio Staff
Factorio Staff
Posts: 5330
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: [.14.21] luaEntity.logistic_network Bug or Doc Expansion

Post by posila »

Hmm, maybe Factorio Friday Facts about logistic and construction networks some day? :D

BenSeidel
Filter Inserter
Filter Inserter
Posts: 588
Joined: Tue Jun 28, 2016 1:44 am
Contact:

Re: [.14.21] luaEntity.logistic_network Bug or Doc Expansion

Post by BenSeidel »

posila wrote:Hmm, maybe Factorio Friday Facts about logistic and construction networks some day? :D
A FFF, while informative, won't help a new player in a year or so, especially if there are any major API changes in the mean time. This thread has made me think what other function calls that apparently do nothing on some entity actually does something when the circumstances are correct.

Maybe changing the doc text to read "The logistics network the entity is connected to" might be a bit clearer as it implies that you can disconnect an entity from a logistics network, as opposed to just being a part of something with no clear method of making not a part of it.

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

Re: [.14.21] luaEntity.logistic_network Bug or Doc Expansion

Post by Rseding91 »

BenSeidel wrote:
posila wrote:Hmm, maybe Factorio Friday Facts about logistic and construction networks some day? :D
A FFF, while informative, won't help a new player in a year or so, especially if there are any major API changes in the mean time. This thread has made me think what other function calls that apparently do nothing on some entity actually does something when the circumstances are correct.

Maybe changing the doc text to read "The logistics network the entity is connected to" might be a bit clearer as it implies that you can disconnect an entity from a logistics network, as opposed to just being a part of something with no clear method of making not a part of it.
That's just a rabbit hole I'm not willing to go down. One player thinks "X" is a better description for something and another player thinks "Y" is better. So we change it to a mixture of X and Y and now nobody is happy.

It's staying as it is. A "Logistic Network" isn't a real concept and as such I reserve the right to use what ever wording I want to describe something that has it. It's up to you the player to know what that means in the context of the game.
If you want to get ahold of me I'm almost always on Discord.

User avatar
Mylon
Filter Inserter
Filter Inserter
Posts: 525
Joined: Sun Oct 23, 2016 11:42 pm
Contact:

Re: [.14.21] luaEntity.logistic_network Bug or Doc Expansion

Post by Mylon »

I don't have a problem with the name, but a note in the documentation would be handy. The wiki is nice for being able to add annotations, but the base information is woefully out of date.

Post Reply

Return to “Modding interface requests”