From 39cd62a2217f620b9e8fc83b891183cd0c2160c3 Mon Sep 17 00:00:00 2001 From: TenPlus1 Date: Wed, 8 Apr 2020 12:40:52 +0100 Subject: [PATCH] add protector_hurt delay to fix drop issue --- init.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index e67f35a..f8b8e21 100644 --- a/init.lua +++ b/init.lua @@ -293,7 +293,11 @@ function minetest.is_protected(pos, digger) -- hurt player if protection violated if protector_hurt > 0 and player:get_hp() > 0 then - player:set_hp(player:get_hp() - protector_hurt) + + -- This delay fixes item duplication bug (thanks luk3yx) + minetest.after(0.1, function() + player:set_hp(player:get_hp() - protector_hurt) + end) end -- flip player when protection violated