View difference between Paste ID: CNhAuYyc and S3HBunNq
SHOW: | | - or go back to the newest paste.
1
local obj = minetest.add_item(pos, name)
2
3-
if obj ~= nil then
3+
obj:get_luaentity().on_punch = function (self, puncher)
4-
	obj:get_luaentity():on_punch = function (self, puncher, time_from_last_punch, tool_capabilities, dir)
4+
	if (self.object:is_player()) then return end
5-
		if (self:is_player()) then return end
5+
	if (puncher == nil) then return end
6-
		if (puncher == nil) then return end
6+
7-
	end
7+
	minetest.chat_send_all("text")
8
end