forked from MineClone5/MineClone5
Merge branch 'master' into mineclone5
This commit is contained in:
commit
0dc44afe3d
|
@ -39,7 +39,7 @@ local last_id = 0
|
||||||
function mcl_bossbars.add_bar(player, def, dynamic, priority)
|
function mcl_bossbars.add_bar(player, def, dynamic, priority)
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
local bars = mcl_bossbars.bars[name]
|
local bars = mcl_bossbars.bars[name]
|
||||||
local bar = {text = def.text, priority = priority or 0}
|
local bar = {text = def.text, priority = priority or 0, timeout = def.timeout}
|
||||||
bar.color, bar.image = get_color_info(def.color, def.percentage)
|
bar.color, bar.image = get_color_info(def.color, def.percentage)
|
||||||
if dynamic then
|
if dynamic then
|
||||||
for _, other in pairs(bars) do
|
for _, other in pairs(bars) do
|
||||||
|
@ -119,7 +119,7 @@ minetest.register_on_leaveplayer(function(player)
|
||||||
mcl_bossbars.bars[name] = nil
|
mcl_bossbars.bars[name] = nil
|
||||||
end)
|
end)
|
||||||
|
|
||||||
minetest.register_globalstep(function()
|
minetest.register_globalstep(function(dtime)
|
||||||
for _, player in pairs(minetest.get_connected_players()) do
|
for _, player in pairs(minetest.get_connected_players()) do
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
local bars = mcl_bossbars.bars[name]
|
local bars = mcl_bossbars.bars[name]
|
||||||
|
@ -134,8 +134,13 @@ minetest.register_globalstep(function()
|
||||||
local hud = table.remove(huds, 1)
|
local hud = table.remove(huds, 1)
|
||||||
|
|
||||||
if bar and bar.id then
|
if bar and bar.id then
|
||||||
|
if bar.timeout then
|
||||||
|
bar.timeout = bar.timeout - dtime
|
||||||
|
end
|
||||||
|
if not bar.timeout or bar.timeout > 0 then
|
||||||
table.insert(bars_new, bar)
|
table.insert(bars_new, bar)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if bar and not hud then
|
if bar and not hud then
|
||||||
if i < mcl_bossbars.max_bars then
|
if i < mcl_bossbars.max_bars then
|
||||||
|
|
Loading…
Reference in New Issue