on_item_request_removed
on_item_request_removed
I would like to know when an item-request-proxy is cancelled or completed. I don't care about items (because apparently that is hard). I just want to know when my item-request-proxy is removed and which entity (if it still exists) was the target.
Re: on_item_request_removed
+1
Dear devs,
please make completion and cancellation of entity-type "item-request-proxy" detectable. Currently there is no efficient way to get information about this, because the "death" of item request proxies is also not covered by event.on_entity_died().
Regards,
Arcitos
Dear devs,
please make completion and cancellation of entity-type "item-request-proxy" detectable. Currently there is no efficient way to get information about this, because the "death" of item request proxies is also not covered by event.on_entity_died().
Regards,
Arcitos
Re: on_item_request_removed
I think the problem with this might be that mods can fulfill those requests themselves, there's no way to know what's going to happen when a mod reads an entity's `item_requests` or sets it nil.
Re: on_item_request_removed
If the "item_requests"-value of a item-request-proxy is set to nil, the item-request-proxy is fulfilled and subsequently removed (i tested this a few minutes ago). It doesn't matter if this is done by drones or by setting it to nil via script. I just want to know that an item-request-proxy has been fulfilled/removed.
Re: on_item_request_removed
This would be handy.
Re: on_item_request_removed
The general use case is to make complicated buildings that require multiple items to build. Instead of a ghost, you build a chest with an item-request-proxy, then check every tick if it has the complete set of items to build it. This event would remove the requirement to check every tick.
My specific use case was for Blueprintable Trains, which is no long needed now that they are in the base game.
My specific use case was for Blueprintable Trains, which is no long needed now that they are in the base game.
Re: on_item_request_removed
Similar to Dave really - I want to avoid plopping complete things down, but rather build them in stages.
I'm also working on a construction bot based ammo/fuel filling station.
Is it an expensive thing to implement or make performant? I assumed the game already knows when the request is complete as it removes the proxy?
I'm also working on a construction bot based ammo/fuel filling station.
Is it an expensive thing to implement or make performant? I assumed the game already knows when the request is complete as it removes the proxy?
- eradicator
- Smart Inserter
- Posts: 5206
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: on_item_request_removed
+1
For progressively building structures like in traditional RTS games. I.e. if something needs 100 wood planks then every plank delivered builds 1% of the structure.
If the proxy entity knew which bots are heading towards itself (i.e. something like LuaEntity.bots_ordered_to_build_this (table or nil)?) then it would at least be possibly to make a cheaper polling solution in script by estimating the bots arrival time based on max_speed. Ofc an event would be much cleaner so that's just my usual "maybe that's easier to implement" compromise.
For progressively building structures like in traditional RTS games. I.e. if something needs 100 wood planks then every plank delivered builds 1% of the structure.
If the proxy entity knew which bots are heading towards itself (i.e. something like LuaEntity.bots_ordered_to_build_this (table or nil)?) then it would at least be possibly to make a cheaper polling solution in script by estimating the bots arrival time based on max_speed. Ofc an event would be much cleaner so that's just my usual "maybe that's easier to implement" compromise.
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.
Re: on_item_request_removed
That's a completely different request: on-item-delivered - and it's not going to happen.eradicator wrote: ↑Sun Apr 19, 2020 6:10 pm+1
For progressively building structures like in traditional RTS games. I.e. if something needs 100 wood planks then every plank delivered builds 1% of the structure.
If the proxy entity knew which bots are heading towards itself (i.e. something like LuaEntity.bots_ordered_to_build_this (table or nil)?) then it would at least be possibly to make a cheaper polling solution in script by estimating the bots arrival time based on max_speed. Ofc an event would be much cleaner so that's just my usual "maybe that's easier to implement" compromise.
The original request for an event when the proxy is being deleted because it was fulfilled might happen.
If you want to get ahold of me I'm almost always on Discord.
Re: on_item_request_removed
If on-item-request-proxy-complete gets implemented, someone could use it for incremental building by creating one proxy per build stage.
That would certainly not be as UPS-friendly as on-item-delivered. But it might (or might not - would have to be benchmarked) still be better than checking the current state each 6th tick (100ms response time).
Re: on_item_request_removed
That would end up taking more CPU time overall because 5 robots would have to get sent out vs 1 with all the items.Oktokolo wrote: ↑Sun Apr 19, 2020 7:41 pmIf on-item-request-proxy-complete gets implemented, someone could use it for incremental building by creating one proxy per build stage.
That would certainly not be as UPS-friendly as on-item-delivered. But it might (or might not - would have to be benchmarked) still be better than checking the current state each 6th tick (100ms response time).
If you want to get ahold of me I'm almost always on Discord.
- eradicator
- Smart Inserter
- Posts: 5206
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: on_item_request_removed
I think you completely misunderstood my post, there was no request in that post. But if on_item_request_removed happens it doesn't really matter.
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.
Re: on_item_request_removed
Yes, that probably kills cosmetic build stages.Rseding91 wrote: ↑Sun Apr 19, 2020 7:42 pmThat would end up taking more CPU time overall because 5 robots would have to get sent out vs 1 with all the items.Oktokolo wrote: ↑Sun Apr 19, 2020 7:41 pmIf on-item-request-proxy-complete gets implemented, someone could use it for incremental building by creating one proxy per build stage.
That would certainly not be as UPS-friendly as on-item-delivered. But it might (or might not - would have to be benchmarked) still be better than checking the current state each 6th tick (100ms response time).
Re: on_item_request_removed
I found another use case, I would like to know when a newly built locomotive is refueled.
Re: on_item_request_removed
Does "register_on_entity_destroyed" not work for item request proxies? Because that might be a helpful first step. You'd have to determine if it was caused by the requesting entity being destroyed, or the player cancelling the request, or it being fulfilled, but it could be wrangled.
Alternatively, keeping a table of item request proxy entities and looping over that every tick... It might sound bad but I have to wonder how many of them you expect to have at any given time. Unless you expect there to be hundreds of thousands of them, I wouldn't worry so much about UPS - especially if most of the time the number is more like zero because everything is fulfilled. "Iterating" over an empty table takes a mere nanoseconds.
Alternatively, keeping a table of item request proxy entities and looping over that every tick... It might sound bad but I have to wonder how many of them you expect to have at any given time. Unless you expect there to be hundreds of thousands of them, I wouldn't worry so much about UPS - especially if most of the time the number is more like zero because everything is fulfilled. "Iterating" over an empty table takes a mere nanoseconds.
Re: on_item_request_removed
Sadly it does not. But that would also work for me if it was implemented!
- ickputzdirwech
- Filter Inserter
- Posts: 787
- Joined: Sun May 07, 2017 10:16 am
- Contact:
Re: on_item_request_removed
It does work for me. Did they implement it only very recently?
Mods: Shortcuts for 1.1, ick's Sea Block, ick's vanilla tweaks
Tools: Atom language pack
Text quickly seems cold and unfriendly. Be careful how you write and interpret what others have written.
- A reminder for me and all who read what I write
Tools: Atom language pack
Text quickly seems cold and unfriendly. Be careful how you write and interpret what others have written.
- A reminder for me and all who read what I write
Re: on_item_request_removed
It seems they did, this can be moved to Implemented mod requests!