forked from mtcontrib/diet
Compare commits
2 Commits
nalc-1.2.0
...
28ff84ca00
Author | SHA1 | Date | |
---|---|---|---|
28ff84ca00 | |||
1dfd4a0c66 |
@ -1,3 +1,4 @@
|
|||||||
|
awards?
|
||||||
hbhunger?
|
hbhunger?
|
||||||
hud?
|
hud?
|
||||||
hunger?
|
hunger?
|
||||||
|
11
init.lua
11
init.lua
@ -93,7 +93,7 @@ function diet.item_eat(max, replace_with_item, poisen, heal)
|
|||||||
|
|
||||||
-- Increase health
|
-- Increase health
|
||||||
if minetest.get_modpath("hbhunger") and hbhunger then
|
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
|
-- saturation
|
||||||
local h = tonumber(hbhunger.hunger[name])
|
local h = tonumber(hbhunger.hunger[name])
|
||||||
@ -143,6 +143,15 @@ function diet.item_eat(max, replace_with_item, poisen, heal)
|
|||||||
|
|
||||||
diet.save()
|
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
|
-- Remove item
|
||||||
itemstack:add_item(replace_with_item)
|
itemstack:add_item(replace_with_item)
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
|
Reference in New Issue
Block a user