Page 1 of 1

[1.1.98] Blueprints in cursor coming from the library are valid but can't be read

Posted: Sat Nov 25, 2023 9:15 am
by uliko
If you pick up a blueprint from the library so that it is in the cursor, player.cursor_stack.valid is true. However, if you call either get_blueprint_entities() or get_blueprint_tiles() on the cursor_stack the game crashes saying the cursor_stack is not valid for reading.

If the blueprint comes from the inventory both methods work just fine.

Calling player.get_blueprint_entities() directly without going via the cursor_stack works in both cases (from inventory and library). Downside is there is no such method for the tiles in the blueprint.

In all the above cases player.is_cursor_blueprint() returns true.

Re: [1.1.98] Blueprints in cursor coming from the library are valid but can't be read

Posted: Mon Jan 22, 2024 12:20 pm
by boskid
Thanks for the report however that is Not a bug.

Blueprints technically have 2 states of existence: first is Item when they are inside of inventories and second is Records when they are inside of blueprint library. When you are holding blueprint from library you are holding blueprint record which is not an item. In this case LuaPlayer::cursor_stack gives you LuaItemStack which reports as being valid (because stack itself exists) but a cursor stack at that point in time is empty as it has no item. Blueprint record held by a player is kept outside of ItemStack related to the cursor because it is not an item.

With this piece of knowledge, this bug report reads as following "cannot access item while holding blueprint which is not an item" which makes this not a bug.

Re: [1.1.98] Blueprints in cursor coming from the library are valid but can't be read

Posted: Mon Jan 22, 2024 12:58 pm
by Koub
boskid wrote: Mon Jan 22, 2024 12:20 pm [...]
For my understanding, will the "abstract items" announced in the FFF 379 change the duality blueprint item/blueprint not-item we have today ? Or did I understand things wrong ?

Re: [1.1.98] Blueprints in cursor coming from the library are valid but can't be read

Posted: Mon Jan 22, 2024 1:29 pm
by boskid
Koub wrote: Mon Jan 22, 2024 12:58 pm For my understanding, will the "abstract items" announced in the FFF 379 change the duality blueprint item/blueprint not-item we have today ? Or did I understand things wrong ?
This is completly unrelated to abstract items from FFF-379. Items spawned from shortcut bar are true items which are marked as being possible to spawn at will through an input action (when shortcut activates) ["spawnable" flag] and are marked as "cursor only" so when cursor is cleared they are not returned to inventory but are destroyed instead ["only-in-cursor" flag]. https://lua-api.factorio.com/latest/typ ... Flags.html

Blueprints from library will remain being Records while Blueprints inside of inventories will remain being Items.