diff --git a/mods/ITEMS/mcl_chests/api.lua b/mods/ITEMS/mcl_chests/api.lua index c98050934..42e0a901d 100644 --- a/mods/ITEMS/mcl_chests/api.lua +++ b/mods/ITEMS/mcl_chests/api.lua @@ -106,10 +106,12 @@ minetest.register_entity("mcl_chests:chest", { end, on_activate = function(self, initialization_data) - if initialization_data:find("^return") then + if initialization_data and initialization_data:find("\"###mcl_chests:chest###\"") then self:initialize(unpack(minetest.deserialize(initialization_data))) else - minetest.log("warning", debug.traceback("[mcl_chests] on_activate called without initialization_data")) + minetest.log("warning", + "[mcl_chests] on_activate called without proper initialization_data ... removing entity") + self.object:remove() end end, @@ -147,7 +149,7 @@ local function create_entity(pos, node_name, textures, param2, double, sound_pre entity_pos) dir, entity_pos = get_entity_info(pos, param2, double, dir, entity_pos) local initialization_data = minetest.serialize({pos, node_name, textures, dir, double, sound_prefix, - mesh_prefix, animation_type}) + mesh_prefix, animation_type, "###mcl_chests:chest###"}) local obj = minetest.add_entity(entity_pos, "mcl_chests:chest", initialization_data) if obj and obj:get_pos() then return obj:get_luaentity()