1
0
Fork 0

Add a bossbar limit setting

This commit is contained in:
Lizzy Fleckenstein 2021-04-07 17:02:03 +02:00
parent f282cd0c4d
commit 567f157541
2 changed files with 26 additions and 20 deletions

View File

@ -3,6 +3,7 @@ mcl_bossbars = {
huds = {}, huds = {},
static = {}, static = {},
colors = {"light_purple", "blue", "red", "green", "yellow", "dark_purple", "white"}, colors = {"light_purple", "blue", "red", "green", "yellow", "dark_purple", "white"},
max_bars = tonumber(minetest.settings:get("max_bossbars")) or 6
} }
function mcl_bossbars.recalculate_colors() function mcl_bossbars.recalculate_colors()
@ -127,6 +128,7 @@ minetest.register_globalstep(function()
end end
if bar and not hud then if bar and not hud then
if i < mcl_bossbars.max_bars then
hud = { hud = {
color = bar.color, color = bar.color,
image = bar.image, image = bar.image,
@ -148,6 +150,7 @@ minetest.register_globalstep(function()
scale = {x = 3, y = 3}, scale = {x = 3, y = 3},
}), }),
} }
end
elseif hud and not bar then elseif hud and not bar then
player:hud_remove(hud.text_id) player:hud_remove(hud.text_id)
player:hud_remove(hud.image_id) player:hud_remove(hud.image_id)

View File

@ -97,6 +97,9 @@ animated_chests (Animated chests) bool true
# Whether to preview the player in inventory in 3D (requires Minetest 5.4) # Whether to preview the player in inventory in 3D (requires Minetest 5.4)
3d_player_preview (3D Player preview) bool true 3d_player_preview (3D Player preview) bool true
# The maximum number of boss bars to simultaniously display on the screen
max_bossbars (Maximum Boss bars) int 6
[Experimental] [Experimental]
# Whether ice is translucent. If disabled, ice is fully opaque. # Whether ice is translucent. If disabled, ice is fully opaque.
# #