Skip to content

Commit

Permalink
Lord Archery: Mobs-archers: add hitter:is_player() check
Browse files Browse the repository at this point in the history
  • Loading branch information
Doloment committed Dec 30, 2024
1 parent 1a8a532 commit cf65d1c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mods/_various/mobs/api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1882,7 +1882,7 @@ function mobs:mob_punch(self, hitter, tflp, tool_capabilities, dir)
end

-- weapon wear
local weapon = hitter:get_wielded_item()
local weapon = hitter:get_wielded_item() or ItemStack("lord_archery:apple_wood_bow")
local punch_interval = 1.4

-- calculate mob damage
Expand Down Expand Up @@ -1933,7 +1933,8 @@ function mobs:mob_punch(self, hitter, tflp, tool_capabilities, dir)
end

if weapon:get_definition()
and weapon:get_definition().tool_capabilities then
and weapon:get_definition().tool_capabilities
and hitter:is_player() then

weapon:add_wear(floor((punch_interval / 75) * 9000))
hitter:set_wielded_item(weapon)
Expand Down

0 comments on commit cf65d1c

Please sign in to comment.