Logistics robot collect/drop off event
- Deadlock989
- Smart Inserter
- Posts: 2529
- Joined: Fri Nov 06, 2015 7:41 pm
Logistics robot collect/drop off event
Could we have an event similar to on_picked_up_item, but for robots instead of players? Like on_robot_mined but when it interacts with logistics chests.
I want to do things to bots when they pick up certain items. Bad things.
Alternatively, and this may be harder, can we have a way of marking items as non-transportable by bots?
I want to do things to bots when they pick up certain items. Bad things.
Alternatively, and this may be harder, can we have a way of marking items as non-transportable by bots?
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
Re: Logistics robot collect/drop off event
My first thought was... it's a bad idea, lots of events generated that 99%+ of the time would be useless, just wasting CPU power, but if you already have a call for construction robots, it changes my thought to... why not?Deadlock989 wrote:Could we have an event similar to on_picked_up_item, but for robots instead of players? Like on_robot_mined but when it interacts with logistics chests.
I want to do things to bots when they pick up certain items. Bad things.
Alternatively, and this may be harder, can we have a way of marking items as non-transportable by bots?
An item filter isn't just a bad idea either, it does feel strange when a single small robot can carry a locomotive, or a rocket silo.
- Deadlock989
- Smart Inserter
- Posts: 2529
- Joined: Fri Nov 06, 2015 7:41 pm
Re: Logistics robot collect/drop off event
I suppose. I have no idea what the runtime burden for an event that no mod actually uses is. The scenario I have in mind would be inhibiting mass logistics bot use, so it wouldn't matter, as long as it didn't adversely affect vanilla players.
I don't build mega-bot bases myself but I do use construction bots a lot, and I'd guess that construction tends to cap out mid-game while logistics bots would continue to increase as you scaled production. That may be why the construction bot events aren't really a problem. You only really need a ton of construction bots if you do a lot of tile paving (would be really, really nice if construction bots could carry more than 1 tile, or if tile items paved a mass of nearby ghosts, just like players can mass-tile in one go).
I did also think about asking for events on setting filters but it doesn't help in my case as you still wouldn't be able to stop items being dumped into active providers etc.
I don't build mega-bot bases myself but I do use construction bots a lot, and I'd guess that construction tends to cap out mid-game while logistics bots would continue to increase as you scaled production. That may be why the construction bot events aren't really a problem. You only really need a ton of construction bots if you do a lot of tile paving (would be really, really nice if construction bots could carry more than 1 tile, or if tile items paved a mass of nearby ghosts, just like players can mass-tile in one go).
I did also think about asking for events on setting filters but it doesn't help in my case as you still wouldn't be able to stop items being dumped into active providers etc.
Re: Logistics robot collect/drop off event
Wouldn't it be better for the chest to have an item_added and item_removed event?
And by that I mean the actual entity. Not an event for every item that is added/removed from a chest world wide.
And by that I mean the actual entity. Not an event for every item that is added/removed from a chest world wide.
- Deadlock989
- Smart Inserter
- Posts: 2529
- Joined: Fri Nov 06, 2015 7:41 pm
Re: Logistics robot collect/drop off event
You mean just logistics chests? I don't see the benefit, and you'd have to filter out whether it was a player or a robot or an inserter etc. doing the depositing. Personally I only care about the robots.
Re: Logistics robot collect/drop off event
Could be logistic chest, could be a normal chest. The important part is that the event gets bound to a specific chest and only triggers when that chest has activity.
No need to get an event for every bot that picks something up or drops something off just so you can filter if it actually interacted with the chest you are interested in.
No need to get an event for every bot that picks something up or drops something off just so you can filter if it actually interacted with the chest you are interested in.
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Logistics robot collect/drop off event
I'd love a way to restrict certain items from being transported by players(!)/inserters/bots. But i fear that would also be pretty performance heavy to check on a per-item-basis. :/.Deadlock989 wrote:Alternatively, and this may be harder, can we have a way of marking items as non-transportable by bots?
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
- Deadlock989
- Smart Inserter
- Posts: 2529
- Joined: Fri Nov 06, 2015 7:41 pm
Re: Logistics robot collect/drop off event
That's not how events work. And I am literally interested in every bot and every chest.mrvn wrote:Could be logistic chest, could be a normal chest. The important part is that the event gets bound to a specific chest and only triggers when that chest has activity.
No need to get an event for every bot that picks something up or drops something off just so you can filter if it actually interacted with the chest you are interested in.
-
- Filter Inserter
- Posts: 841
- Joined: Mon Sep 14, 2015 7:40 am
- Contact:
Re: Logistics robot collect/drop off event
You can already restrict a player from transporting certain items, thanks to the various on_player_changed_X_inventory events.eradicator wrote:I'd love a way to restrict certain items from being transported by players(!)/inserters/bots. But i fear that would also be pretty performance heavy to check on a per-item-basis. :/.Deadlock989 wrote:Alternatively, and this may be harder, can we have a way of marking items as non-transportable by bots?
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Logistics robot collect/drop off event
All those events are only raised after the player has already picked up the item. They also don't tell you what changed or where the change came from. So the only thing you can do is drop items on the floor that the player shouldn't carry, and at a heavy performance penalty.Supercheese wrote:You can already restrict a player from transporting certain items, thanks to the various on_player_changed_X_inventory events.eradicator wrote:I'd love a way to restrict certain items from being transported by players(!)/inserters/bots. But i fear that would also be pretty performance heavy to check on a per-item-basis. :/.Deadlock989 wrote:Alternatively, and this may be harder, can we have a way of marking items as non-transportable by bots?
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
- Deadlock989
- Smart Inserter
- Posts: 2529
- Joined: Fri Nov 06, 2015 7:41 pm
Re: Logistics robot collect/drop off event
Not really on topic
Re: Logistics robot collect/drop off event
Such an event would be fired too often that it would have an unacceptable performance impact.
What you're trying to do is simply outside of what the game was ever designed to do. Like trying to make belts not support specific items - it's just not going to happen unless you want to sacrifice virtually all of your performance.
What you're trying to do is simply outside of what the game was ever designed to do. Like trying to make belts not support specific items - it's just not going to happen unless you want to sacrifice virtually all of your performance.
If you want to get ahold of me I'm almost always on Discord.
- Deadlock989
- Smart Inserter
- Posts: 2529
- Joined: Fri Nov 06, 2015 7:41 pm
Re: Logistics robot collect/drop off event
Oh well, it was worth asking.
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
Re: Logistics robot collect/drop off event
This was my initial thought, yeah.Rseding91 wrote:Such an event would be fired too often that it would have an unacceptable performance impact.
What you're trying to do is simply outside of what the game was ever designed to do. Like trying to make belts not support specific items - it's just not going to happen unless you want to sacrifice virtually all of your performance.
When you understand how events actually work anyway.
1. Something triggers an event.
2. an event is created, this means you create a new class item, and push it into this tick's event vector... In short, it makes data and costs RAM
3. When all events have been created, the script is run through the control.lua of every mod. so every instance it checks if an event tag equates to that type of event, it's reading memory.
4. if it matches, it runs that script
Add all this up with tens, or hundreds of thousands of robots flying about, and you've suddenly got hundreds or thousands of events generated and checked several times every second that you didn't have before, slowing the game performance down.
Re: Logistics robot collect/drop off event
But at the end... Bots are nerfed
- Deadlock989
- Smart Inserter
- Posts: 2529
- Joined: Fri Nov 06, 2015 7:41 pm
Re: Logistics robot collect/drop off event
OK, we get it, you're clever.bobingabout wrote:When you understand how events actually work anyway.
There wouldn't be "hundreds or thousands of events generated and checked several times every second" because even when you have a swarm of 10000 logistics bots, they don't all pick something up or drop something off every second.
But if the overhead is too high then it's too high. Discussion over.
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Logistics robot collect/drop off event
Hostility doesn't help anyone. You made a request that had a very low chance to be implemented. Every semi experienced modder who has ever requested a new event knows this. Bob tried to explain it to you or anyone who might read this thread afterwards. That's all.Deadlock989 wrote:OK, we get it, you're clever.bobingabout wrote:When you understand how events actually work anyway.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
- Deadlock989
- Smart Inserter
- Posts: 2529
- Joined: Fri Nov 06, 2015 7:41 pm
Re: Logistics robot collect/drop off event
I came here to talk to the Factorio devs. Not randoms.
Re: Logistics robot collect/drop off event
Which actually means we should have more specific events.bobingabout wrote:This was my initial thought, yeah.Rseding91 wrote:Such an event would be fired too often that it would have an unacceptable performance impact.
What you're trying to do is simply outside of what the game was ever designed to do. Like trying to make belts not support specific items - it's just not going to happen unless you want to sacrifice virtually all of your performance.
When you understand how events actually work anyway.
1. Something triggers an event.
2. an event is created, this means you create a new class item, and push it into this tick's event vector... In short, it makes data and costs RAM
3. When all events have been created, the script is run through the control.lua of every mod. so every instance it checks if an event tag equates to that type of event, it's reading memory.
4. if it matches, it runs that script
Add all this up with tens, or hundreds of thousands of robots flying about, and you've suddenly got hundreds or thousands of events generated and checked several times every second that you didn't have before, slowing the game performance down.
Take for example the Logistic Train Network mod. It has to listen to events for trains it controls and LTN stations. But there is no way to listen to events for specific trains or specific train stops. So it has to listen to all trains and all train stops and then filter out those that are actually interesting.
If entities could have events then the C++ code for trains and train stations that now triggers the event could check if any mod is interested in that event for that specific entity. And only if someone has registered an event handler the event gets created and consumes time and resources. That way adding an event handler for one entity doesn't significantly impact all entities of that type.