aboutsummaryrefslogtreecommitdiff
path: root/builtin/game/item.lua
diff options
context:
space:
mode:
Diffstat (limited to 'builtin/game/item.lua')
-rw-r--r--builtin/game/item.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/builtin/game/item.lua b/builtin/game/item.lua
index 8fd172aab..11a36bdc3 100644
--- a/builtin/game/item.lua
+++ b/builtin/game/item.lua
@@ -353,6 +353,12 @@ end
function core.item_eat(hp_change, replace_with_item)
return function(itemstack, user, pointed_thing) -- closure
+ for _, callback in pairs(core.registered_on_item_eats) do
+ local result = callback(hp_change, replace_with_item, itemstack, user, pointed_thing)
+ if result then
+ return result
+ end
+ end
if itemstack:take_item() ~= nil then
user:set_hp(user:get_hp() + hp_change)
itemstack:add_item(replace_with_item) -- note: replace_with_item is optional