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:
parent
02db771b42
commit
fbdadb09e2
6
init.lua
6
init.lua
@ -97,8 +97,7 @@ 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
|
||||||
timer2 = timer2 + dtime
|
timer2 = timer2 + 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
|
||||||
|
Loading…
Reference in New Issue
Block a user