From 20d4728829bf451dcc318d01cce8a93a966632c1 Mon Sep 17 00:00:00 2001 From: stujones11 Date: Sun, 9 Apr 2017 17:58:19 +0100 Subject: [PATCH] Only reciprocate damage of valid tool items --- 3d_armor/api.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/3d_armor/api.lua b/3d_armor/api.lua index d4d349d..45a71f2 100644 --- a/3d_armor/api.lua +++ b/3d_armor/api.lua @@ -318,9 +318,10 @@ armor.punch = function(self, player, hitter, time_from_last_punch, tool_capabili if damage == true and recip == true and hitter and def.reciprocate_damage == true and uses > 0 then local item = hitter:get_wielded_item() - local wear = 65535 / uses - item:add_wear(wear) - hitter:set_wielded_item(item) + if item and item:get_name() ~= "" then + item:add_wear(65535 / uses) + hitter:set_wielded_item(item) + end -- reciprocate tool damage only once recip = false end