Page 1 of 1

[.14.21] luaEntity.logistic_network Bug or Doc Expansion

Posted: Sat Dec 03, 2016 5:57 am
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 :)

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

Posted: Sat Dec 03, 2016 12:32 pm
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.

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

Posted: Wed Jan 04, 2017 3:30 am
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.

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

Posted: Wed Jan 04, 2017 6:19 am
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.

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

Posted: Mon Jan 09, 2017 1:59 pm
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.

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

Posted: Mon Jan 09, 2017 2:46 pm
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.

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

Posted: Mon Jan 09, 2017 4:06 pm
by posila
Hmm, maybe Factorio Friday Facts about logistic and construction networks some day? :D

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

Posted: Tue Jan 10, 2017 12:45 am
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.

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

Posted: Tue Jan 10, 2017 3:01 am
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.

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

Posted: Tue Jan 10, 2017 3:37 pm
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.