Hello!
I'm trying to revive "Landfill Everything" mod. While it's made mostly working by fixes presented in this post; viewtopic.php?p=528357#p528357 , it's now unable to operate on temporary BPs or BPs opened from library, unline in 0.18 times. This is caused specifically by the fact that player.cursor_stack.valid_for_read is false for such "item stacks". And player's get_blueprint_entities() isn't enough since we also need to both get BP's tiles and set them. Could you please point out to API which allows to access temporary BP in hand as actual BP?
Thanks.
How to access temporary BP in player's hand?
Re: How to access temporary BP in player's hand?
I'm sure more knowledgeable people can post here and confirm, but I'm pretty sure that you simply cannot do what you are trying to do anymore. The blueprint library is completely off-limit to mods.
My mods
Content: Lunar Landings | Freight Forwarding | Spidertron Patrols | Spidertron Enhancements | Power Overload
QoL: Factory Search | Module Inserter Simplified | Wire Shortcuts X | Ghost Warnings
Content: Lunar Landings | Freight Forwarding | Spidertron Patrols | Spidertron Enhancements | Power Overload
QoL: Factory Search | Module Inserter Simplified | Wire Shortcuts X | Ghost Warnings
Re: How to access temporary BP in player's hand?
Well, I'm not trying to mess with BP library. I just want to modify BP picked from there as if it was a temporary.
Re: How to access temporary BP in player's hand?
I was sort of wrong: see https://lua-api.factorio.com/latest/Lua ... _blueprint
My mods
Content: Lunar Landings | Freight Forwarding | Spidertron Patrols | Spidertron Enhancements | Power Overload
QoL: Factory Search | Module Inserter Simplified | Wire Shortcuts X | Ghost Warnings
Content: Lunar Landings | Freight Forwarding | Spidertron Patrols | Spidertron Enhancements | Power Overload
QoL: Factory Search | Module Inserter Simplified | Wire Shortcuts X | Ghost Warnings
Re: How to access temporary BP in player's hand?
Thanks for the link. Unfortunately I already know about this API, and it has two severe limitations. First, it's unclear how to modify such BP, as it provides only getter methods. Second, it doesn't seem to provide access to BP tiles, as there's only get_blueprint_entities and nothing similar to LuaItemStack.get_blueprint_tiles
Re: How to access temporary BP in player's hand?
I'm working on a similar problem, but only reading. (see here)
With some quirks I can get the active blueprint from a library-stored book or blueprint.
But only the entities, not the tiles, as mentioned above. And I could not (yet) come up with a way to get the other blueprints from a library-stored book.
There is a set variant of the mentioned function, that you can use on a target blueprint that you could create by calling the paste command...
For your uses this could be suitable, I think:
Now the active blueprint that was in the cursor is in the cursor again - as a new temporary blueprint, that can be handled like any blueprint stored in the user-inventory.
There seems to be no way to get the original link to the library back into the stack, as far as I can see...
With some quirks I can get the active blueprint from a library-stored book or blueprint.
But only the entities, not the tiles, as mentioned above. And I could not (yet) come up with a way to get the other blueprints from a library-stored book.
There is a set variant of the mentioned function, that you can use on a target blueprint that you could create by calling the paste command...
For your uses this could be suitable, I think:
Code: Select all
local temp_blueprint = player.get_blueprint_entities()
player.activate_paste()
blueprint = player.cursor_stack
blueprint.set_blueprint_entities(temp_blueprint)
There seems to be no way to get the original link to the library back into the stack, as far as I can see...