Remove pointless delays and useless code

This commit is contained in:
Wuzzy 2015-02-23 01:39:48 +01:00
parent 25b59646c2
commit cfe8b3a60b

View File

@ -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,23 +325,18 @@ 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() main_timer = main_timer + dtime
minetest.register_globalstep(function(dtime) timer = timer + dtime
main_timer = main_timer + dtime if main_timer > hb.settings.tick or timer > 4 then
timer = timer + dtime if main_timer > hb.settings.tick then main_timer = 0 end
timer2 = timer2 + dtime for playername, player in pairs(hb.players) do
if main_timer > hb.settings.tick or timer > 4 then
if main_timer > hb.settings.tick then main_timer = 0 end
for playername, player in pairs(hb.players) do
-- only proceed if damage is enabled -- only proceed if damage is enabled
if minetest.setting_getbool("enable_damage") then if minetest.setting_getbool("enable_damage") then
-- update all hud elements -- update all hud elements
update_hud(player) update_hud(player)
end end
end
end end
if timer > 4 then timer = 0 end end
end) if timer > 4 then timer = 0 end
end) end)