forked from VoxeLibre/VoxeLibre
Merge pull request 'Minor fixes on potion behavior on damage disabled servers (closes 4586)' (#4599) from goodspeed/VoxeLibre:potion-hud into master
Reviewed-on: VoxeLibre/VoxeLibre#4599 Reviewed-by: the-real-herowl <the-real-herowl@noreply.git.minetest.land>
This commit is contained in:
commit
09aba760cf
|
@ -330,9 +330,16 @@ function hb.change_hudbar(player, identifier, new_value, new_max_value, new_icon
|
||||||
|
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
local hudtable = hb.get_hudtable(identifier)
|
local hudtable = hb.get_hudtable(identifier)
|
||||||
|
|
||||||
|
-- hb.change_hudbar may be called with a non-existing hudbar like hunger.
|
||||||
|
if hudtable == nil then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
if not hudtable.hudstate[name] then
|
if not hudtable.hudstate[name] then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
local value_changed, max_changed = false, false
|
local value_changed, max_changed = false, false
|
||||||
|
|
||||||
if new_value then
|
if new_value then
|
||||||
|
|
|
@ -1260,7 +1260,11 @@ local function potions_init_icons(player)
|
||||||
})
|
})
|
||||||
table.insert(icon_ids[name], id)
|
table.insert(icon_ids[name], id)
|
||||||
end
|
end
|
||||||
hb.init_hudbar(player, "absorption")
|
|
||||||
|
-- Absorption bar in damage disabled server is unneccessary
|
||||||
|
if minetest.settings:get_bool("enable_damage") == true then
|
||||||
|
hb.init_hudbar(player, "absorption")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function potions_set_icons(player)
|
local function potions_set_icons(player)
|
||||||
|
|
Loading…
Reference in New Issue