Page 1 of 1

Enable reading the currently held blueprint record

Posted: Tue Aug 18, 2020 3:13 am
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!

Re: Enable reading the currently held blueprint record

Posted: Wed Aug 19, 2020 8:48 am
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.

Re: Enable reading the currently held blueprint record

Posted: Tue Sep 08, 2020 1:05 pm
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.

Re: Enable reading the currently held blueprint record

Posted: Sat Oct 17, 2020 2:31 pm
by kovarex
Added a way to read cursor blueprint contents regardless of source.

Re: Enable reading the currently held blueprint record

Posted: Sat Oct 17, 2020 6:41 pm
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.