diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index afe87c367..0c199697a 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -55,7 +55,9 @@ minetest.register_globalstep(function(dtime) if is_poisoned[player].timer >= is_poisoned[player].dur then is_poisoned[player] = nil - if is_player then + if is_regenerating[player] then + hb.change_hudbar(player, "health", nil, nil, "hudbars_icon_regenerate.png", nil, "hudbars_bar_health.png") + else hb.change_hudbar(player, "health", nil, nil, "hudbars_icon_health.png", nil, "hudbars_bar_health.png") end end @@ -89,6 +91,13 @@ minetest.register_globalstep(function(dtime) if is_regenerating[player].timer >= is_regenerating[player].dur then is_regenerating[player] = nil + if is_player then + if is_poisoned[player] then + hb.change_hudbar(player, "health", nil, nil, "hbhunger_icon_health_poison.png", nil, "hudbars_bar_health.png") + else + hb.change_hudbar(player, "health", nil, nil, "hudbars_icon_health.png", nil, "hudbars_bar_health.png") + end + end end end @@ -284,6 +293,7 @@ function mcl_potions._reset_player_effects(player) end if is_poisoned[player] then + is_poisoned[player] = nil if player:is_player() then @@ -293,7 +303,13 @@ function mcl_potions._reset_player_effects(player) end if is_regenerating[player] then + is_regenerating[player] = nil + + if player:is_player() then + hb.change_hudbar(player, "health", nil, nil, "hudbars_icon_health.png", nil, "hudbars_bar_health.png") + end + end if is_strong[player] then @@ -556,7 +572,11 @@ function mcl_potions.poison_func(player, factor, duration) is_poisoned[player] = {step = factor, dur = duration, timer = 0} if player:is_player() then - hb.change_hudbar(player, "health", nil, nil, "hbhunger_icon_health_poison.png", nil, "hbhunger_bar_health_poison.png") + if is_regenerating[player] then + hb.change_hudbar(player, "health", nil, nil, "hbhunger_icon_regen_poison.png", nil, "hudbars_bar_health.png") + else + hb.change_hudbar(player, "health", nil, nil, "hbhunger_icon_health_poison.png", nil, "hbhunger_bar_health_poison.png") + end end else @@ -577,6 +597,14 @@ function mcl_potions.regeneration_func(player, factor, duration) is_regenerating[player] = {step = factor, dur = duration, timer = 0} + if player:is_player() then + if is_poisoned[player] then + hb.change_hudbar(player, "health", nil, nil, "hbhunger_icon_regen_poison.png", nil, "hudbars_bar_health.png") + else + hb.change_hudbar(player, "health", nil, nil, "hudbars_icon_regenerate.png", nil, "hudbars_bar_health.png") + end + end + else local victim = is_regenerating[player] diff --git a/mods/ITEMS/mcl_potions/textures/hbhunger_icon_regen_poison.png b/mods/ITEMS/mcl_potions/textures/hbhunger_icon_regen_poison.png new file mode 100644 index 000000000..d4fe9b4e0 Binary files /dev/null and b/mods/ITEMS/mcl_potions/textures/hbhunger_icon_regen_poison.png differ diff --git a/mods/ITEMS/mcl_potions/textures/hudbars_icon_regenerate.png b/mods/ITEMS/mcl_potions/textures/hudbars_icon_regenerate.png new file mode 100644 index 000000000..4ae259897 Binary files /dev/null and b/mods/ITEMS/mcl_potions/textures/hudbars_icon_regenerate.png differ