Fix respawn immunity ending when hitting teammate (#742)

This commit is contained in:
realOneplustwo 2021-01-20 10:09:55 -08:00 committed by GitHub
parent 62cedd9267
commit ec36999fa3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -45,17 +45,19 @@ minetest.register_on_punchplayer(function(player, hitter,
local pteam = ctf.player(pname).team local pteam = ctf.player(pname).team
local hteam = ctf.player(hname).team local hteam = ctf.player(hname).team
if player and ctf_respawn_immunity.is_immune(player) and pteam ~= hteam then if pteam ~= hteam then
minetest.chat_send_player(hname, minetest.colorize("#EE8822", pname .. if player and ctf_respawn_immunity.is_immune(player) then
" just respawned or joined," .. " and is immune to attacks!")) minetest.chat_send_player(hname, minetest.colorize("#EE8822", pname ..
return true " just respawned or joined," .. " and is immune to attacks!"))
end return true
end
if hitter and ctf_respawn_immunity.is_immune(hitter) then if hitter and ctf_respawn_immunity.is_immune(hitter) then
minetest.chat_send_player(hname, minetest.colorize("#FF8C00", minetest.chat_send_player(hname, minetest.colorize("#FF8C00",
"Your immunity has ended because you attacked a player")) "Your immunity has ended because you attacked a player"))
immune_players[hname] = nil immune_players[hname] = nil
ctf_respawn_immunity.update_effects(hitter) ctf_respawn_immunity.update_effects(hitter)
end
end end
end) end)