Gladly -
if message_id == hash("open_chest") then
local cloned_tree = gui.clone_tree(gui.get_node("itemContainer_bdummy"))
self.currentInteractable.nodes = cloned_tree
gui.set_position(cloned_tree[hash("itemContainer_bdummy")], vmath.vector3(960, 900, 0))
gui.set_text(cloned_tree[hash("itemContainer_tdummy")], message.name)
gui.set_enabled(cloned_tree[hash("itemContainer_bdummy")], true)
gui.set_enabled(cloned_tree[hash("itemContainerTile_bdummy")], false)
self.currentInteractable.name = message.name
self.interactableInUse = true
local num = 0
for _,item in pairs(message.contents) do
num = num + 1
msg.post("world#item_control", "save_container", { contents = message.contents, name = message.name })
pprint(self.currentInteractable.nodes[hash("itemContainerTile_bdummy")])
pprint(gui.clone_tree(self.currentInteractable.nodes[hash("itemContainerTile_bdummy")]))
local proto = self.currentInteractable.nodes[hash("itemContainerTile_bdummy")]
local cloned_tree = gui.clone_tree(proto)
gui.set_position(cloned_tree[hash("itemContainerTile_bdummy")], vmath.vector3(-160, -90, 0))
gui.set_text(cloned_tree[hash("itemContainerTile_tdummy")], string.sub(item.name, 0, 1))
gui.set_enabled(cloned_tree[hash("itemContainerTile_bdummy")], true)
table.insert(self.currentInteractable.contents, { id = num, name = item.name, node = cloned_tree[hash("itemContainerTile_bdummy")]})
end
end
A lot of this stuff is more or less irrelevant, but I thought I should copy it all, just to be sure.
The code first clones the “itemContainer_bdummy” tree, does some stuff with it, and then, in the for-loop, should clone the “itemContainerTile_bdummy” node from the cloned tree; which is where specifically the gui.clone_tree() function has problems with, and fails to actually clone everything.
The node hierarchy in question:
Thanks!