Don't damage armor when drowning, eating or starving.

This commit is contained in:
orbea 2020-04-29 15:10:31 -07:00 committed by Buckaroo Banzai
parent a6b89e7929
commit acd8b2647d
1 changed files with 3 additions and 2 deletions

View File

@ -392,8 +392,9 @@ if armor.config.punch_damage == true then
end) end)
end end
minetest.register_on_player_hpchange(function(player, hp_change) minetest.register_on_player_hpchange(function(player, hp_change, reason)
if player and hp_change < 0 then if player and reason.type ~= "drown" and reason.hunger == nil
and hp_change < 0 then
local name = player:get_player_name() local name = player:get_player_name()
if name then if name then
local heal = armor.def[name].heal local heal = armor.def[name].heal