LuaEntity attributes to associate robots and their delivery destinations
-
- Fast Inserter
- Posts: 128
- Joined: Thu Feb 08, 2018 8:25 am
- Contact:
LuaEntity attributes to associate robots and their delivery destinations
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.
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.
-
- Fast Inserter
- Posts: 128
- Joined: Thu Feb 08, 2018 8:25 am
- Contact:
Re: LuaEntity attributes to associate robots and their delivery destinations
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
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.
If you want to get ahold of me I'm almost always on Discord.
-
- Fast Inserter
- Posts: 128
- Joined: Thu Feb 08, 2018 8:25 am
- Contact:
Re: LuaEntity attributes to associate robots and their delivery destinations
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
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).
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
+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
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
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.
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
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.
If you want to get ahold of me I'm almost always on Discord.
Re: LuaEntity attributes to associate robots and their delivery destinations
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
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.
If you want to get ahold of me I'm almost always on Discord.
Re: LuaEntity attributes to associate robots and their delivery destinations
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.
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.