Add support for Better HUD

This commit is contained in:
rubenwardy 2014-04-13 19:48:54 +01:00
parent 105cfefa71
commit 1d99cc77b1
2 changed files with 15 additions and 6 deletions

1
depends.txt Normal file
View File

@ -0,0 +1 @@
hud?

View File

@ -77,13 +77,21 @@ function diet.item_eat(max)
end end
-- Increase health -- Increase health
local hp = user:get_hp() if minetest.get_modpath("hud") and hud then
if (hp+points > 20) then local h = tonumber(hud.hunger[name])
hp = 20 h = h + points
if h>30 then h = 30 end
hud.hunger[name] = h
hud.save_hunger(user)
else else
hp = hp + points local hp = user:get_hp()
end if (hp+points > 20) then
user:set_hp(hp) hp = 20
else
hp = hp + points
end
user:set_hp(hp)
end
-- Register -- Register
diet.__register_eat(player,item,ftype) diet.__register_eat(player,item,ftype)