1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-12-24 01:30:38 +01:00

Hunger modification when eating nether apple

Modification du hunger au moment où l'on mange une nether:apple. La faim diminue de 3 (la jauge remonte de 3) et la vie diminue toujours.
This commit is contained in:
LeMagnesium 2014-10-29 13:26:59 +01:00
parent 2e863a5119
commit c72fb2b1b9
2 changed files with 8 additions and 1 deletions

View File

@ -1,2 +1,3 @@
default
stairs?
hud
stairs?

View File

@ -367,6 +367,12 @@ minetest.register_node("nether:apple", {
return itemstack
end
local amount = math.random(4, 6)
local p_hunger = tonumber(hud.hunger[user:get_player_name()])
if not p_hunger then return end
p_hunger = p_hunger+3
if p_hunger > 30 then p_hunger = 30 end
hud.hunger[user:get_player_name()] = p_hunger
hud.set_hunger(user)
inv:add_item("main", {name="nether:blood_extracted", count=math.floor(amount/3)})
user:set_hp(user:get_hp()-amount)
return itemstack