mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-10 02:01:07 +01:00
Merge pull request 'Minor fixes on potion behavior on damage disabled servers (closes 4586)' (#4599) from goodspeed/VoxeLibre:potion-hud into master
Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4599 Reviewed-by: the-real-herowl <the-real-herowl@noreply.git.minetest.land>
This commit is contained in:
commit
09aba760cf
2 changed files with 12 additions and 1 deletions
|
@ -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,8 +1260,12 @@ local function potions_init_icons(player)
|
||||||
})
|
})
|
||||||
table.insert(icon_ids[name], id)
|
table.insert(icon_ids[name], id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Absorption bar in damage disabled server is unneccessary
|
||||||
|
if minetest.settings:get_bool("enable_damage") == true then
|
||||||
hb.init_hudbar(player, "absorption")
|
hb.init_hudbar(player, "absorption")
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local function potions_set_icons(player)
|
local function potions_set_icons(player)
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
|
|
Loading…
Reference in a new issue