Skip to content

Commit

Permalink
Call custom on_punched functions w/ hitter = nil too
Browse files Browse the repository at this point in the history
  • Loading branch information
Niklp09 committed Mar 18, 2024
1 parent 25369e5 commit 691036d
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions 3d_armor/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -394,14 +394,15 @@ end
if armor.config.punch_damage == true then
minetest.register_on_punchplayer(function(player, hitter,
time_from_last_punch, tool_capabilities)
if hitter == nil then
return
end
local name = player:get_player_name()
local hit_ip = hitter:is_player()
if name and hit_ip and minetest.is_protected(player:get_pos(), "") then
return
elseif name then
if hitter then
local hit_ip = hitter:is_player()
if name and hit_ip and minetest.is_protected(player:get_pos(), "") then
return
end
end

if name then
armor:punch(player, hitter, time_from_last_punch, tool_capabilities)
last_punch_time[name] = minetest.get_gametime()
end
Expand Down

0 comments on commit 691036d

Please sign in to comment.