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

Bugs that are actually features.
uliko
Burner Inserter
Burner Inserter
Posts: 13
Joined: Sun Jun 10, 2018 7:56 pm
Contact:

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

Post 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.
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3031
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

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

Post 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.
Koub
Global Moderator
Global Moderator
Posts: 7784
Joined: Fri May 30, 2014 8:54 am
Contact:

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

Post 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 ?
Koub - Please consider English is not my native language.
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3031
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

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

Post 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.
Post Reply

Return to “Not a bug”