Page 1 of 1
LuaEntity attributes to associate robots and their delivery destinations
Posted: Thu Nov 29, 2018 5:34 pm
by shanemadden
Looking for attributes to associate active construction and logistic bots with the entity they're on their way to.
On the robot entity, an attribute like destination or delivery_target with the entity that the robot's on its way to deliver to or build, as well as possibly another for where it's on its way to get the source item from (pickup_target?).
On the destination entity, an attribute that gives an array of the robots that are on their way to deliver something at this entity.
Some of these might make more sense returning LuaLogisticPoint instead of entities, though in some cases a delivery target wouldn't have one, like entity ghosts to be built.
Re: LuaEntity attributes to associate robots and their delivery destinations
Posted: Thu Nov 29, 2018 5:48 pm
by shanemadden
And our friend Stapler would also like an event fired when a robot is 'spawned' / sent out for delivery
Re: LuaEntity attributes to associate robots and their delivery destinations
Posted: Thu Nov 29, 2018 6:06 pm
by Rseding91
The robots target we can do. The entity knowing what robots are on the way is an O(N) scan of all robots on the surface so that's not happening. Also, no event when a robot is spawned. The performance issues aside (with how frequently the event would fire): mods mess with things and I don't want to have to safety check every single time a robot is created to work on something that one or more mods hasn't broken something in the logistics system that was trying to dispatch the robot.
Re: LuaEntity attributes to associate robots and their delivery destinations
Posted: Thu Nov 29, 2018 7:31 pm
by shanemadden
Great, thanks! That's all I need for the use case I'm thinking of, and I suppose if someone wants to do the big O(N) scan and incur the performance pain they would be able to do it directly with find_entities_filtered.
Re: LuaEntity attributes to associate robots and their delivery destinations
Posted: Sat Jul 24, 2021 10:14 pm
by aaron311
I know this is engaging in massive thread-necromancy here but I too really would be interested in this API.
Thinking some way to:
1. Read current long-term destination entity (robot's target job). Write would be nice too, but admittedly the rules around this could be complex.
2. Read/write the current short-term destination entity (e.g. robots target charging station, or maybe would be the target job).
Re: LuaEntity attributes to associate robots and their delivery destinations
Posted: Fri Oct 08, 2021 6:11 pm
by yesennes
+1 This would be great!
Also, it would be nice if you could nil out the target to get the networks to reassign the job. I hate it when after my first wave of personal robots finish their jobs, I'm stuck waiting for robots on the other side of my base to finish construction of a blueprint. I wish I could tell them to go home and let my now inactive robots have a chance to snag another job
Re: LuaEntity attributes to associate robots and their delivery destinations
Posted: Fri Oct 08, 2021 7:24 pm
by mrvn
Rseding91 wrote: ↑Thu Nov 29, 2018 6:06 pm
The robots target we can do.
Since this got necroed anyway: It's been 3 years. Have you done it yet? Not seeing it in the Lua docs.
If one could write the short-term destination one could play around with all kinds of optimizations for bots even if the performance would be horrible in lua. Good enough for a proof-of-concept.
Rseding91 wrote: ↑Thu Nov 29, 2018 6:06 pm
The entity knowing what robots are on the way is an O(N) scan of all robots on the surface so that's not happening.
How do you get the stats for the logistic chests how many items are getting picked up? Wouldn't that code lend itself to also record the entity IDs of the bots targeting the chest (or any other entity)? You don't need to scan, you only have to keep a record of the bot as you assign them.
Re: LuaEntity attributes to associate robots and their delivery destinations
Posted: Sat Oct 09, 2021 2:59 pm
by Rseding91
Logistic entities keep track of the number of items expected to be delivered/removed from themselves. They do not track what robots are going to be doing that.
Re: LuaEntity attributes to associate robots and their delivery destinations
Posted: Sat Oct 09, 2021 3:20 pm
by mrvn
Rseding91 wrote: ↑Sat Oct 09, 2021 2:59 pm
Logistic entities keep track of the number of items expected to be delivered/removed from themselves. They do not track what robots are going to be doing that.
That's not what I said. I mend that that code path already exists and adding what robot is doing it could be simple. No O(n) work needed.
Re: LuaEntity attributes to associate robots and their delivery destinations
Posted: Sun Oct 10, 2021 2:47 pm
by Rseding91
mrvn wrote: ↑Sat Oct 09, 2021 3:20 pm
Rseding91 wrote: ↑Sat Oct 09, 2021 2:59 pm
Logistic entities keep track of the number of items expected to be delivered/removed from themselves. They do not track what robots are going to be doing that.
That's not what I said. I mend that that code path already exists and adding what robot is doing it could be simple. No O(n) work needed.
Unless base game would be wanting to use it, we aren't likely to ever add things like that just for modding use. It would add performance overhead, save file size, save time/load time all for something base game wouldn't use.
Re: LuaEntity attributes to associate robots and their delivery destinations
Posted: Sun Oct 10, 2021 7:29 pm
by mrvn
Too bad.
I would really like to make Bluebuilt not built ghosts that have a personal construction bot on the way. That just slows down building stuff because it wastes the construction power of the bots.