summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWuzzy <almikes@aol.com>2016-09-01 14:53:35 +0200
committerWuzzy <almikes@aol.com>2016-09-01 14:53:35 +0200
commit01bc7eb8bfefc931a8ad3d8bd95f603ca9707b0d (patch)
tree40876821d833b1285ee5f3616e5d23c30c3522fa
parentf0dccbda5cba7290ceee0662e9cc4ccd5681fdbc (diff)
Reveal item items and their leftovers
-rw-r--r--init.lua11
1 files 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)