mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2025-02-03 22:00:19 +01:00
fix? hudbars register(bug/lag?) table hb.players[""]
This commit is contained in:
parent
04708354bd
commit
21db57d1db
@ -20,7 +20,7 @@ hb.settings.vmargin = 24
|
|||||||
hb.settings.tick = 0.1
|
hb.settings.tick = 0.1
|
||||||
|
|
||||||
-- Table which contains all players with active default HUD bars (only for internal use)
|
-- Table which contains all players with active default HUD bars (only for internal use)
|
||||||
hb.players = {}
|
--hb.players = {}
|
||||||
|
|
||||||
function hb.value_to_barlength(value, max)
|
function hb.value_to_barlength(value, max)
|
||||||
if max == 0 then
|
if max == 0 then
|
||||||
@ -339,12 +339,14 @@ minetest.register_on_joinplayer(function(player)
|
|||||||
if not name or name == "" then return end
|
if not name or name == "" then return end
|
||||||
hide_builtin(player)
|
hide_builtin(player)
|
||||||
custom_hud(player)
|
custom_hud(player)
|
||||||
hb.players[name] = player
|
-- hb.players[name] = player
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
--[[
|
||||||
minetest.register_on_leaveplayer(function(player)
|
minetest.register_on_leaveplayer(function(player)
|
||||||
hb.players[player:get_player_name()] = nil
|
hb.players[player:get_player_name()] = nil
|
||||||
end)
|
end)
|
||||||
|
--]]
|
||||||
|
|
||||||
local main_timer = 0
|
local main_timer = 0
|
||||||
local timer = 0
|
local timer = 0
|
||||||
@ -353,7 +355,8 @@ minetest.register_globalstep(function(dtime)
|
|||||||
timer = timer + dtime
|
timer = timer + 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 --MFF (6/03/2016) removed cause server register(bug/lag?) table hb.players[""]
|
||||||
|
for _,player in ipairs(minetest.get_connected_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
|
||||||
|
Loading…
Reference in New Issue
Block a user