From 0a73d0f195c1901f54f33e18d18fd07d510b1dcc Mon Sep 17 00:00:00 2001 From: Wuzzy <Wuzzy2@mail.ru> Date: Sun, 17 Mar 2019 08:49:32 +0100 Subject: [PATCH] Reveal item on inventory interaction --- init.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/init.lua b/init.lua index b8ee35a..80ace7f 100644 --- a/init.lua +++ b/init.lua @@ -1368,6 +1368,18 @@ minetest.register_on_craft(function(itemstack, player, old_craft_grid, craft_inv end end) +minetest.register_on_player_inventory_action(function(player, action, inventory, inventory_info) + if player == nil then return end + local playername = player:get_player_name() + local itemstack + if action == "take" or action == "put" then + itemstack = inventory_info.stack + end + if itemstack ~= nil and playername ~= nil and playername ~= "" and (not itemstack:is_empty()) then + reveal_item(playername, itemstack:get_name()) + end +end) + minetest.register_on_item_eat(function(hp_change, replace_with_item, itemstack, user, pointed_thing) if user == nil then return end local playername = user:get_player_name()