Fix on_killedplayer callbacks running when victim has already died
This commit is contained in:
parent
8f341538f4
commit
48545e39e8
@ -490,14 +490,20 @@ minetest.register_on_punchplayer(function(player, hitter,
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if to.team == from.team and to.team ~= "" and to.team ~= nil and to.name ~= from.name then
|
if to.team == from.team and to.team ~= "" and
|
||||||
|
to.team ~= nil and to.name ~= from.name then
|
||||||
minetest.chat_send_player(hname, pname .. " is on your team!")
|
minetest.chat_send_player(hname, pname .. " is on your team!")
|
||||||
if not ctf.setting("friendly_fire") then
|
if not ctf.setting("friendly_fire") then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if player:get_hp() - damage <= 0 then
|
local hp = player:get_hp()
|
||||||
|
if hp == 0 then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
if hp - damage <= 0 then
|
||||||
dead_players[pname] = true
|
dead_players[pname] = true
|
||||||
local wielded = hitter:get_wielded_item()
|
local wielded = hitter:get_wielded_item()
|
||||||
for i = 1, #ctf.registered_on_killedplayer do
|
for i = 1, #ctf.registered_on_killedplayer do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user