From 01bc7eb8bfefc931a8ad3d8bd95f603ca9707b0d Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 1 Sep 2016 14:53:35 +0200 Subject: Reveal item items and their leftovers --- init.lua | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index 1244bb2..edafa1e 100644 --- a/init.lua +++ b/init.lua @@ -1007,12 +1007,19 @@ minetest.register_on_punchnode(function(pos, node, puncher, pointed_thing) reveal_item(puncher:get_player_name(), node.name) end) +minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack, pointed_thing) + reveal_item(placer:get_player_name(), itemstack:get_name()) +end) + minetest.register_on_craft(function(itemstack, player, old_craft_grid, craft_inv) reveal_item(player:get_player_name(), itemstack:get_name()) end) -minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack, pointed_thing) - reveal_item(placer:get_player_name(), itemstack:get_name()) +minetest.register_on_item_eat(function(hp_change, replace_with_item, itemstack, user, pointed_thing) + reveal_item(user:get_player_name(), itemstack:get_name()) + if replace_with_item ~= nil then + reveal_item(user:get_player_name(), replace_with_item) + end end) minetest.register_on_joinplayer(function(player) -- cgit v1.2.3