Update HUD for poison/regen.
This commit is contained in:
parent
bdd92c6cdb
commit
9a32bdc967
|
@ -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]
|
||||
|
|
BIN
mods/ITEMS/mcl_potions/textures/hbhunger_icon_regen_poison.png
Normal file
BIN
mods/ITEMS/mcl_potions/textures/hbhunger_icon_regen_poison.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 290 B |
BIN
mods/ITEMS/mcl_potions/textures/hudbars_icon_regenerate.png
Normal file
BIN
mods/ITEMS/mcl_potions/textures/hudbars_icon_regenerate.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 305 B |
Loading…
Reference in New Issue
Block a user