Checking if a robot belongs to a specific logistics network

Post Reply
User avatar
Dustine
Long Handed Inserter
Long Handed Inserter
Posts: 60
Joined: Tue Mar 31, 2015 4:52 pm
Contact:

Checking if a robot belongs to a specific logistics network

Post by Dustine »

Right now there doesn't seem a way to check if a specific deployed robot, either logistic or construction (not follower robots), is connected to a specific logistic network. I know this binding occurs as robots flying over other networks won't arbitrarily store or pick things from said isolated network, they seem to "remember" from where they were deployed.

The reason I say there's no way to check either is because LuaEntity.logistic_network for robots seems to always return nil, and even if it didn't, I can't see a way to compare logistic networks (I'm assuming =='ing the returned tables would fail, but please prove me wrong if so!). There's no way to change it either that I can find on the API, but that'd be for another thread, I'd be happy with right now just having a way to check.

Use case: I need to be able to skip over robots that belong to a specific logistic network when I'm iterating over them, and I don't seem to have a way to do so. I need to skip them because the script I'm doing to them changes the network they're connected to (resets them), which leads to some very annoying bugs.

I guess a LuaLogisticNetwork.belongs_to(entity) that worked with robots could do, or having LuaEntity.logistic_network work with robots too (but if so, I would need a way to check if two networks are the same). Thank you so much!

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

Re: Checking if a robot belongs to a specific logistics network

Post by Rseding91 »

I fixed logistic_network read for robots for the next version of 0.16. You can simply compare them with == - all LuaObjects can be compared with ==.
If you want to get ahold of me I'm almost always on Discord.

User avatar
Dustine
Long Handed Inserter
Long Handed Inserter
Posts: 60
Joined: Tue Mar 31, 2015 4:52 pm
Contact:

Re: Checking if a robot belongs to a specific logistics network

Post by Dustine »

Rseding91 wrote:I fixed logistic_network read for robots for the next version of 0.16. You can simply compare them with == - all LuaObjects can be compared with ==.
Awesome!! I wish I had known that earlier, and thank you so much for adding logistic_network too.

Post Reply

Return to “Implemented mod requests”