I am trying to get LuaRecord of blueprint held in cursor during op_pre_build
player.cursor_record.get_blueprint_entities() works fine when in cursor is single blueprint
but when i take whole blueprint book and try to place the selected blueprint from it, player.cursor_record.get_blueprint_entities() fails (Record is not a BlueprintRecord.)
From the LuaRecord of BlueprintBook i can access contents with all blueprints in the book, but where is no info which of them is the one which is selected
Someone pointed me to cursor_stack, but it is empty for both scenarios - is there way to call get_blueprint_entities() on bleprint from book ?
thanks
[2.0] Get blueprint in cursor on_pre_build
Re: [2.0] Get blueprint in cursor on_pre_build
I am actually baffled by this one as well. There are multiple mods I have which heavily depend on being able to access blueprint entities no matter where they are stored, and this kinda kills off a lot of their usability.
This surely must be some kind of oversight? It would be useful even if we could get some kind of "index" exposed for retrieving active blueprint from LuaRecord.contents.
Best regards,
Branko
This surely must be some kind of oversight? It would be useful even if we could get some kind of "index" exposed for retrieving active blueprint from LuaRecord.contents.
Best regards,
Branko
Re: [2.0] Get blueprint in cursor on_pre_build
In fact, from what I can tell, it is not possible to do anything similar with the LuaItemCommon (when a BlueprintBookItem) either. We do have a LuaItemCommon.active_index if it is a blueprint book, but nothing to do with it?
Best regards,
Branko
Best regards,
Branko
Re: [2.0] Get blueprint in cursor on_pre_build
And to anyone else who might face-palm like myself, at least for the inventory book access, active blueprint from the blueprint book held in inventory can be grabbed with:
I just failed to realise that books expose their inner content as regular inventory (got thrown off by the whole LuaRecord.contents thing).
If any of the devs are reading this, would it be possible to get a mention of this fact under the LuaItemStack.active_index documentation?
Best regards,
Branko
P.S.
And sorry for side-tracking this thread.
Code: Select all
stack.get_inventory(defines.inventory.item_main)[stack.active_index]
If any of the devs are reading this, would it be possible to get a mention of this fact under the LuaItemStack.active_index documentation?
Best regards,
Branko
P.S.
And sorry for side-tracking this thread.