Skip to content

Commit

Permalink
Fix a crash: mobs accessing hitter (again, trivial) (#1885)
Browse files Browse the repository at this point in the history
  • Loading branch information
Doloment authored Dec 31, 2024
1 parent 0db8697 commit af8d371
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions mods/_various/mobs/api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1883,7 +1883,7 @@ function mobs:mob_punch(self, hitter, tflp, tool_capabilities, dir)

-- weapon wear
local weapon = ItemStack("lord_archery:apple_wood_bow")
if hitter:is_player() then
if hitter and hitter:is_player() then
weapon = hitter:get_wielded_item()
end
local punch_interval = 1.4
Expand Down Expand Up @@ -1937,8 +1937,7 @@ function mobs:mob_punch(self, hitter, tflp, tool_capabilities, dir)

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

and hitter and hitter:is_player() then
weapon:add_wear(floor((punch_interval / 75) * 9000))
hitter:set_wielded_item(weapon)
end
Expand Down

0 comments on commit af8d371

Please sign in to comment.