Fix hunger not working
This commit is contained in:
parent
e8fde86a19
commit
d274276335
@ -61,7 +61,6 @@ function hunger.handle_node_actions(pos, oldnode, player, ext)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Time based hunger functions
|
-- Time based hunger functions
|
||||||
if minetest.setting_getbool("enable_damage") then
|
|
||||||
local hunger_timer = 0
|
local hunger_timer = 0
|
||||||
local health_timer = 0
|
local health_timer = 0
|
||||||
local action_timer = 0
|
local action_timer = 0
|
||||||
@ -92,6 +91,7 @@ if minetest.setting_getbool("enable_damage") then
|
|||||||
|
|
||||||
local hunger = pd.get_number(name,"hunger_lvl")
|
local hunger = pd.get_number(name,"hunger_lvl")
|
||||||
if hunger > 0 then
|
if hunger > 0 then
|
||||||
|
pd.increment(name,"hunger_lvl",-1)
|
||||||
update_hunger(player, hunger - 1)
|
update_hunger(player, hunger - 1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -102,7 +102,7 @@ if minetest.setting_getbool("enable_damage") then
|
|||||||
if health_timer > HUNGER_HEALTH_TICK then
|
if health_timer > HUNGER_HEALTH_TICK then
|
||||||
for _,player in ipairs(minetest.get_connected_players()) do
|
for _,player in ipairs(minetest.get_connected_players()) do
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
local lvl = pd.get(name,"hunger_lvl")
|
local lvl = pd.get_number(name,"hunger_lvl")
|
||||||
|
|
||||||
local air = player:get_breath() or 0
|
local air = player:get_breath() or 0
|
||||||
local hp = player:get_hp()
|
local hp = player:get_hp()
|
||||||
@ -121,8 +121,6 @@ if minetest.setting_getbool("enable_damage") then
|
|||||||
health_timer = 0
|
health_timer = 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- food functions
|
-- food functions
|
||||||
local food = hunger.food
|
local food = hunger.food
|
||||||
|
Loading…
x
Reference in New Issue
Block a user