From 63bd63911218c602595a212b79f5df0a4baf20cd Mon Sep 17 00:00:00 2001 From: orbea Date: Wed, 29 Apr 2020 15:10:31 -0700 Subject: [PATCH] Don't damage armor when drowning, eating or starving. --- 3d_armor/init.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/3d_armor/init.lua b/3d_armor/init.lua index 3c4a70f3..3a9c0667 100644 --- a/3d_armor/init.lua +++ b/3d_armor/init.lua @@ -392,8 +392,9 @@ if armor.config.punch_damage == true then end) end -minetest.register_on_player_hpchange(function(player, hp_change) - if player and hp_change < 0 then +minetest.register_on_player_hpchange(function(player, hp_change, reason) + if player and reason.type ~= "drown" and reason.hunger == nil + and hp_change < 0 then local name = player:get_player_name() if name then local heal = armor.def[name].heal