From d171436b467552047f2385c656386463d7807671 Mon Sep 17 00:00:00 2001 From: LoneWolfHT Date: Sun, 8 Nov 2020 09:08:14 -0800 Subject: [PATCH] Fix some bugs with knight damage --- .luacheckrc | 2 +- mods/ctf/ctf_classes/melee.lua | 5 +++++ mods/ctf/ctf_classes/mod.conf | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.luacheckrc b/.luacheckrc index 46478c1..9d396d1 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -16,7 +16,7 @@ globals = { "ctf_colors", "hudkit", "default", "treasurer", "ChatCmdBuilder", "ctf_map", "ctf_match", "ctf_stats", "ctf_treasure", "ctf_playertag", "chatplus", "irc", "armor", "vote", "give_initial_stuff", "hud_score", "physics", "tsm_chests", - "armor", "shooter", "grenades", "ctf_classes", "ctf_bandages" + "armor", "shooter", "grenades", "ctf_classes", "ctf_bandages", "ctf_respawn_immunity" } read_globals = { diff --git a/mods/ctf/ctf_classes/melee.lua b/mods/ctf/ctf_classes/melee.lua index 1087c53..e687a59 100644 --- a/mods/ctf/ctf_classes/melee.lua +++ b/mods/ctf/ctf_classes/melee.lua @@ -1,5 +1,7 @@ minetest.register_on_punchplayer(function(player, hitter, time_from_last_punch, tool_capabilities, dir, damage) if tool_capabilities.damage_groups.nopunch then return end + if ctf_respawn_immunity.is_immune(player) then return true end + local class = ctf_classes.get(hitter) if class.properties.melee_bonus and hitter:get_wielded_item():get_name():find("sword") then @@ -10,7 +12,10 @@ minetest.register_on_punchplayer(function(player, hitter, time_from_last_punch, end if hitter:get_hp() > 0 then + player:set_hp(player:get_hp() - damage) player:punch(hitter, 1, {damage_groups = {fleshy = time_from_last_punch*2, nopunch = 1}}, dir) + + return true end end end) diff --git a/mods/ctf/ctf_classes/mod.conf b/mods/ctf/ctf_classes/mod.conf index 91d54a6..2799470 100644 --- a/mods/ctf/ctf_classes/mod.conf +++ b/mods/ctf/ctf_classes/mod.conf @@ -1,3 +1,3 @@ name = ctf_classes -depends = ctf, ctf_flag, ctf_colors, ctf_map_core, ctf_stats, ctf_bandages, physics, shooter, hpregen, give_initial_stuff, dropondie, crafting, sniper_rifles, grenades, furnace +depends = ctf, ctf_flag, ctf_colors, ctf_map_core, ctf_stats, ctf_bandages, physics, shooter, hpregen, give_initial_stuff, dropondie, crafting, sniper_rifles, grenades, furnace, ctf_respawn_immunity description = Adds classes, including knight, shooter, and medic