mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-12-26 09:59:33 +01:00
Do not send useless HUDCHANGE packets
Several mods set or unset the visibility of a HUD bar way too often (e.g. in a globalstep handler), causing the server to send a lot of superfluous HUDCHANGE packets to each client. Returning from hb.hide_hudbar() early if HUD bar visibility would not change prevents sending these packets.
This commit is contained in:
parent
1a5339e907
commit
1c192f4fbb
1 changed files with 2 additions and 0 deletions
|
@ -425,6 +425,7 @@ function hb.hide_hudbar(player, identifier)
|
|||
local name = player:get_player_name()
|
||||
local hudtable = hb.get_hudtable(identifier)
|
||||
if hudtable == nil then return false end
|
||||
if hudtable.hudstate[name].hidden == true then return true end
|
||||
if hb.settings.bar_type == "progress_bar" then
|
||||
if hudtable.hudids[name].icon then
|
||||
player:hud_change(hudtable.hudids[name].icon, "scale", {x=0,y=0})
|
||||
|
@ -443,6 +444,7 @@ function hb.unhide_hudbar(player, identifier)
|
|||
local name = player:get_player_name()
|
||||
local hudtable = hb.get_hudtable(identifier)
|
||||
if hudtable == nil then return false end
|
||||
if hudtable.hudstate[name].hidden == false then return true end
|
||||
local value = hudtable.hudstate[name].value
|
||||
local max = hudtable.hudstate[name].max
|
||||
if hb.settings.bar_type == "progress_bar" then
|
||||
|
|
Loading…
Reference in a new issue