From bdd92c6cdb4380c4301a23fb3f7c3617ce3087ed Mon Sep 17 00:00:00 2001 From: Brandon Date: Mon, 27 Jul 2020 17:32:48 -0400 Subject: [PATCH] update poison to swap hudbar icons and remove old dead functions --- mods/ITEMS/mcl_potions/functions.lua | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index 0704093cd..afe87c367 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -55,6 +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 + hb.change_hudbar(player, "health", nil, nil, "hudbars_icon_health.png", nil, "hudbars_bar_health.png") + end end end @@ -282,6 +285,11 @@ function mcl_potions._reset_player_effects(player) if is_poisoned[player] then is_poisoned[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_regenerating[player] then @@ -383,19 +391,8 @@ function mcl_potions.make_invisible(player, toggle) end -function mcl_potions.poison(player, toggle) - if not player then return false end - is_poisoned[player:get_player_name()] = toggle -end - -function mcl_potions.regenerate(player, toggle) - - if not player then return false end - is_regenerating[player:get_player_name()] = toggle - -end function mcl_potions._use_potion(item, obj, color) local d = 0.1 @@ -558,6 +555,10 @@ 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") + end + else local victim = is_poisoned[player]