1
0
mirror of https://github.com/mt-mods/homedecor_modpack.git synced 2024-12-23 08:20:21 +01:00

let the custom on_place of the expansion code call after_place_node to make sure infotexts and owners of locked nodes are being set

This commit is contained in:
Tim 2015-08-19 20:20:58 +02:00
parent 29f61bb899
commit b6512b3add

View File

@ -54,12 +54,10 @@ local function stack(itemstack, placer, fdir, pos, def, pos2, node1, node2)
node2 = node2 or "air" -- this can be used to clear buildable_to nodes even though we are using a multinode mesh node2 = node2 or "air" -- this can be used to clear buildable_to nodes even though we are using a multinode mesh
minetest.set_node(pos2, { name = node2, param2 = (node2 ~= "air" and fdir) or nil }) minetest.set_node(pos2, { name = node2, param2 = (node2 ~= "air" and fdir) or nil })
-- temporary check if this is a locked node to set its infotext -- call after_place_node of the placed node if available
local nodename = itemstack:get_name() local ctrl_node_def = minetest.registered_nodes[node1]
if string.find(nodename, "_locked") then if ctrl_node_def and ctrl_node_def.after_place_node then
local meta = minetest.get_meta(pos) ctrl_node_def.after_place_node(pos, placer)
meta:set_string("owner", placer_name)
meta:set_string("infotext", S("Locked %s (owned by %s)"):format(minetest.registered_nodes[nodename].infotext, placer_name))
end end
if not homedecor.expect_infinite_stacks then if not homedecor.expect_infinite_stacks then