1
0
mirror of git://repo.or.cz/minetest_hbhunger.git synced 2024-12-23 16:30:20 +01:00

Minor refactoring

This commit is contained in:
Wuzzy 2015-02-24 00:50:03 +01:00
parent 02db771b42
commit fbdadb09e2

View File

@ -97,7 +97,6 @@ end)
local main_timer = 0 local main_timer = 0
local timer = 0 local timer = 0
local timer2 = 0 local timer2 = 0
minetest.after(2.5, function()
minetest.register_globalstep(function(dtime) minetest.register_globalstep(function(dtime)
main_timer = main_timer + dtime main_timer = main_timer + dtime
timer = timer + dtime timer = timer + dtime
@ -107,7 +106,6 @@ minetest.after(2.5, function()
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()
-- only proceed if damage is enabled
local h = tonumber(hunger.hunger[name]) local h = tonumber(hunger.hunger[name])
local hp = player:get_hp() local hp = player:get_hp()
if timer > 4 then if timer > 4 then
@ -137,11 +135,9 @@ minetest.after(2.5, function()
hunger.handle_node_actions(nil, nil, player) hunger.handle_node_actions(nil, nil, player)
end end
end end
end end
if timer > 4 then timer = 0 end if timer > 4 then timer = 0 end
if timer2 > HUNGER_HUNGER_TICK then timer2 = 0 end if timer2 > HUNGER_HUNGER_TICK then timer2 = 0 end
end) end)
end)
end end