From 0ef68bb0f9cca47dccab4b300874d889503fefe1 Mon Sep 17 00:00:00 2001 From: LoneWolfHT Date: Sun, 8 Nov 2020 10:09:15 -0800 Subject: [PATCH] Fix bug in bugfix code --- mods/ctf/ctf_classes/melee.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mods/ctf/ctf_classes/melee.lua b/mods/ctf/ctf_classes/melee.lua index e687a59..8f6e059 100644 --- a/mods/ctf/ctf_classes/melee.lua +++ b/mods/ctf/ctf_classes/melee.lua @@ -5,16 +5,17 @@ minetest.register_on_punchplayer(function(player, hitter, time_from_last_punch, local class = ctf_classes.get(hitter) if class.properties.melee_bonus and hitter:get_wielded_item():get_name():find("sword") then + local php = player:get_hp() + if time_from_last_punch > 1 then time_from_last_punch = 1 elseif time_from_last_punch < 0.5 then time_from_last_punch = 0.5 end - if hitter:get_hp() > 0 then - player:set_hp(player:get_hp() - damage) + if php - damage > 0 then + player:set_hp(php - damage) player:punch(hitter, 1, {damage_groups = {fleshy = time_from_last_punch*2, nopunch = 1}}, dir) - return true end end