end
end
+-- This is used to allow mods to redefine minetest.item_place and so on
+local function redef_wrapper(table, name)
+ return function(...)
+ return table[name](...)
+ end
+end
+
--
-- Item definition defaults
--
tool_capabilities = nil,
-- Interaction callbacks
- on_place = minetest.item_place,
- on_drop = minetest.item_drop,
+ on_place = redef_wrapper(minetest, 'item_place'), -- minetest.item_place
+ on_drop = redef_wrapper(minetest, 'item_drop'), -- minetest.item_drop
on_use = nil,
- on_punch = minetest.node_punch,
- on_dig = minetest.node_dig,
+ on_punch = redef_wrapper(minetest, 'node_punch'), -- minetest.node_punch
+ on_dig = redef_wrapper(minetest, 'node_dig'), -- minetest.node_dig
-- Node properties
drawtype = "normal",
tool_capabilities = nil,
-- Interaction callbacks
- on_place = minetest.item_place,
- on_drop = minetest.item_drop,
+ on_place = redef_wrapper(minetest, 'item_place'), -- minetest.item_place
+ on_drop = redef_wrapper(minetest, 'item_drop'), -- minetest.item_drop
on_use = nil,
}
tool_capabilities = nil,
-- Interaction callbacks
- on_place = minetest.item_place,
- on_drop = minetest.item_drop,
+ on_place = redef_wrapper(minetest, 'item_place'), -- minetest.item_place
+ on_drop = redef_wrapper(minetest, 'item_drop'), -- minetest.item_drop
on_use = nil,
}