mirror of
https://repo.or.cz/minetest_hudbars.git
synced 2024-11-27 17:43:44 +01:00
Fix add_all
This commit is contained in:
parent
377f194884
commit
0ac416ad49
14
init.lua
14
init.lua
@ -51,10 +51,10 @@ function hb.register_hudbar(identifier, text_color, label, textures, default_sta
|
|||||||
format_string = "%s: %d/%d"
|
format_string = "%s: %d/%d"
|
||||||
end
|
end
|
||||||
|
|
||||||
hudtable.add_all = function(player, start_value, start_max, start_hidden)
|
hudtable.add_all = function(player, hudtable, start_value, start_max, start_hidden)
|
||||||
if start_value == nil then start_value = default_start_value end
|
if start_value == nil then start_value = hudtable.default_start_value end
|
||||||
if start_max == nil then start_max = default_start_max end
|
if start_max == nil then start_max = hudtable.default_start_max end
|
||||||
if start_hidden == nil then start_hidden = default_start_hidden end
|
if start_hidden == nil then start_hidden = hudtable.default_start_hidden end
|
||||||
local ids = {}
|
local ids = {}
|
||||||
local state = {}
|
local state = {}
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
@ -137,6 +137,9 @@ function hb.register_hudbar(identifier, text_color, label, textures, default_sta
|
|||||||
hudtable.label = label
|
hudtable.label = label
|
||||||
hudtable.hudids = {}
|
hudtable.hudids = {}
|
||||||
hudtable.hudstate = {}
|
hudtable.hudstate = {}
|
||||||
|
hudtable.default_start_hidden = default_start_hidden
|
||||||
|
hudtable.default_start_value = default_start_value
|
||||||
|
hudtable.default_start_max = default_start_max
|
||||||
|
|
||||||
hb.hudbars_count= hb.hudbars_count + 1
|
hb.hudbars_count= hb.hudbars_count + 1
|
||||||
|
|
||||||
@ -144,7 +147,8 @@ function hb.register_hudbar(identifier, text_color, label, textures, default_sta
|
|||||||
end
|
end
|
||||||
|
|
||||||
function hb.init_hudbar(player, identifier, start_value, start_max, start_hidden)
|
function hb.init_hudbar(player, identifier, start_value, start_max, start_hidden)
|
||||||
hb.hudtables[identifier].add_all(player, start_value, start_max, start_hidden)
|
local hudtable = hb.get_hudtable(identifier)
|
||||||
|
hb.hudtables[identifier].add_all(player, hudtable, start_value, start_max, start_hidden)
|
||||||
end
|
end
|
||||||
|
|
||||||
function hb.change_hudbar(player, identifier, new_value, new_max_value)
|
function hb.change_hudbar(player, identifier, new_value, new_max_value)
|
||||||
|
Loading…
Reference in New Issue
Block a user