Workaround to prevent double death messages

This commit is contained in:
Elias Fleckenstein 2021-05-05 13:27:30 +02:00
parent f53ff8418f
commit 35a2a2b912

View file

@ -149,13 +149,18 @@ minetest.register_on_player_hpchange(function(player, hp_change, mt_reason)
end, true)
minetest.register_on_player_hpchange(function(player, hp_change, mt_reason)
if hp_change < 0 and player:get_hp() > 0 then
if hp_change < 0 then
mcl_damage.run_damage_callbacks(player, -hp_change, mcl_damage.from_mt(mt_reason))
end
if player:get_hp() > 0 then
mt_reason._mcl_approved = true
end
end, false)
minetest.register_on_dieplayer(function(player, mt_reason)
mcl_damage.run_death_callbacks(player, mcl_damage.from_mt(mt_reason))
if mt_reason._mcl_approved then
mcl_damage.run_death_callbacks(player, mcl_damage.from_mt(mt_reason))
end
end)
minetest.register_on_mods_loaded(function()