Reveal item on inventory interaction

master
Wuzzy 2019-03-17 08:49:32 +01:00
parent 8c09825f85
commit 0a73d0f195
1 changed files with 12 additions and 0 deletions

View File

@ -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()