Fix oversending of sprint HUD
This commit is contained in:
parent
17ea7525cb
commit
ff3eb5e49f
1 changed files with 6 additions and 2 deletions
|
@ -79,8 +79,12 @@ minetest.register_globalstep(function(dtime)
|
||||||
if SPRINT_HUDBARS_USED then
|
if SPRINT_HUDBARS_USED then
|
||||||
hb.change_hudbar(player, "sprint", info.stamina)
|
hb.change_hudbar(player, "sprint", info.stamina)
|
||||||
else
|
else
|
||||||
local numBars = (info.stamina / STAMINA_MAX) * 20
|
local numBars = math.floor(20 * info.stamina / STAMINA_MAX)
|
||||||
|
if info.lastHudSendValue ~= numBars then
|
||||||
|
info.lastHudSendValue = numBars
|
||||||
player:hud_change(info.hud, "number", numBars)
|
player:hud_change(info.hud, "number", numBars)
|
||||||
|
print("Sending hud value")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue