From 8f2088b92fe03a7443dc16524bc313adc8f08c4c Mon Sep 17 00:00:00 2001 From: LoneWolfHT Date: Sat, 21 Nov 2020 08:31:36 -0800 Subject: [PATCH] Misc bug/exploit fixes --- mods/ctf/ctf_classes/medic.lua | 6 +++--- mods/pvp/anticoward/init.lua | 8 ++++---- mods/pvp/anticoward/mod.conf | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/mods/ctf/ctf_classes/medic.lua b/mods/ctf/ctf_classes/medic.lua index 342afd1..bcef60b 100644 --- a/mods/ctf/ctf_classes/medic.lua +++ b/mods/ctf/ctf_classes/medic.lua @@ -68,7 +68,7 @@ local dont_heal = {} minetest.register_on_player_hpchange(function(player, hp_change, reason) local name = player:get_player_name() - if reason.type == "drown" or reason.type == "mode_damage" then + if reason.type == "drown" or reason.type == "node_damage" then dont_heal[name] = true elseif dont_heal[name] then dont_heal[name] = nil @@ -95,8 +95,8 @@ minetest.override_item("ctf_bandages:bandage", { local name = user:get_player_name() if ctf.player(pname).team == ctf.player(name).team then local nodename = minetest.get_node(object:get_pos()).name - if dont_heal[pname] or nodename:find("lava") or nodename:find("water") then - return -- Can't heal players in lava/water + if dont_heal[pname] or nodename:find("lava") or nodename:find("water") or nodename:find("spike") then + return -- Can't heal players in lava/water/spikes end local hp = object:get_hp() diff --git a/mods/pvp/anticoward/init.lua b/mods/pvp/anticoward/init.lua index a212451..71b435a 100644 --- a/mods/pvp/anticoward/init.lua +++ b/mods/pvp/anticoward/init.lua @@ -11,6 +11,10 @@ local COMBAT_TIMEOUT_TIME = 20 minetest.register_on_punchplayer(function(player, hitter, time_from_last_punch, tool_capabilities, dir, damage) if player and hitter then + if ctf_respawn_immunity.is_immune(player) or ctf_match.is_in_build_time() then + return + end + local pname = player:get_player_name() local hname = hitter:get_player_name() @@ -22,10 +26,6 @@ time_from_last_punch, tool_capabilities, dir, damage) return end - if ctf_respawn_immunity.is_immune(player) then - return - end - local hp = player:get_hp() - damage if hp <= 0 then if potential_cowards[pname] then diff --git a/mods/pvp/anticoward/mod.conf b/mods/pvp/anticoward/mod.conf index cce40a9..a8245cc 100644 --- a/mods/pvp/anticoward/mod.conf +++ b/mods/pvp/anticoward/mod.conf @@ -1,2 +1,2 @@ name = anticoward -depends = ctf, ctf_classes +depends = ctf, ctf_classes, ctf_match