forked from mtcontrib/minetest_hudbars
Remove pointless delays and useless code
This commit is contained in:
parent
25b59646c2
commit
cfe8b3a60b
9
init.lua
9
init.lua
@ -314,11 +314,9 @@ local function update_hud(player)
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_on_joinplayer(function(player)
|
minetest.register_on_joinplayer(function(player)
|
||||||
minetest.after(0.5, function()
|
|
||||||
hide_builtin(player)
|
hide_builtin(player)
|
||||||
custom_hud(player)
|
custom_hud(player)
|
||||||
hb.players[player:get_player_name()] = player
|
hb.players[player:get_player_name()] = player
|
||||||
end)
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
minetest.register_on_leaveplayer(function(player)
|
minetest.register_on_leaveplayer(function(player)
|
||||||
@ -327,12 +325,9 @@ end)
|
|||||||
|
|
||||||
local main_timer = 0
|
local main_timer = 0
|
||||||
local timer = 0
|
local timer = 0
|
||||||
local timer2 = 0
|
minetest.register_globalstep(function(dtime)
|
||||||
minetest.after(2.5, function()
|
|
||||||
minetest.register_globalstep(function(dtime)
|
|
||||||
main_timer = main_timer + dtime
|
main_timer = main_timer + dtime
|
||||||
timer = timer + dtime
|
timer = timer + dtime
|
||||||
timer2 = timer2 + dtime
|
|
||||||
if main_timer > hb.settings.tick or timer > 4 then
|
if main_timer > hb.settings.tick or timer > 4 then
|
||||||
if main_timer > hb.settings.tick then main_timer = 0 end
|
if main_timer > hb.settings.tick then main_timer = 0 end
|
||||||
for playername, player in pairs(hb.players) do
|
for playername, player in pairs(hb.players) do
|
||||||
@ -342,8 +337,6 @@ minetest.after(2.5, function()
|
|||||||
update_hud(player)
|
update_hud(player)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
if timer > 4 then timer = 0 end
|
if timer > 4 then timer = 0 end
|
||||||
end)
|
|
||||||
end)
|
end)
|
||||||
|
Loading…
Reference in New Issue
Block a user