From ec36999fa354687e5ba4ec7ccd8f792120f9f47e Mon Sep 17 00:00:00 2001 From: realOneplustwo <66292167+realOneplustwo@users.noreply.github.com> Date: Wed, 20 Jan 2021 10:09:55 -0800 Subject: [PATCH] Fix respawn immunity ending when hitting teammate (#742) --- mods/ctf/ctf_respawn_immunity/init.lua | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/mods/ctf/ctf_respawn_immunity/init.lua b/mods/ctf/ctf_respawn_immunity/init.lua index 25621ad..ae64984 100644 --- a/mods/ctf/ctf_respawn_immunity/init.lua +++ b/mods/ctf/ctf_respawn_immunity/init.lua @@ -45,17 +45,19 @@ minetest.register_on_punchplayer(function(player, hitter, local pteam = ctf.player(pname).team local hteam = ctf.player(hname).team - if player and ctf_respawn_immunity.is_immune(player) and pteam ~= hteam then - minetest.chat_send_player(hname, minetest.colorize("#EE8822", pname .. - " just respawned or joined," .. " and is immune to attacks!")) - return true - end + if pteam ~= hteam then + if player and ctf_respawn_immunity.is_immune(player) then + minetest.chat_send_player(hname, minetest.colorize("#EE8822", pname .. + " just respawned or joined," .. " and is immune to attacks!")) + return true + end - if hitter and ctf_respawn_immunity.is_immune(hitter) then - minetest.chat_send_player(hname, minetest.colorize("#FF8C00", - "Your immunity has ended because you attacked a player")) - immune_players[hname] = nil - ctf_respawn_immunity.update_effects(hitter) + if hitter and ctf_respawn_immunity.is_immune(hitter) then + minetest.chat_send_player(hname, minetest.colorize("#FF8C00", + "Your immunity has ended because you attacked a player")) + immune_players[hname] = nil + ctf_respawn_immunity.update_effects(hitter) + end end end)