[0.17.3] Inconsistent behavior with blueprints in the shortcut bar (and no mod access to blueprint data)
Posted: Thu Feb 28, 2019 9:33 pm
If a blueprint created in-game as an item (not the library) is placed in a quickbar slot, but is then moved into a chest, the blueprint is no longer placeable .
If the blueprint is then destroyed, it is removed from the quickbar.
If a blueprint is moved from the library directly onto the quickbar, it appears unavailable (it is dimmed out), but can be placed anyways. There is no physical item in the inventory in this case.
If a blueprint is copied from the library to the inventory, and then from the inventory to the quickbar, and then moved to a chest, it is no longer placeable.
If the chest is then destroyed, the blueprint shows as unavailable but magically becomes placeable again.
Modding:
(Context: I want to write a mod that exports/imports quickbar presets so they can be transferred between saves using a mechanism similar to blueprint strings; it's how I found the above.)
LuaPlayer::get_quick_bar_slot() on a quickbar slot containing a reference to a blueprint in the library returns nilaa
There is no way for a mod to determine which blueprint/book/decon planner is occupying a slot.
There is no way for a mod to set a specific blueprint/book/decon planner to a quickbar slot.
Proposed fix to the last last two: Have LuaPlayer::get_quick_bar_slot() return a second 'data' argument equivalent to either LuaItemStack::export_stack() or a Lua representation thereof (prior to the base64/deflate step), and add an optional third argument LuaPlayer::set_quick_bar_slot() for this data.
If the blueprint is then destroyed, it is removed from the quickbar.
If a blueprint is moved from the library directly onto the quickbar, it appears unavailable (it is dimmed out), but can be placed anyways. There is no physical item in the inventory in this case.
If a blueprint is copied from the library to the inventory, and then from the inventory to the quickbar, and then moved to a chest, it is no longer placeable.
If the chest is then destroyed, the blueprint shows as unavailable but magically becomes placeable again.
Modding:
(Context: I want to write a mod that exports/imports quickbar presets so they can be transferred between saves using a mechanism similar to blueprint strings; it's how I found the above.)
LuaPlayer::get_quick_bar_slot() on a quickbar slot containing a reference to a blueprint in the library returns nilaa
There is no way for a mod to determine which blueprint/book/decon planner is occupying a slot.
There is no way for a mod to set a specific blueprint/book/decon planner to a quickbar slot.
Proposed fix to the last last two: Have LuaPlayer::get_quick_bar_slot() return a second 'data' argument equivalent to either LuaItemStack::export_stack() or a Lua representation thereof (prior to the base64/deflate step), and add an optional third argument LuaPlayer::set_quick_bar_slot() for this data.