Removed the approved field from death reasons.

This created a strange bug that only death reasons created by
mcl_utils.deal_damage were "approved" so only they triggered running the
death callbacks, so only they triggered printing a death message.
Therefore most deaths did not produce a death message.
This commit is contained in:
CyberMango 2023-01-18 23:36:21 +02:00
parent 1c65e0ad68
commit 78f32d2dd4

@ -155,7 +155,6 @@ end, true)
minetest.register_on_player_hpchange(function(player, hp_change, mt_reason)
if not damage_enabled then return 0 end
if player:get_hp() > 0 then
mt_reason.approved = true
if hp_change < 0 then
mcl_damage.run_damage_callbacks(player, -hp_change, mcl_damage.from_mt(mt_reason))
end
@ -163,9 +162,7 @@ minetest.register_on_player_hpchange(function(player, hp_change, mt_reason)
end, false)
minetest.register_on_dieplayer(function(player, mt_reason)
if mt_reason.approved then
mcl_damage.run_death_callbacks(player, mcl_damage.from_mt(mt_reason))
end
mcl_damage.run_death_callbacks(player, mcl_damage.from_mt(mt_reason))
minetest.log("action","Player "..player:get_player_name().." died at "..minetest.pos_to_string(vector.round(player:get_pos())))
end)