Only reciprocate damage of valid tool items

This commit is contained in:
stujones11 2017-04-09 17:58:19 +01:00
parent 7cfd744ff3
commit 20d4728829

View File

@ -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