Enable reading the currently held blueprint record

This subforum contains all the issues which we already resolved.
User avatar
raiguard
Factorio Staff
Factorio Staff
Posts: 579
Joined: Wed Dec 13, 2017 8:29 pm
Contact:

Enable reading the currently held blueprint record

Post by raiguard »

Currently, when you're holding a blueprint record that is stored in the library, there is no way to access that from the API. My Quickbar Templates mod relies on being able to import and export blueprints, and using them straight from the library is the easiest and best method to do it. But now, in order for the mod to work, you have to move the record into your inventory, pick it up again so it's an item, then the mod's button will appear so you can click it.

Along with reading it, please also make it trigger on_cursor_stack_changed, as my mod also relies on that in order to work.

Thanks!
Don't forget, you're here forever.
kovarex
Factorio Staff
Factorio Staff
Posts: 8207
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: Enable reading the currently held blueprint record

Post by kovarex »

It isn't an item stack, it is a blueprint library record, so the event wouldn't be related.

But .. we can make a lua api to access the currently helt blueprint record.
User avatar
Therax
Filter Inserter
Filter Inserter
Posts: 471
Joined: Sun May 21, 2017 6:28 pm
Contact:

Re: Enable reading the currently held blueprint record

Post by Therax »

This is extremely important, as the current behavior breaks a whole slew of modding use cases:

1) If a player places a blueprint using a blueprint library record, during `on_put_item` there is no way for mods to access the blueprint configuration or content.
2) If a player deconstructs an area with a deconstruction planner library record, during `on_player_deconstructed_area`, there is no way to access to the deconstruction planner configuration.

At the moment, the only advice I can give users of my mods encountering the resulting issues (e.g. https://mods.factorio.com/mod/beltlayer ... d864140f0a) is to never use the blueprint library for any purpose.
Miniloader — UPS-friendly 1x1 loaders
Bulk Rail Loaders — Rapid train loading and unloading
Beltlayer & Pipelayer — Route items and fluids freely underground
kovarex
Factorio Staff
Factorio Staff
Posts: 8207
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: Enable reading the currently held blueprint record

Post by kovarex »

Added a way to read cursor blueprint contents regardless of source.
User avatar
raiguard
Factorio Staff
Factorio Staff
Posts: 579
Joined: Wed Dec 13, 2017 8:29 pm
Contact:

Re: Enable reading the currently held blueprint record

Post by raiguard »

Thank you very much! Is there some sort of event we can listen for to tell when a player picks up or changes their held blueprint record? Otherwise I'll have to read the cursor in an on_tick event.
Don't forget, you're here forever.
Post Reply

Return to “Resolved Problems and Bugs”