mirror of
https://github.com/minetest-mods/3d_armor.git
synced 2024-12-27 11:10:39 +01:00
Only reciprocate damage of valid tool items
This commit is contained in:
parent
7cfd744ff3
commit
20d4728829
@ -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
|
if damage == true and recip == true and hitter and
|
||||||
def.reciprocate_damage == true and uses > 0 then
|
def.reciprocate_damage == true and uses > 0 then
|
||||||
local item = hitter:get_wielded_item()
|
local item = hitter:get_wielded_item()
|
||||||
local wear = 65535 / uses
|
if item and item:get_name() ~= "" then
|
||||||
item:add_wear(wear)
|
item:add_wear(65535 / uses)
|
||||||
hitter:set_wielded_item(item)
|
hitter:set_wielded_item(item)
|
||||||
|
end
|
||||||
-- reciprocate tool damage only once
|
-- reciprocate tool damage only once
|
||||||
recip = false
|
recip = false
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user