diff --git a/homedecor/handlers/inventory.lua b/homedecor/handlers/inventory.lua index 273497dd..5855628e 100644 --- a/homedecor/handlers/inventory.lua +++ b/homedecor/handlers/inventory.lua @@ -57,7 +57,7 @@ end -- locked = true, -- } -- -function homedecor.handle_inventory(name, def) +function homedecor.handle_inventory(name, def, original_def) local inventory = def.inventory if not inventory then return end def.inventory = nil @@ -153,6 +153,5 @@ function homedecor.handle_inventory(name, def) return allow_take and allow_take(pos, listname, index, stack, player) or stack:get_count() end - end end diff --git a/homedecor/handlers/registration.lua b/homedecor/handlers/registration.lua index cb5ad558..5e06e3c3 100644 --- a/homedecor/handlers/registration.lua +++ b/homedecor/handlers/registration.lua @@ -2,7 +2,9 @@ homedecor = homedecor or {} local S = homedecor.gettext --wrapper around minetest.register_node that sets sane defaults and interprets some specialized settings -function homedecor.register(name, def) +function homedecor.register(name, original_def) + local def = table.copy(original_def) + def.drawtype = def.drawtype or (def.mesh and "mesh") or (def.node_box and "nodebox") @@ -19,7 +21,7 @@ function homedecor.register(name, def) def.paramtype2 = def.paramtype2 or "facedir" end - homedecor.handle_inventory(name, def) + homedecor.handle_inventory(name, def, original_def) local infotext = def.infotext --def.infotext = nil -- currently used to set locked refrigerator infotexts