2 Commits

Author SHA1 Message Date
28ff84ca00 Add awards support (#68) 2021-09-08 22:43:08 +02:00
1dfd4a0c66 Fix call of a deprecated method 2021-06-26 20:59:58 +02:00
2 changed files with 11 additions and 1 deletions

View File

@ -1,3 +1,4 @@
awards?
hbhunger?
hud?
hunger?

View File

@ -93,7 +93,7 @@ function diet.item_eat(max, replace_with_item, poisen, heal)
-- Increase health
if minetest.get_modpath("hbhunger") and hbhunger then
minetest.sound_play({name = "hbhunger_eat_generic", gain = 1}, {pos=user:getpos(), max_hear_distance = 16})
minetest.sound_play({name = "hbhunger_eat_generic", gain = 1}, {pos=user:get_pos(), max_hear_distance = 16})
-- saturation
local h = tonumber(hbhunger.hunger[name])
@ -143,6 +143,15 @@ function diet.item_eat(max, replace_with_item, poisen, heal)
diet.save()
-- If awards
if minetest.get_modpath("awards") then
if user and user:is_player() and not itemstack:is_empty() then
local itemname = itemstack:get_name()
itemname = minetest.registered_aliases[itemname] or itemname
awards.notify_eat(user, itemname)
end
end
-- Remove item
itemstack:add_item(replace_with_item)
itemstack:take_item()